Skip to content

fix(coderd): allow user-admin password resets to succeed#26537

Open
geokat wants to merge 1 commit into
mainfrom
george/plat-316-user-admin-cannot-reset-another-users-password
Open

fix(coderd): allow user-admin password resets to succeed#26537
geokat wants to merge 1 commit into
mainfrom
george/plat-316-user-admin-cannot-reset-another-users-password

Conversation

@geokat

@geokat geokat commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Problem

Resetting a password revokes all of the target user's API keys via DeleteAPIKeysByUserID, whose dbauthz check requires api_key:delete on those keys. The user-admin role has full access to ResourceUser but no permissions on ResourceApiKey, so the revocation failed authorization inside the transaction and surfaced as a 500. Owners worked only because they hold wildcard permissions.

Fix

Add a narrowly-scoped AsAPIKeyRevoker dbauthz actor that can delete only the API keys owned by a specific user, and nothing else. Use it for the key revocation in both the admin password-reset path (putUserPassword) and the one-time-passcode reset path, which previously leaned on the much broader AsSystemRestricted.

Refs: https://linear.app/codercom/issue/PLAT-316

User Admin password resets could update the target user's hashed
password but fail while revoking that user's API keys. The transaction
then rolled back and returned HTTP 500, so the password was never
changed.

Add a user-scoped API key revoker actor and use it in both password
reset flows so key revocation succeeds without broader system auth.

Refs: https://linear.app/codercom/issue/PLAT-316
@linear-code

linear-code Bot commented Jun 19, 2026

Copy link
Copy Markdown

PLAT-316

@geokat geokat marked this pull request as ready for review June 19, 2026 00:46
@geokat geokat requested a review from Emyrk as a code owner June 19, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant