fix(auth): end a cookie session whose roles drop to zero on refresh (#144)

The mid-session refresh ended a session only when the directory returned no
groups (or the user was gone/disabled/ambiguous). A user still in some groups
but in no mapped one, or whose DB mappings were all revoked, kept a signed-in,
role-less session that could read the bare-[Authorize] pages. CookieSessionValidator
now rejects when the re-map yields zero roles, on ordinary and fail-closed paths.
A mapper fault keeps its existing policy (keep grants; fail closed when asked).

Docs: Component-Security "No role, no login" (incl. the HTTP Basic gap left as a
follow-up), Component-CentralUI, CLAUDE.md.

Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
This commit is contained in:
Joseph Doherty
2026-11-17 11:21:00 -05:00
parent 5a642d1cdf
commit 2d8d5a3d6f
7 changed files with 119 additions and 14 deletions
+1
View File
@@ -25,6 +25,7 @@ Central cluster only. Sites have no user interface.
## Review hardening (2026-09-09)
- Cookie login validates an antiforgery token before reading credentials or calling LDAP; the login form supplies the token. The JSON token endpoint retains its non-cookie client contract.
- Cookie login and the token endpoint refuse a bind whose groups map to no role, or whose role mapping fails, exactly as for a bad password (ScadaBridge#144; see `Component-Security.md` *No role, no login*). This is what makes the two bare-`[Authorize]` pages (`/`, `/monitoring/health`) safe.
- Manual failover goes through a scoped `AuthorizedManualFailoverService` that refreshes the circuit's Administrator grant before calling the host singleton. The component's visibility policy is an additional presentation guard.
- Flow Debugger method-entry Live runs are unavailable to a site-scoped Deployer (Gitea #55): the *Inbound API method* entry is disabled with the reason as a tooltip and an inline note, the page starts on script entry, a `?methodId=` drill-in or a stored method choice is ignored, and the server refuses the command regardless. Script entry on a permitted instance and Replay stay available.
- Flow Debugger retry/discard validates the current Deployer grant and resolves site scope inside its service. Scoped callers cannot relay an unknown site. Refresh merges preserve Replay's event ordering and append only rows known exclusively to the live run.