Repository navigation
Fix OAuth consent Connect failing: cross-site POST forbidden - #6
Merged
Merged
Conversation
The consent page set Referrer-Policy: no-referrer. Browsers then send 'Origin: null' on the
page's own same-origin form POST, which SvelteKit's CSRF check rejects ('Cross-site POST form
submissions are forbidden'). Use same-origin so the real Origin is sent, and assert it in the
OAuth smoke test (which previously set Origin by hand and could not see this).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Bug
Clicking Connect on
/admin/oauth/authorizein a real browser fails withCross-site POST form submissions are forbidden.Cause
The consent page sets
Referrer-Policy: no-referrer. Browsers then sendOrigin: nullon the page's own same-origin form POST, which SvelteKit's CSRF check (and the handler's ownOrigin === url.origincheck) rejects. The OAuth smoke test setOriginmanually, so it never exercised this.Fix
Referrer-Policy: same-origin: the real Origin is sent for same-origin posts, and nothing is leaked cross-origin. Regression assertion added toscripts/oauth-smoke.mjs.Tested
Full production-worker smoke suite incl. OAuth discovery/consent/PKCE/scopes/refresh/revocation.
🤖 Generated with Claude Code