You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jwt-auth: walk same-named cookies and prefer a live one
lws_jwt_auth_create() took only the first cookie of the configured name.
Browsers legitimately present several same-named cookies at once (host-only
alongside Domain=, or a leftover minted under an earlier cookie-domain
config), ordered oldest-first per RFC 6265, so a stale first cookie shadowed
a live one behind it. Since every renewal and login re-mints the *other*
scope, the user was stuck "Not logged in" until the stale cookie aged out,
which is what an Android tablet showed against a server whose lws-login
cookie config had recently changed. The auth server already resolved its
auth_refresh_session this way; the JWT side now does too.
Walk every occurrence (occurrence 0 via the prefix-aware lookup so the
__Host- / __Secure- aliases still work) and return the first that verifies
and is unexpired. If none is live, return the first that verified, so
callers keep deciding what an expired token means exactly as before; NULL
only when nothing verified. An oversized occurrence is skipped rather than
ending the search.
Stop such stale duplicates outliving their token: lws-login minted its
renewed auth_session with Max-Age jwt-validity-secs (24h default) although
the JWT inside expires on the auth server's schedule, so a dead cookie could
sit in the jar a day after it stopped verifying. Cap every auth_session
this plugin mints at the token's own remaining exp; unverifiable or exp-less
tokens fall back to jwt-validity-secs as before.
The status probe diagnostic no longer claims only #0 is consulted.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
0 commit comments