A token refresh whose response is lost signs the user out: the rotated refresh token is revoked and the browser never gets its replacement #451

Open
opened 2026-11-14 03:29:15 -05:00 by claude · 0 comments
Owner

Found with the admin console smoke harness (#430), in a run where the machine's network addresses changed and Chromium aborted requests in flight.

What happens

POST /api/auth/refresh rotates the refresh token: it issues a replacement (as the HttpOnly cookie) and revokes the one that was sent. When the response does not reach the browser (the connection drops after the server has processed the request: a network change, a proxy timeout, a laptop that changes Wi-Fi), the browser still holds the revoked token. Every later refresh answers 401 and the console session is over; the user has to sign in again. In the harness run, one aborted refresh (net::ERR_NETWORK_CHANGED /api/auth/refresh) was followed by 401 /api/auth/refresh on every later visit of that user.

Why it needs a decision

Rotation with immediate revocation is the strict choice and it detects a stolen token that is replayed. The usual way to survive a lost response is a short reuse window: the revoked token is accepted once more for a few seconds and answers with the replacement that was already issued (not a second new one), so a replay outside the window still fails and still can be treated as theft. That is a security trade-off, so it wants a design note first.

Wanted

  • Confirm the behaviour with a test (refresh, drop the response, refresh again with the old token).
  • An architect's note: keep strict rotation and document it, or add a bounded reuse window (length, whether it is a setting, what a reuse outside the window does to the token family, cluster nodes that have not seen the rotation yet, the two-tabs case the console already retries once for).
  • Then the change, README (sessions and tokens) and the wiki REST API and troubleshooting pages.
Found with the admin console smoke harness (#430), in a run where the machine's network addresses changed and Chromium aborted requests in flight. **What happens** `POST /api/auth/refresh` rotates the refresh token: it issues a replacement (as the HttpOnly cookie) and revokes the one that was sent. When the response does not reach the browser (the connection drops after the server has processed the request: a network change, a proxy timeout, a laptop that changes Wi-Fi), the browser still holds the revoked token. Every later refresh answers 401 and the console session is over; the user has to sign in again. In the harness run, one aborted refresh (`net::ERR_NETWORK_CHANGED /api/auth/refresh`) was followed by `401 /api/auth/refresh` on every later visit of that user. **Why it needs a decision** Rotation with immediate revocation is the strict choice and it detects a stolen token that is replayed. The usual way to survive a lost response is a short reuse window: the revoked token is accepted once more for a few seconds and answers with the replacement that was already issued (not a second new one), so a replay outside the window still fails and still can be treated as theft. That is a security trade-off, so it wants a design note first. **Wanted** - Confirm the behaviour with a test (refresh, drop the response, refresh again with the old token). - An architect's note: keep strict rotation and document it, or add a bounded reuse window (length, whether it is a setting, what a reuse outside the window does to the token family, cluster nodes that have not seen the rotation yet, the two-tabs case the console already retries once for). - Then the change, README (sessions and tokens) and the wiki REST API and troubleshooting pages.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil#451
No description provided.