moonming commented on PR #14242:
URL: https://github.com/apache/apisix/pull/14242#issuecomment-7060356623

   Thanks for moving the logout and session changes upstream. **Before merging 
this PR, could you fix partial-write recovery in [lua-resty-session 
#217](https://github.com/bungle/lua-resty-session/pull/217) and add a 
regression test for a second HTTP logout request?**
   
   In the current candidate, `destroy()` writes the presented cookie's SID 
marker before it writes the login's lineage marker. If the first write succeeds 
and the second fails in `closed` mode, the client gets a 503 and keeps its 
cookie. On retry, even after Redis recovers, `open()` sees the persisted SID 
marker and returns `"session revoked"` before it loads the lineage. OpenIDC 
only calls `destroy()` for an open session, so the retry can finish without 
writing the missing marker. A sibling cookie issued by an earlier refresh can 
remain valid. This follows from the [write 
order](https://github.com/bungle/lua-resty-session/blob/aebf8cfdf1089d5a20e520a3e3f3ae5bf5ed8f12/lib/resty/session.lua#L1619-L1627),
 the [SID check on 
open](https://github.com/bungle/lua-resty-session/blob/aebf8cfdf1089d5a20e520a3e3f3ae5bf5ed8f12/lib/resty/session.lua#L1014-L1020),
 and [OpenIDC's destroy 
guard](https://github.com/zmartzone/lua-resty-openidc/blob/8538372972dcbb87c1defe67f694312f6c221cdf/lib/resty/op
 enidc.lua#L296-L330).
   
   Please extend the upstream test that currently stops at the first write 
error, and cover the browser-visible retry through APISIX with real Keycloak 
and Redis:
   
   1. Log in, refresh the session, and retain two distinct, still-valid cookies 
from that login. Verify both reach the protected route before logout.
   2. Exercise the partial write in `closed` mode. Verify the SID marker was 
persisted, the lineage marker was not, and the first logout returns 503 without 
clearing the browser cookie.
   3. Restore writes and issue a **new HTTP logout request with the same 
cookie**. Verify logout completes and both cookies now redirect to 
authentication while they would otherwise still be valid. Checking only the 
retry's 302 would miss the bug.
   
   For this PR, please also pin mutually compatible releases containing both 
upstream fixes. The [current CI 
job](https://github.com/apache/apisix/actions/runs/44822431112/job/136688945719)
 installed session 4.3.0, then replaced it with 4.2.0 to satisfy OpenIDC 1.9.3. 
Both cookie replays returned 200 on the initial run and on retry. Finally, 
please qualify the English and Chinese docs: cookies issued before lineage IDs 
existed only support per-SID revocation, and checking Redis on every request 
requires setting **both** lookup and error cache TTLs to zero.
   


-- 
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