fix(oidc): honor checked= flag on /login to break authorize redirect loop #74
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/oidc-login-redirect-loop-honor-checked"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Returning users hit an infinite redirect loop on RP (e.g. Mokosh) login:
/oauth2/authorize(bunyip-api) and/login(bunyip-web) bounce forever until the browser aborts withNS_ERROR_REDIRECT_LOOP.bunyip has two independent "signed in" checks. bunyip-web's
is_signed_in()succeeds whenever/v1/users/meworks with the hubaccess_token, auto-refreshed from the 30-day "remember me"refresh_tokencookie. bunyip-api'sauthorizegates only on a server-sideop_sessionsrow, which hard-expires after 7 days with no sliding renewal. Once the OP session expires (or is cleared by a logout-elsewhere or an api redeploy) while the hub refresh cookie is still valid, the two checks disagree:authorize302s to/login?...&checked=1,login_getsees the hub session and 303s back toauthorize, repeat.authorizealready appends&checked=1as the intended loop-breaker, butRedirectQuerynever deserializedchecked, so it was silently dropped.Fix
Add
checked: Option<String>toRedirectQueryand guard the signed-in shortcut inlogin_getwithq.checked.is_none(). Whencheckedis present the IdP has already proven there is no OP session, sologin_getrenders the login form instead of redirecting back. The form carries the original?redirect=(the authorize URL), so the POST mints a fresh OP session viaestablish_op_sessionand the authorize round-trip then completes. Behavior withoutcheckedis unchanged.Testing
cargo fmt --checkandcargo clippy --workspace --all-targets -D warningsclean in the pinned rust-builder image.cargo test -p bunyip-web --bins: 12/12 pass (including thesafe_redirectsuite in the touched file).config::tests::test_config_defaults, is a pre-existing in-suite env leak (the test never removesAPP_PORT/PORT) in a crate this PR does not touch.Fixes #BUNYIP-56
🤖 Generated with Claude Code