Repository navigation
fix: protect cookie authentication against CSRF - #653
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
david-loe
force-pushed
the
fix/cookie-csrf-origin
branch
from
October 29, 2026 10:03
67d070c to
b77785a
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cookie-authenticated writes accepted cross-site form submissions, allowing an attacker to transfer report ownership through an administrator's session when
SameSite=Nonewas enabled. Require an exact trusted Origin and a session-boundX-CSRF-Tokenfor cookie-authenticated writes, including logout and multipart uploads. LDAP login and magic-link requests require only a trusted Origin; external login callbacks and bearer/usage-token authentication retain their existing behavior.Add
GET /auth/csrfwith a non-cacheable response and generate its token from the session using HMAC. The frontend keeps the token in memory, shares concurrent token requests, clears it when the session changes, and supports pending offline logout without retrying mutations. Regression tests cover ownership preservation, invalid origins/tokens, session rotation, multipart requests, bearer access, and magic-link queue side effects.Validation: backend and frontend suites; targeted CSRF/session tests; HTTPS/proxy tests with
SameSite=None; production frontend build and smoke checks; Chromium and Firefox production interactions and service-worker migration; Biome and dependency-sync checks.Deploy frontend and backend together and reload existing frontend tabs. No database migration or new dependencies.