Rotating One API Key Revokes Every Key for the User
Level 2 · node · Security · Credential revocation scope error
Scenario
A partner API allows each user to keep multiple API keys for separate automation tools. Rotating one key should revoke only that credential and issue a replacement. The current rotation service calls a user-scoped revocation function, so every other active key owned by the same user is revoked and unrelated integrations stop working.
Requirements
- Revoke only the API key being rotated - Keep the same user’s other active keys valid - Do not affect keys owned by other users - Do not rotate a missing or already revoked key - A successful rotation issues a new active key for the same user
Acceptance criteria
- Only the target key gets revokedAt set
- Sibling keys for the same user remain active
- Keys for other users remain unchanged
- An invalid target does not create a new key
- The replacement key has the same userId as the target