-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-jpf9-646h-4px7
* Mitigate a CSRF vulnerability in export and backup-related endpoints While Django has built-in CSRF protection (which we use), it does not cover GET requests, and AFAICS, there is no way to force it to do that. Unfortunately, the many endpoints that initiate dataset exports and backups do accept GET requests _and_ initiate side effects, making them susceptible. The proper fix for this issue would be to redesign those endpoints to use POST requests, but a) that's more complicated, and b) we should still keep the old endpoints for backwards compatibility. So apply a less proper fix, which is to disable session authentication for the affected endpoints. It's a bit complex, because in some cases (particularly when `action=download`) we _need_ session authentication to work, because the UI redirects the user to such endpoints. In addition, modify the handling logic for these endpoints in order to ensure that when `action=download`, no side effects are triggered. Previously, `action=download` would still queue an RQ job if none existed. Even after this, `action=download` will still have two small side effects: * An existing RQ job will be deleted if its results are out of date. I don't think this is a problem, because such a job cannot be used anyway. * A completed RQ job will be deleted too. This is a problematic design, but I don't think an attacker can achieve anything by exploiting this. If an attacker maliciously redirects the user to an `action=download` URL, then they'll just download the export/backup as usual. Some tests were making export requests incorrectly, so fix them. * Add test for the CSRF workaround
- Loading branch information
Showing
8 changed files
with
280 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### Security | ||
|
||
- Mitigated a CSRF vulnerability in backup and export-related endpoints | ||
(<https://github.com/cvat-ai/cvat/security/advisories/GHSA-jpf9-646h-4px7>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.