feat: real, admin-configurable session timeout + cookie hardening (B4)#64
Merged
Conversation
The client-side timeout warning modal now counts down against the effective server-resolved timeout instead of a hardcoded 15 minutes, so it never advertises a window longer than the server enforces. inject_common_vars now exposes session_timeout_seconds (deferred import of _resolve_session_timeout to avoid a circular import), and the modal JS reads it with a default(900) guard. Also wires the /setup timeout help note to its select via aria-describedby.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the console session timeout real and admin-configurable, and hardens session cookies (internal ref J6 / B4). Verified against the smoke harness.
B4 — the 15-minute timeout was never enforced
permanent_session_lifetimewas set butsession.permanentwas never set, so Flask never applied the lifetime — the sliding-window heartbeat pushed against a limit that didn't govern, and the timeout-warning modal advertised a window the server didn't enforce.session.permanent = Trueon login success so the lifetime actually governs.before_requestnow resolves the configured timeout each request and applies it (change takes effect with no restart).Secure,HttpOnly,SameSite=Lax.New — admin-configurable timeout
Setup now offers a session-timeout dropdown: 15 minutes (default) / 1 hour / 4 hours / 8 hours, stored in
server.json. This addresses reports of getting logged out mid-workflow-testing (lining up devices, enrolling, monitoring Jamf takes time) without weakening the default.server.jsonresolves to 15 minutes — never longer. A hand-edited/corrupt config can never open a longer window or crash the console.Modal accuracy
The timeout-warning modal now counts down against the effective configured timeout (server-injected), so it never advertises a window the server doesn't enforce.
Tests
New
tests/test_session.py: ladder resolution + fail-safe (incl. bools/floats/non-dict config), enforcement, cookie flags,/setupround-trip + off-ladder clamp, and the modal's injected value. Full suite green (78 passed, 2 xfailed), ruff clean.Notes
developfor the batched v3.2 release.