Skip to content

feat(*): Redis-backed revocation for stateless cookie sessions#208

Open
Hockenba wants to merge 8 commits into
bungle:masterfrom
geico:master
Open

feat(*): Redis-backed revocation for stateless cookie sessions#208
Hockenba wants to merge 8 commits into
bungle:masterfrom
geico:master

Conversation

@Hockenba

@Hockenba Hockenba commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Adds optional Redis-backed session revocation for stateless (cookie) sessions.

  • On session:open, check whether the session ID is in the denylist.
  • On session:destroy, write a lightweight sentinel to Redis with TTL matching remaining session lifetime (no session payload in Redis).

Revocation loads when storage is nil or "cookie" and Redis is configured for revocation (redis.mode = "revocation", or omitted mode with a redis.host). It can also be enabled explicitly via revocation = true or disabled with revocation = false.

revocation_fail_mode defaults 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-audience logout. It does not apply to session:save rotation 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.lua
  • spec/06-revocation-1_spec.lua
    • Normal use: open, destroy+revoke, save rotation (no revoke), cookie-only destroy
    • Redis store: SET/GET, missing key, TTL expiry
    • Configuration: explicit/implicit redis.mode, redis storage skip, revocation=false, no host
  • spec/07-revocation-2_spec.lua
    • Fail modes: default open, open destroy degrade, closed open reject, closed destroy fail
    • Validation: default revocation_fail_mode, redis+revocation mode reject, invalid revocation type
    • Redis connection failures on SET/GET

Hockenba and others added 2 commits July 2, 2026 21:42
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant