fix: clean up expired sessions in SessionMiddleware#7
Merged
tompscanlan merged 3 commits intoOpenMeet-Team:mainfrom Jan 4, 2026
Merged
fix: clean up expired sessions in SessionMiddleware#7tompscanlan merged 3 commits intoOpenMeet-Team:mainfrom
tompscanlan merged 3 commits intoOpenMeet-Team:mainfrom
Conversation
Previously, expired sessions were detected but not removed from the database, causing them to accumulate indefinitely. Now when an expired session is encountered, it is deleted from the database before continuing with the request. Fixes OpenMeet-Team#3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This was referenced Jan 4, 2026
tompscanlan
approved these changes
Jan 4, 2026
Contributor
tompscanlan
left a comment
There was a problem hiding this comment.
When we detect an expired session, we delete it from the DB but don't clear the session cookie on the browser. The user will keep sending the stale cookie until it naturally expires.
Not blocking, just curious if you considered adding something like:
c.SetCookie(&http.Cookie{Name: "session", MaxAge: -1})
Address reviewer feedback: when detecting an expired session, now also clear the browser cookie by setting MaxAge=-1. This prevents the client from sending stale session cookies on subsequent requests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
|
Thanks for the feedback! Good catch - I've added the cookie clearing logic in commit 6bbf439. Now when an expired session is detected, we:
Also added a test assertion to verify the cookie is properly cleared. |
Contributor
|
LGTM |
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.
Summary
Changes
internal/oauth/middleware.go: Callstorage.DeleteSession()when session is expiredinternal/oauth/middleware_test.go: Add verification that expired session is deleted from databaseTest plan
go test ./...)go test -tags=e2e ./internal/oauth/...)Fixes #3
🤖 Generated with Claude Code