Revoking an API key does not invalidate the dashboard sessions minted from it #60
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From the v2.0.0 security audit.
src/session.rsstores onlycreated_at/expires_atper session. There is no link to the key that created it,validatenever re-checks the database, andremove()is called only fromdestroy_session.So: a key leaks, an attacker POSTs it to
/api/sessionand gets a cookie, the operator revokes the key withDELETE /api/keys/<id>.X-API-Keyauth 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
validatereject 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.