feat(02-12.1): refuse a record request whose context has moved

- both record resolvers check the fence after authentication and before
  the carrier, off the one session row that also decides the scope
- POST /api/account/switch takes an optional expectedEpoch and writes
  conditionally, so concurrent switchers resolve to one outcome
- GET /api/auth/me publishes the context a browser bootstraps from
- every response that resolved a record scope echoes it back
- regenerate the API contract
This commit is contained in:
Marc-André Bombeck committed 2026-08-06 18:21:40 +02:00
1 parent 59359738c8
commit 45fec0fc1b
15 files changed
+1631 -98

No files matched your search

+15
View File
@@ -210,6 +210,21 @@ export interface AuthUser {
* server-side switch cannot paint owner controls in the target record.
*/
accountAccessStatus?: AccountAccessStatus;
/**
* v1.37.0 — the record-session context the server says this browser is in.
*
* `epoch` counts how many times this session's record selector has moved and
* `scope` names the record it is pointed at (null for one's own). Adopted by
* `fetchMe` and then attached to every same-origin request, so a request
* formed under a context that has since moved is refused rather than served
* against the wrong record.
*
* Null on the Bearer transport, which carries no such state. Optional so
* existing `AuthUser` fixtures stay valid; an absent field is an older server
* image and leaves the client unadopted, which the `bootstrap` sentinel makes
* safe.
*/
recordSession?: { epoch: number; scope: string | null } | null;
}
/**