T13.6 (part): test T13.1's sliding session, and record what it found
T13.1 shipped with its done-when list unchecked and no test of its own. Adds tests/session_idle_check.py (28 checks): continuous activity survives 30 minutes but not the ceiling, an idle session gets 401, the cookie is not rewritten per request, a pre-D18 token still gets a ceiling via iat, identity carries forward, both variables are documented. Mutation-tested (no throttle, no ceiling, a fresh ceiling for legacy tokens each fail it). Notes in wave-13.md: /api/auth/* is exempt from the refresh, and the wave exit criteria say AUTH_SESSION_HOURS 2 while T13.1 and the code say 8.
This commit is contained in:
@@ -61,22 +61,40 @@ its own `iat` as `login_at`, not bypass the ceiling entirely.
|
||||
|
||||
**Done when:**
|
||||
|
||||
- [ ] a session with continuous activity stays alive past 30 minutes but is
|
||||
- [x] a session with continuous activity stays alive past 30 minutes but is
|
||||
cut off at the `AUTH_SESSION_HOURS` ceiling regardless
|
||||
- [ ] a session with no activity for 30+ minutes is rejected on its next
|
||||
*(2026-10-16, T13.6: a request every minute for 10 hours: alive well past 30 minutes, never extended past login + 8 h, cut off at the ceiling, original `login_at` kept.)*
|
||||
- [x] a session with no activity for 30+ minutes is rejected on its next
|
||||
request
|
||||
- [ ] the cookie is not rewritten on every single request — verify the
|
||||
*(2026-10-16, T13.6: an idle token gets 401 on a gated route; one inside the window gets 200.)*
|
||||
- [x] the cookie is not rewritten on every single request — verify the
|
||||
refresh is throttled, not unconditional
|
||||
- [ ] a pre-existing token with no `login_at` claim (simulating a session
|
||||
*(2026-10-16, T13.6: 20 rapid requests on a fresh session: 0 rewrites; 480 requests over 8 h: about one rewrite per 10 minutes; a refreshed cookie is not rewritten again on the next request. Mutation test: removing the throttle fails 3 checks.)*
|
||||
- [x] a pre-existing token with no `login_at` claim (simulating a session
|
||||
issued before this shipped) still gets a hard ceiling, via the `iat`
|
||||
fallback
|
||||
- [ ] `.env.example` and `DEPLOYMENT.md` explain both variables and flag both
|
||||
*(2026-10-16, T13.6: a token with iat 9 h ago and a still-valid old exp is not extended; one with iat 1 h ago is refreshed with `login_at` taken from `iat`; no `login_at` and no `iat` is not refreshed and does not crash. Mutation test: giving it a fresh ceiling fails.)*
|
||||
- [x] `.env.example` and `DEPLOYMENT.md` explain both variables and flag both
|
||||
defaults as proposed, not confirmed against Okta's own session policy
|
||||
- [ ] existing session/auth tests updated for the new mechanism, not just a
|
||||
*(2026-10-16, T13.6: both variables are in both files, and both call the defaults proposed.)*
|
||||
- [x] existing session/auth tests updated for the new mechanism, not just a
|
||||
new number
|
||||
*(2026-10-16, T13.6: there were none. T13.1 shipped with no test of its own. `tests/session_idle_check.py` is that test (T13.6 added it).)*
|
||||
|
||||
---
|
||||
|
||||
**Found while writing that test (T13.6, 2026-10-16):**
|
||||
- Nothing under `/api/auth/` slides the session. `auth._EXEMPT_PREFIXES` covers
|
||||
that whole prefix, so `auth_gate` never refreshes there (including
|
||||
`/api/auth/me`). A page that only called `/api/auth/me` would not extend its
|
||||
session. The spec says "after confirming a request is authenticated", and these
|
||||
routes are not confirmed by the gate, so this is as written. Noted, not changed.
|
||||
- The wave's exit criteria below say `AUTH_SESSION_HOURS` defaults to **2**. T13.1
|
||||
(this section), `auth.py`, `.env.example` and `DEPLOYMENT.md` all say **8**. The
|
||||
code and the T13.1 text agree, so the exit line looks like a leftover from
|
||||
before the 2026-09-23 revision. Not changed here: it is a product number. Needs
|
||||
Matt to say which one he means.
|
||||
|
||||
### T13.2 — D18: Okta Management API client
|
||||
|
||||
- **Items:** `D18`
|
||||
|
||||
Reference in New Issue
Block a user