feat(auth): uniform 30-min / 1-day (30-day-remember) session lifetimes (BUNYIP-381) #375
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/BUNYIP-381-token-lifetimes"
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?
Summary
Reworks the legacy cookie-session token policy to a single uniform lifetime for all roles, and removes the BUNYIP-137 admin idle cap that was logging admins out after ~30 minutes idle (the real cause of the "Bunyip auth logs me out after a few minutes" report - MAPPS-375's SPA-OIDC-reuse guess was wrong; this supersedes it).
expset inmain.rs, +AuthCookies::access_tokenMax-Age).AuthCookies::refresh_tokenMax-Age + the DB absolute cap, now remember-based instead of role-based).How
rememberthreads from the login handler ->AuthService::login-> the absolute deadline (refresh_absolute_ttl(remember)-> 30d/1d), whichcreate_tokenscarries verbatim across rotation, so the ceiling is absolute (from login), not rolling. Non-login mints (magic-link, 2FA/approval completion, invite acceptance) default to the 1-day cap.refresh_idle_ttl/session_idle_expireddeleted, and the idle-revoke gate removed fromrefresh_tokens.Security tradeoff (operator-directed)
This intentionally removes BUNYIP-137's admin session hardening: admin cookie sessions go from a 30-min-idle / 12h-absolute leash to the same uniform 1-day (30-day remember) refresh as everyone else, with no idle timeout. Deliberate per the operator's decision. Revisit if privileged-session exposure becomes a concern.
The OIDC
/oauth2/tokenpath (per-client TTLs onoidc_clients) is untouched.Known limitation
A 2FA-cleared login does not carry
rememberthrough the 2FA challenge, so 2FA + "remember me" yields the 1-day cap rather than 30 days. Threadingrememberthrough the challenge is a small follow-up if it matters.Testing
just check-containergreen: fmt + clippy-D warnings+cargo test --workspace --all-targets(275 domain / 73 api / 104 web, 0 failed). BUNYIP-137 policy tests updated to the new uniform policy; cookie-property tests updated to 30 min / 1 day.