feat(*): Redis-backed revocation for stateless cookie sessions#208
Open
Hockenba wants to merge 7 commits into
Open
feat(*): Redis-backed revocation for stateless cookie sessions#208Hockenba wants to merge 7 commits into
Hockenba wants to merge 7 commits into
Conversation
5 tasks
Drop redundant open tests and post-open revocation mutation; exercise revocation via redis.mode and real Redis integration where possible. Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
This PR adds optional Redis-backed session revocation store for stateless (cookie) sessions. On session:open, the library checks whether the session ID has been revoked. On session:destroy, it writes a lightweight sentinel to Redis with a TTL matching the session’s remaining lifetime—no session payload is stored.
Revocation is opt-in via revocation and revocation_fail_mode. It only applies when storage is nil or "cookie". The default fail mode is "open" (if Redis is unreachable, sessions are treated as valid and destroy still clears the cookie); "closed" rejects open/destroy when the store is unavailable.
Revocation applies to full destroy/logout, but not to session rotation on session:save or partial multi-audience logout—those cookies remain valid until their normal timeout or stale_ttl expires.
Test plan
spec/06-revocation-1_spec.luaspec/07-revocation-2_spec.lua