Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions docs/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6580,8 +6580,17 @@ as before this change:
- a sign-in that runs past the bound, which a slow identity provider or directory can cause, since
their timeouts bound each call and not the whole sign-in;
- more than 32 elevations on one session inside the bound;
- a wall clock that stepped between the elevation and the sign-in, which moves the bound by the
size of the step, in either direction.
- a step of the store's own clock between the elevation and the sign-in, which moves the bound by
the size of the step, in either direction. The store stamps each link and measures the bound on
that one clock (vault BACKLOG #4276). On PostgreSQL and SQL Server it is the database server's,
so a step of an engine host's clock, or skew between engine hosts that share the store, does not
move the bound there. **On SQLite it is the engine host's own clock**, which SQLite reads and on
which every engine shard runs, so on SQLite a step of that host's clock still moves the bound;
- on PostgreSQL and SQL Server, a forward step of the database server's clock larger than the
session reaper's step tolerance (`_SESSION_REAP_STEP_TOLERANCE`, 600 seconds) while a reaper
pass runs. The reaper's step guard reads only the engine's clock, so it cannot see that step, and
the purge then deletes links still inside the bound. The deletion stands after the clock is set
right.

**A retired token authenticates nothing.** No session read, the validator included, consults the
links; only a revoke follows them, at a sign-in's supersession or at a sign-out (below). For the
Expand All @@ -6591,24 +6600,29 @@ it can only end a session, never open or extend one. Whoever held that token bef
could already end the session with `POST /auth/logout`; the link lets them do it for the length of
the bound after the elevation too, through a sign-in whose first credential passes; with MFA
required, the supersession runs when the password-only session is minted, before the second factor,
so a password alone is enough. A wall
clock that stepped forward at the elevation, or back before the sign-in, lengthens that time by the
step; the reaper's clock-step guard covers its own purge, not this. The links are not under the session integrity seal (BACKLOG #2592): a forged link can only direct a
so a password alone is enough. A store
clock that stepped back between the elevation and the sign-in lengthens that time by the step; the
reaper's clock-step guard reads the engine's clock and does not cover this. The reaper deletes a link
only once it is older than the bound plus that guard's step tolerance on the store's clock, so a
forward step of the store's clock smaller than the tolerance cannot delete a link the sign-in would
still follow. The links are not under the session integrity seal (BACKLOG #2592): a forged link can only direct a
revoke, and a revoke needs no key on any backend.

**A sign-out follows the links too, for far less time (BACKLOG #3715).** An elevation in another
tab can re-key the session while a sign-out is in flight, and the sign-out then ends the session
under its new token, in the same transaction as the revoke. `POST /auth/logout` follows links
written up to 5 seconds before its request arrived; the slack covers a link stamped before its
rotation commits, and clocks that differ between engine processes. Its sign-in check proved the
rotation commits. The store measures that window back from its own clock, which stamps the link
too, as the bound plus the time since the request arrived on the engine's monotonic clock, so on
PostgreSQL and SQL Server clocks that differ between engine hosts do not move it. Its sign-in check proved the
token live after the request arrived, so any link from it was written after that proof, and the
route gains no reach. `/ui/logout` carries no credential, so it follows links written up to 5
seconds before the call. **That is a separate power, credential-free and end-only:** for 5 seconds
after an elevation, anyone who presents the RETIRED token to `/ui/logout` ends the session it
became, with no sign-in. It cannot open or extend a session. At least these cases stay open, and
the session lives on under its new token: an elevation older than the bound, more than 32
elevations in a row inside it, and a wall clock that stepped between the elevation and the
sign-out, which moves the bound by the step. The `auth.logout` row names the
elevations in a row inside it, and a step of the store's own clock between the elevation and the
sign-out, which moves the bound by the step; on SQLite that clock is the engine host's. The `auth.logout` row names the
session's owner as actor, its `outcome` is `revoked`, and a `presented` field holds the hash that
was presented. The `outcome` is `lapsed` instead when the session's own clock checks fail at the
revoke, or when the session passes them but the owner's admin-issued temporary credential is past
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,26 @@ proves nothing and measures it from the call, so a retired token gains a SECOND
one under Consequences: for 5 seconds after an elevation, presented to `/ui/logout` with no
credential, it ends the session it became. It still cannot open or extend one. `docs/SECURITY.md`
states both powers. `revoke_own_session` still follows no link.

## Amendment B (2026-11-24): the store's own clock stamps and measures the window

Vault BACKLOG #4276, ASVS 7.2.4 arm (ii). Under Decision 3 and the stated limits above, the link was
stamped with the elevating process's `time.time()` and the window measured from the signing-in
process's, so a forward step of the signing-in process's clock, or a sign-in host whose clock ran
ahead of the elevating one, dropped a link inside the real window. Now every backend stamps
`retired_at` from the database's own clock in the link's INSERT, and the walk's lineage read and
the reaper's purge measure the window back from that same clock: SQLite's `julianday('now')`,
Postgres `statement_timestamp()`, SQL Server `SYSUTCDATETIME()`. Decision 3's bound is now a
length, `lineage_seconds`, not an instant, `lineage_since`, and `rotate_session` takes no `now`.
The sign-out asks for its 5 seconds plus the time since its proof, on the engine's monotonic clock.
Each store adds back, on the monotonic clock, the time its own call spent waiting before a lookup,
so no lock, connection or row wait shortens the window. The reaper asks the purge for the window
plus its step tolerance, so a forward step of the store's clock under that tolerance cannot delete
a link the supersession would still follow.

What this closes: on PostgreSQL and SQL Server, a step of an engine host's clock, and skew between
engine hosts sharing one store, no longer move the window. What stays: a step of the store's own
clock between the elevation and the sign-in still moves it by the step. On SQLite that clock is the
engine host's own, since SQLite reads the host clock and every engine shard runs on the host that
holds the file, so on SQLite this change leaves a real host clock step where it was.
`docs/SECURITY.md` states both.
Loading
Loading