Repository navigation
Accept logout only by POST - #61
Merged
Merged
Conversation
/auth/logout also answered GET, and the SameSite=Lax session cookie is still sent when another site navigates there, so any page could sign the user out. Logout is now POST-only (303 to the login page) and the dashboard's Logout link is a form button. Fixes #59 Co-Authored-By: Claude Opus 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.
Fixes #59
What changed
logout()is POST-only and answers303 See Otherto/login.html(so the browser follows with a GET). GET now gets 405.<form method="post">button;.logout-form { display: contents }keeps it in the header row like the other buttons.A cross-site POST doesn't carry the
SameSite=Laxcookie, so another site can no longer sign users out.Testing
pytest: 249 passed, 8 skipped. New tests: GET logout is refused (405); POST logout returns 303 to the login page, clears the cookie and leaves the client signed out. Both fail without the fix.POST /auth/logout→303 See Other.🤖 Generated with Claude Code