Skip to content

fix(auth): harden logout against cross-site CSRF - #380

Merged
Sam123ben merged 2 commits into
mainfrom
fix/auth-logout-csrf
Aug 31, 2026
Merged

fix(auth): harden logout against cross-site CSRF#380
Sam123ben merged 2 commits into
mainfrom
fix/auth-logout-csrf

Conversation

@Sam123ben

Copy link
Copy Markdown
Member

Rebases the two unmerged commits from fix/auth-logout-get onto current main: cross-site GET logout requests (hostile img/script tags) are rejected via Sec-Fetch-Site, and the guard extends to POST, legacy cross-origin clients, and sandboxed-iframe null origins.

The test conflict with the newer auto-login suite is resolved by keeping both: TestLogout_RejectsCrossSiteRequests covers eight navigation/origin cases, and the auto-login tests are unchanged. go build/vet/test all green.

GET logout stays for browser navigation, but Sec-Fetch-Site: cross-site
requests (hostile img/script tags) can no longer force-clear sessions.
Fetch metadata is authoritative when present; otherwise a mismatched or
opaque Origin is rejected. Covers hostile img tags, auto-submitted
cross-site forms, and sandboxed-iframe null origins.
@Sam123ben
Sam123ben merged commit b3575ad into main Aug 31, 2026
5 checks passed
@Sam123ben
Sam123ben deleted the fix/auth-logout-csrf branch August 31, 2026 11:00
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