feat(*): Redis-backed revocation for stateless cookie sessions#208
Open
Hockenba wants to merge 8 commits into
Open
feat(*): Redis-backed revocation for stateless cookie sessions#208Hockenba wants to merge 8 commits into
Hockenba wants to merge 8 commits into
Conversation
8 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>
Reorder happy-path tests first, dedupe overlap, and group fail-mode coverage.
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
Adds optional Redis-backed session revocation for stateless (cookie) sessions.
session:open, check whether the session ID is in the denylist.session:destroy, write a lightweight sentinel to Redis with TTL matching remaining session lifetime (no session payload in Redis).Revocation loads when
storageisnilor"cookie"and Redis is configured for revocation (redis.mode = "revocation", or omitted mode with aredis.host). It can also be enabled explicitly viarevocation = trueor disabled withrevocation = false.revocation_fail_modedefaults to"open"(Redis unreachable → treat as not revoked; destroy still clears the cookie)."closed"rejects open/destroy when the store is unavailable.Revocation applies to full
destroy/ single-audiencelogout. It does not apply tosession:saverotation or partial multi-audience logout.Consumer: apache/apisix#13651.
Test plan
make unit/busted spec/06-revocation-1_spec.lua spec/07-revocation-2_spec.luaspec/06-revocation-1_spec.luaredis.mode, redis storage skip,revocation=false, no hostspec/07-revocation-2_spec.luarevocation_fail_mode, redis+revocation mode reject, invalid revocation type