feat(openid-connect): support stateless session revocation - #13651
feat(openid-connect): support stateless session revocation#13651Hockenba wants to merge 3 commits into
Conversation
|
Hello @Hockenba,
Update: This PR depends on bungle/lua-resty-session#208 status https://the-asf.slack.com/archives/CUC5MN17A/p1783014722148709 |
|
Some comments that you can address or state your reasoning on why you think the current approaches should remain:
"session": {
"storage": "cookie",
"redis": { "host": "127.0.0.1" },
"revocation": "redis",
"revocation_fail_mode": "closed"
}
|
You make a lot of great points. It is a little late in my time zone, so I'll refine this tomorrow based on your comments. One thing: the Chinese documentation needs to the created and pushed to this PR by someone who actually knowns Chinese. I do not know a lick of Chinese and I am sure we want better than what Google Translate will spit out for me. |
Thanks for the fast reply. For Chinese translation u can ask your agent to do it on your behalf, it usually does it right the first time if the change is not so complex. If there's any issue then maintainers will give some feedback. |
I wasn't sure how good agents are at English to Chinese translation. Sounds good. Will do. I'll be spending my workday tomorrow refactoring and addressing your comments with either commits or follow up discussion (Eastern Standard Time). So be on the look out for that. Thanks. |
4051f35 to
7e084f2
Compare
Add opt-in Redis-backed revocation for cookie sessions, with schema validation, documentation, and focused coverage.
7e084f2 to
72f7000
Compare
Done. Refactored it quite a bit. Cut out all the unnecessary bloat. Ready for review again. |
|
Thanks for addressing my concerns, however few issues remain:
|
Forward lua-resty-session revocation settings directly and make the fail-open default explicit.
05f98a6 to
4c92d96
Compare
1-4 should be addressed. |
|
Thanks, 1-4 look good and |
Let lua-resty-session apply fail-open behavior only when revocation is enabled, preserving unchanged defaults for other sessions.
2ea49cd to
2548150
Compare
Should be all addressed now. I ran all the openid-connect tests, and they all passed. No idea why the CI tests failed, but none are related to my changes or even the openid-connect plugin. |
There was a problem hiding this comment.
Pull request overview
Adds Redis-backed revocation for stateless OpenID Connect cookie sessions.
Changes:
- Adds revocation schema validation and session option forwarding.
- Upgrades
lua-resty-sessionto 4.2.0-1. - Adds integration tests and bilingual documentation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
apisix/plugins/openid-connect.lua |
Defines revocation configuration. |
apisix-master-0.rockspec |
Upgrades the session dependency. |
t/plugin/openid-connect-revocation.t |
Tests configuration and revocation. |
docs/en/latest/plugins/openid-connect.md |
Documents the feature in English. |
docs/zh/latest/plugins/openid-connect.md |
Documents the feature in Chinese. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| }, | ||
| revocation_fail_mode = { | ||
| type = "string", | ||
| enum = {"open", "closed"}, |
There was a problem hiding this comment.
Not sure if the AI is correct (will verify in the morning), but this may be intentional best-effort logout design—either by the project or something we may want ourselves—so users aren't blocked when Redis is down. The client cookie still clears, and from the UI's perspective, the logout happened successfully. A bug-free UI won't randomly reuse deleted cookies, and this scenario is really aimed at bad actors rather than normal operation.
The replay risk only exists if the session value was stolen and reused. Even then, fail-open or fail-closed doesn't change the fact that we can't revoke it without Redis up—so we have to eat that risk either way. If we fail closed, it doesn't stop the replay attack; it just tells the user their logout failed and leaves them retrying over and over again, which isn't great for UX.
If we prefer stricter failure handling regardless, we can add it now or defer it. Either direction works depending on what makes sense for the project.
There was a problem hiding this comment.
I think the concern is valid, could u address this
Description
Adds opt-in Redis-backed revocation for OpenID Connect cookie sessions.
Setting
session.revocationtoredisenables lua-resty-session's Redis revocation backend.session.revocation_fail_modedefaults toopenand can be set toclosed. Redis-backed session storage remains unchanged, and incompatible or incomplete configurations are rejected.Session options remain a direct pass-through to lua-resty-session. The deprecated
session.cookie.lifetimealias continues to writeabsolute_timeoutto the shared configuration, so its warning is not emitted on every request.This also upgrades
lua-resty-sessionto4.2.0-1and documents the feature in English and Chinese.Which issue(s) this PR fixes:
N/A
Test plan
open, explicitclosed, and omitted revocation configurations.Checklist