Authentication is a server-held session (ADR-0575/0576/0577) #920
No reviewers
Labels
No labels
bug
campaign-editor-ui
dependencies
design
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
javascript
question
queue
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/chess-tactics!920
Loading…
Reference in a new issue
No description provided.
Delete branch "auth-session-hardening"
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?
Presenting symptom: sessions died on the hour. That turned out to be one of ten findings, recorded
in full in
docs/auth-security-audit.mdand measured againstRFC 9700 and the BFF pattern in
draft-ietf-oauth-browser-based-apps-26 §6.1.
The hourly sign-out (F1). The authorization request omitted
offline_access, so the providernever returned a refresh token and the refresh path had never once executed in production.
Confirmed against the provider database: 73 of 73 tokens ever issued to this client carry scopes
openid profile email.The reboot was a red herring (F2). The backend held no session state, so a restart had nothing
to lose. The session owner settled once and never re-read, so the shell presented a signed-in
account over a session that had ended — and a restart forces a reload, which was the only thing
that ever re-asked.
The structure underneath (F3). The access and refresh tokens were the browser's cookies,
which is the inverse of what a BFF does. That one choice produced nothing to revoke, no identity
to cache so every request called the identity provider, a session lifetime that was a cookie's
Max-Age, and a pending sign-in in a processMap.What changed
auth_sessionsandauth_login_attempts. Only the SHA-256 of a session tokenis stored. Claims are cached on the row, so an ordinary authenticated request is one local read.
authenticated_atis what the8-hour admin window reads. Re-authenticating re-arms the row in place — minting a new one would
reset the absolute clock every 8 hours and the cap would never fire.
offline_access, server-side refresh. A refresh refused 4xx ends thesession; a 5xx is an outage and changes nothing.
SameSite=Strictis the named CSRF defence; the login-state cookie staysLaxdeliberately..tank.dev.romaine.lifesession bypass is deleted (F7).insufficient_user_authenticationso the browser can tell a step-up from a sign-out.Testing
The smoke tests authenticated by handing the backend a cookie containing a token, so the sign-in
path — state binding, PKCE, nonce, one-shot code exchange — was never exercised outside unit tests.
Both now complete the real flow against a mock provider that runs it. The DB-free netplay lane gets
an in-memory store gated on
NODE_ENV=testand an explicit opt-in, matching the existingDB-free lobby seam.
Verified locally:
frontend/npm run checkgreen (365 files, 3487 tests), backend auth suites 23/23,netplay-smoke-test.jsgreen.smoke-test.jsneeds Postgres and runs here in CI — it matters thistime, because this change carries a schema migration and rewrites how every DB-backed endpoint
authenticates.
Not in this PR
Stage 3, the identity provider migration for F5 and F11, is in
romaine-life/authonoauth-provider-migration. Its dependency groundwork is landed and verified; the plugin swap isdesigned and not written, because it cannot complete a single real login from a machine with no
Postgres, and it lands on the service that gates Grafana and Argo CD. Details in
docs/auth-security-audit.md§6.Every existing session is invalidated on deploy, and sign-in stays broken until migration 77
rolls out.