Revoking an API key does not invalidate the dashboard sessions minted from it #60

Open
opened 2026-10-26 15:38:26 +00:00 by james.oates · 0 comments
Owner

From the v2.0.0 security audit.

src/session.rs stores only created_at/expires_at per session. There is no link to the key that created it, validate never re-checks the database, and remove() is called only from destroy_session.

So: a key leaks, an attacker POSTs it to /api/session and gets a cookie, the operator revokes the key with DELETE /api/keys/<id>. X-API-Key auth stops immediately — but the attacker's cookie keeps full admin access for up to the 12-hour absolute deadline, sliding on every use. There is no session-list or session-kill API, so the only revocation is restarting the process.

A master-key change does clear sessions, because it only happens at startup and the store is in memory. Revoking a service key does not.

Fix

Record the key id on the session and have validate reject a session whose key is revoked or gone. That is a DB read per authenticated dashboard request, which is consistent with how access rules are already read per request deliberately.

A session-kill endpoint would be the fuller answer but is a feature rather than a fix.

Until it is fixed this is worth a line in the release notes: revoking a key does not end dashboard sessions already established with it; restart ER if that matters.

From the v2.0.0 security audit. `src/session.rs` stores only `created_at`/`expires_at` per session. There is no link to the key that created it, `validate` never re-checks the database, and `remove()` is called only from `destroy_session`. So: a key leaks, an attacker POSTs it to `/api/session` and gets a cookie, the operator revokes the key with `DELETE /api/keys/<id>`. `X-API-Key` auth stops immediately — but the attacker's cookie keeps full admin access for up to the 12-hour absolute deadline, sliding on every use. There is no session-list or session-kill API, so the only revocation is restarting the process. A master-key *change* does clear sessions, because it only happens at startup and the store is in memory. Revoking a service key does not. ## Fix Record the key id on the session and have `validate` reject a session whose key is revoked or gone. That is a DB read per authenticated dashboard request, which is consistent with how access rules are already read per request deliberately. A session-kill endpoint would be the fuller answer but is a feature rather than a fix. Until it is fixed this is worth a line in the release notes: revoking a key does not end dashboard sessions already established with it; restart ER if that matters.
james.oates added this to the v2.1 milestone 2026-10-26 17:53:26 +00:00
Sign in to join this conversation.
No labels
No milestone
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
IsoHex/edge-router#60
No description provided.