Skip to content

feat(*): Revocation store for stateless cookie sessions - #209

Merged
bungle merged 10 commits into
bungle:masterfrom
geico:feat/stateless-session-revocation
Aug 24, 2026
Merged

feat(*): Revocation store for stateless cookie sessions#209
bungle merged 10 commits into
bungle:masterfrom
geico:feat/stateless-session-revocation

Conversation

@Hockenba

@Hockenba Hockenba commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Continues #208 (source branch changed; see comment there).

Summary

Adds optional storage-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 with TTL matching remaining session lifetime (no session payload stored).

Revocation is only available when storage is nil or "cookie". Select a backend explicitly with revocation = "dshm", "file", "memcached", "mysql", "postgres", "redis", or "shm" (custom storage modules and pre-built set/get tables are also supported). Backends use their normal configuration section. Leave revocation unset or set revocation = false to disable.

revocation_fail_mode defaults to "open" (store 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
    • Backends: file, shm, redis, memcached
    • Normal use: open, destroy+revoke, save rotation (no revoke), cookie-only destroy
    • Store: SET/GET, missing key, TTL expiry
    • Configuration: cookie storage with revocation backend, non-cookie storage skip, revocation=false
  • spec/07-revocation-2_spec.lua
    • Backends: mysql, postgres, Redis Sentinel/Cluster, dshm
    • Fail modes: default open, open destroy degrade, closed open reject, closed destroy fail
    • Validation: default revocation_fail_mode, invalid revocation type/value, invalid fail mode
    • Connection failures on SET/GET

Hockenba and others added 10 commits June 26, 2026 15:19
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.

@bungle bungle left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some early comments.

Comment thread README.md
Comment thread README.md
@Hockenba Hockenba changed the title feat(*): Redis-backed revocation for stateless cookie sessions feat(*): Revocation for stateless cookie sessions Aug 11, 2026
@Hockenba Hockenba changed the title feat(*): Revocation for stateless cookie sessions feat(*): Revocation store for stateless cookie sessions Aug 11, 2026
@Hockenba
Hockenba requested a review from bungle August 11, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bungle
bungle merged commit 78b0a07 into bungle:master Aug 24, 2026
2 checks passed
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.

3 participants