Hockenba opened a new pull request, #14242:
URL: https://github.com/apache/apisix/pull/14242

   > This continues #13651. That PR's branch is in `geico/apisix`, which has 
been
   > made read-only, and I don't control it, so I can't push to it any more.
   > The same work now lives in my account, in this PR. Please review it here.
   > All review comments on #13651 are addressed below.
   
   ### Description
   
   Adds opt-in Redis-backed revocation for OpenID Connect cookie sessions. Today
   `/logout` only clears the browser cookie, so a copied cookie stays valid 
until it
   times out. With revocation on, logout marks the whole login revoked in Redis 
and
   later requests with any cookie of that login are rejected.
   
   - `session.revocation` (`"redis"`) turns it on. It reuses `session.redis` and
     needs `session.storage` to be `cookie`. Other combinations are rejected.
   - `session.revocation_fail_mode` is `open` or `closed`. It has no schema 
default;
     the documented default is `open`. In `closed` mode a store error during a
     request or logout returns 503 and keeps the cookie, so the logout can be 
retried.
   - `session.revocation_cache_ttl` and `session.revocation_error_cache_ttl`
     (default `5` seconds) control a per-worker cache, so there is no Redis 
lookup on
     every request. Cache sizes are set with the nginx variables
     `$session_revocation_cache_size` and 
`$session_revocation_error_cache_size`.
   - Logout revokes the cookie sent by the client and every other cookie of the 
same
     login, including ones rotated by a refresh.
   - Session options stay a pass-through to lua-resty-session.
   - Docs in English and Chinese, with a usage example and limitations: 
propagation
     delay is bounded by the cache TTL, a logout during a Redis outage in 
`open` mode
     is not recorded (use `closed`), and the marks live only in Redis.
   - `lua-resty-session` pin raised to `4.3.0-1`.
   
   Back-channel and front-channel logout are not part of this change.
   
   **Depends on unreleased library changes.** CI will fail on the revocation 
tests
   until these are released and the rockspec pins are moved:
   - lua-resty-session: lineage revocation and the cache-size variables (PR 
link)
   - lua-resty-openidc: the logout path opens the session instead of refreshing 
it
     (PR link). The closed-mode error propagation it builds on is already 
released (#571).
   
   #### Which issue(s) this PR fixes:
   
   N/A
   
   ### Test plan
   
   - `t/plugin/openid-connect-revocation.t` uses real Keycloak and Redis: schema
     cases; login, logout and replay of the old cookie (302); logout after a 
rolling
     refresh; fail-open and fail-closed behavior when Redis is down; 
per-fail-mode
     cache isolation.
   - All 20 `t/plugin/openid-connect*.t` files pass locally.
   - Also checked by hand against real APISIX, Keycloak and Redis: 98 checks.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to