Skip to content

Fix OAuth consent Connect failing: cross-site POST forbidden - #6

Merged
maxffarrell merged 1 commit into
mainfrom
fix/consent-referrer-policy
Nov 6, 2026
Merged

maxffarrell merged 1 commit into
mainfrom
fix/consent-referrer-policy

Conversation

@maxffarrell

Copy link
Copy Markdown
Owner

Bug

Clicking Connect on /admin/oauth/authorize in a real browser fails with Cross-site POST form submissions are forbidden.

Cause

The consent page sets Referrer-Policy: no-referrer. Browsers then send Origin: null on the page's own same-origin form POST, which SvelteKit's CSRF check (and the handler's own Origin === url.origin check) rejects. The OAuth smoke test set Origin manually, 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 to scripts/oauth-smoke.mjs.

Tested

Full production-worker smoke suite incl. OAuth discovery/consent/PKCE/scopes/refresh/revocation.

🤖 Generated with Claude Code

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>
@maxffarrell
maxffarrell merged commit aecde9b into main Nov 6, 2026
3 checks passed
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.

1 participant