Skip to content

Commit

Permalink
Merge commit from fork
Browse files Browse the repository at this point in the history
The default `Content-Type` for `HttpResponse` is `text/html`, so an attacker
can create a label a `<script>` tag inside its name, generate a quality
report, and give a direct link to the `/data` endpoint to a victim user,
causing the script to execute with that user's permission.
  • Loading branch information
SpecLad authored Sep 20, 2024
1 parent 0bf45fd commit 75c3d57
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog.d/20240916_144227_roman_xss_quality_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Security

- Fixed an XSS vulnerability in the quality report data endpoint
(<https://github.com/cvat-ai/cvat/security/advisories/GHSA-2c85-39cc-2px9>)
2 changes: 1 addition & 1 deletion cvat/apps/quality_control/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def create(self, request, *args, **kwargs):
def data(self, request, pk):
report = self.get_object() # check permissions
json_report = qc.prepare_report_for_downloading(report, host=get_server_url(request))
return HttpResponse(json_report.encode())
return HttpResponse(json_report.encode(), content_type="application/json")


@extend_schema(tags=["quality"])
Expand Down

0 comments on commit 75c3d57

Please sign in to comment.