Repository navigation
End the session on the server when logging out - #67
Merged
Merged
Conversation
Session cookies were self-contained signed tokens valid for 7 days, so logging out only deleted the browser's copy: any other copy kept working, and OIDC sessions could not be revoked at all. Each cookie now names a session id that must be listed in /config/sessions.json; logout removes it. Cookies issued before this change carry no id, so everyone signs in once more after upgrading. Fixes #57 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 #57
Replaces #62, which GitHub closed when its base branch (#61's) was deleted on merge. Same change, now merged with
main.What changed
auth.py: a small session store in/config/sessions.json({session id: expiry}, written atomically, mode 600, expired entries pruned on each login).create_session_cookie()puts a freshsidin every cookie;get_current_user()also requires thatsidto be active.logout()revokes the cookie's session (end_session()) before clearing the cookie, so a copy of the cookie stops working too. Other sessions (other devices) are unaffected.AUTH_MODE=nonehave no ConnectHub session).Upgrade note: cookies issued before this change carry no session id, so everyone has to sign in once after updating.
Testing
pytest(merged withmain): all pass. New tests: a copied cookie is rejected after logout; logging out one session keeps another; sessions survive a restart (modules reloaded); a validly signed cookie without an active session is rejected; expired sessions are dropped from the file; a damaged sessions file means no sessions. Four fail without the fix.🤖 Generated with Claude Code