Repository navigation
fix(bff): keep a logout tombstone in MemoryStore - #121
Merged
Merged
Conversation
A request that read a session just before a logout (the Gateway's touch in the proxy, or a token refresh writing rotated tokens back) called Put after Delete and re-inserted the session, with tokens the logout had just revoked. Delete now keeps a tombstone for PostgresStoreTombstoneTTL, as PostgresStore always has; Put ignores a tombstoned session and Sweep drops tombstones older than the TTL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA
ovander
pushed a commit
that referenced
this pull request
Oct 11, 2026
Moves [Unreleased] under [1.26.1] - 2026-10-11 (#121 MemoryStore logout tombstones), updates the compare links and the README install snippet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA
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.
What and why
MemoryStore.Deleteremoved a session, butPutre-inserted it unconditionally. So a request that read the session just before a logout could bring it back by writing it later, with tokens the logout had just revoked. Two writes do that:Gateway's touch in the proxy;gateway.go,Store.Put).PostgresStorehas always prevented this with a one-hour tombstone. This was found while moving the monitoring console to backendkit's stores (ovander/oauth2-monitoring#64), where it had to work around the gap for its own handlers.Deletenow records a tombstone forPostgresStoreTombstoneTTL(an hour).Putignores a tombstoned session, asPostgresStore'sPutdoes.Getgoes throughDelete, so a stale write-back can't revive it either.Sweepalso drops tombstones older than the TTL, so the map stays bounded by an hour of logouts.MemoryStoreandPut/Delete/Sweepdoc comments, the TTL constant's comment and the README.How it was tested
TestMemoryStoreDeleteKeepsTombstone: a Put after Delete is ignored, and unrelated sessions are unaffected. The tombstone survives a sweep within the TTL and is dropped after it.TestMemoryStoreExpiredGetIsTombstoned: a touched write-back of an idle-expired session doesn't revive it.TestMemoryStoreConcurrentLogout: 8 goroutines Put and Get while Delete runs; after Delete, no Put brings the session back. Run with-race -count=3.With the tombstone check removed from
Put, all three fail.go mod tidy && git diff --exit-code go.sumleavesgo.sumunchangedgo build ./...passesgo vet ./...passesgo test -race -count=1 -timeout=120s ./...passes, alsobffon thego 1.26.0floorgolangci-lint run ./...(v2.14.0) reports no issuegovulncheck ./...: not run locally (vuln.go.devis blocked here); CI runs it. No dependency change.A line is added under
## [Unreleased]inCHANGELOG.md(### Fixed)Compatibility
PostgresStoreTombstoneTTLnotesMemoryStoreuses it too.Putof a session deleted less than an hour ago is dropped.RandomToken), so only a write-back of the deleted session is affected, which is the bug.🤖 Generated with Claude Code
https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA
Generated by Claude Code