[H-2] Issued JWTs can never be revoked — stored token rows never consulted, no suspension surface #6

Closed
opened 2026-11-14 18:28:41 +01:00 by amiryahaya · 1 comment
Owner

Finding

Tokens are persisted with jti/expiry/status 'for tracking and revocation', but verify_access_token/1 never reads the :oauth_access_token record. No route exposes suspend_client (it's dead code), so there is no operational way to kill a token or client without Mnesia surgery.

Evidence

  • lib/mdid_ws/oauth/token.ex:60-103 — verify checks signature, exp, client status only
  • lib/mdid_ws/oauth/token.ex:124-136 — token row written, never read back

Impact

A stolen bearer token remains valid for its full 3600s even after detection; no incident-response capability.

Fix

  • Look up the stored token by jti in verify; reject when missing or status != "active"
  • Add an authenticated admin endpoint for token revocation and client suspension

Line numbers refer to the initial import commit 282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).

## Finding Tokens are persisted with jti/expiry/status 'for tracking and revocation', but `verify_access_token/1` never reads the `:oauth_access_token` record. No route exposes `suspend_client` (it's dead code), so there is no operational way to kill a token or client without Mnesia surgery. ## Evidence - `lib/mdid_ws/oauth/token.ex:60-103` — verify checks signature, exp, client status only - `lib/mdid_ws/oauth/token.ex:124-136` — token row written, never read back ## Impact A stolen bearer token remains valid for its full 3600s even after detection; no incident-response capability. ## Fix - [ ] Look up the stored token by `jti` in verify; reject when missing or `status != "active"` - [ ] Add an authenticated admin endpoint for token revocation and client suspension _Line numbers refer to the initial import commit `282cb11`. Source: comprehensive audit, 2026-11-12 (first review of this codebase)._
Author
Owner

Verified fixed on main (1b6216b): verify_access_token requires an active stored token row by jti; admin endpoints for token revoke and client suspend/reactivate (batch A2).

Verified fixed on main (1b6216b): verify_access_token requires an active stored token row by jti; admin endpoints for token revoke and client suspend/reactivate (batch A2).
Sign in to join this conversation.
No description provided.