feat(*): Redis-backed revocation for stateless cookie sessions - #208
feat(*): Redis-backed revocation for stateless cookie sessions#208Hockenba wants to merge 8 commits into
Conversation
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.
|
Great idea! |
|
@Hockenba, I am wondering if this could be generic and work with all the storage backends. Not just Redis? And then you don't need to implement a revocation "interface" as it just seems to be using already defined storage ones. |
Agreed — we can probably make this generic so it works for all databases. I originally scoped it to Redis (with the rest as a TODO) since that’s all the APISIX plugin uses, but covering the others in this PR likely won’t take much extra work. I’ll look into it and follow up. |
|
@bungle Closing this PR in favor of #209. I am switching the source branch from geico:master to geico:feat/stateless-session-revocation. Our organization applies policies to master that make it impractical to keep long-lived feature work on that branch, so the remaining review and merge should happen from the feature branch instead. Please continue review on the new PR. Title and description are unchanged aside from the link back to this thread. |
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