Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ROMM-1505] Skip CSRF checks when request has Authorization header #1516

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

gantoine
Copy link
Member

Also fixes igdb_id and moby_id getting unset when not provided to update endpoint.

Fixes #1505

@gantoine gantoine requested a review from adamantike January 21, 2025 00:10
Copy link

github-actions bot commented Jan 21, 2025

Test Results

93 tests   93 ✅  26s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit 6927a97.

♻️ This comment has been updated with latest results.

request = Request(scope, receive)

# Skip CSRF check if Authorization header is present
if "Authorization" in request.headers:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid false positives and requests that skip CSRF without sending a valid header, I would change this to:

auth_scheme = request.headers.get("Authorization", "").split(" ", 1)[0].lower()
if auth_scheme == "bearer" or auth_scheme == "basic":

@gantoine gantoine requested a review from adamantike January 23, 2025 00:00
@gantoine gantoine merged commit 0ec35fb into master Jan 23, 2025
8 checks passed
@gantoine gantoine deleted the romm-1505 branch January 23, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants