Repository navigation
Description
What happened
An Audiobookshelf-compatible token issued while the account is being signed out everywhere can survive the sign-out. Signing an account out everywhere (a password reset, an admin setting the password, an admin's Sign out everywhere, disabling the account) revokes its rows in abs_sessions with one UPDATE ... WHERE user_id = ... AND revoked_at IS NULL. The Audiobookshelf handlers write new rows to that table in separate statements, outside any lock the revocation takes:
- Refresh (
internal/audiobooks/abs/login.go,handleRefresh):RevokeTokenIfActiverevokes the old refresh token in one statement, then twoInsertTokencalls add the new access and refresh tokens. A revocation that commits between the first statement and the inserts sees the old row already revoked and doesn't see the new rows yet, so the new pair stays valid. - Sign-in (
handleStandaloneLogin): the credential check (SiloCredValidator.Validate→CompatLoginWithLocalFallback) finishes before the token rows are inserted. A password change or reset that commits in between leaves tokens minted from the old password. /authorize: mints and inserts a new access token after the request's existing token was checked.
Audiobookshelf authentication checks only the token's own row, not any login session or the account's password, so a surviving row keeps that client signed in until it expires (30 days for a refresh token by default).
Native sign-in doesn't have this gap: loginWithProvider locks the users row, rechecks the password hash, and inserts the login session in one transaction.
Steps to reproduce
Not reproduced live; the window is a few milliseconds. From the source:
- Sign an Audiobookshelf-compatible client in to an account.
- Have the client call
POST /auth/refreshwhile an admin resets the account's password, timed so the reset's transaction commits afterRevokeTokenIfActiveand before theInsertTokencalls. - The client's new access and refresh tokens still work after the reset.
Expected behavior
Once a sign-out-everywhere commits, no Audiobookshelf token minted before or during it works. Rotation and sign-in should either finish before the revocation (and be revoked by it) or fail.
Silo version / commit
main at d00462089
Deployment
Local dev build
Area
Accounts, profiles, and sign-in
Clients affected
- Other/not client-specific (Audiobookshelf-compatible apps)
Relevant logs
No logs available; found by reading the source.
Technical notes
Revocation already serializes on the users row: the password update and RevokeAsAdmin hold it until commit. One repair is to issue Audiobookshelf tokens the way native sign-in issues sessions: in one transaction that locks the account row (FOR SHARE is enough), rechecks what the credential depended on (the token being rotated is still live; for sign-in, the password hash the check used), and inserts both rows. A DB test that interleaves rotation with RevokeSignInsInTransaction would cover it.
Audiobookshelf compatibility is a beta feature. The open PR #2793 also changes internal/audiobooks/abs/login.go.
AI harness
Claude Code (via T3 Code)
AI tool(s)
Claude Code, GitHub CLI
AI model(s)
claude-opus-5-5, gpt-6.1-sol
AI involvement
AI-assisted
Independent or adversarial review
Found by an adversarial plan review (gpt-6.1-sol) and confirmed against the source by claude-opus-5-5: the statement order in handleRefresh and handleStandaloneLogin, the single-statement revocation in revokeAudiobookshelfSessionsInTransaction, and the locked recheck in native loginWithProvider for comparison. No live reproduction.
Confirmations
- I searched open and recently closed issues and pull requests, and this is not already reported
- I reproduced this myself on a real deployment
- Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above
Source: found while planning #2898.
Activity
Quick104 commentedon Oct 22, 2026
🤖 AI agent claim. Claude Code via T3 Code (claude-opus-5-5) is working on a fix for this issue on behalf of @Quick104, who is assigned.
A pull request will link here when the fix is ready. If the work stops without a fix, the assignment and this comment are removed.
Planning to work on this, or have context to add? Reply here and mention @Quick104.
fix(audiobooks): refuse Audiobookshelf tokens minted during a sign-ou…
fix(audiobooks): refuse Audiobookshelf tokens minted during a sign-ou…