Skip to content

Only let a signed-in person revoke keys - #2103

Merged
ericmj merged 2 commits into
mainfrom
keys-permission-label
Nov 4, 2026
Merged

ericmj merged 2 commits into
mainfrom
keys-permission-label

Conversation

@ericmj

@ericmj ericmj commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

A leaked key with keys or api:write could revoke every other key of its account or organization with DELETE /api/keys. Keys can't create keys since #2055, and now they can't revoke them either, so only a signed-in person manages keys, on the dashboard or with the mix hex.user auth session.

DELETE /api/keys, DELETE /api/keys/:name and the organization routes answer 403 to a key or a token exchanged for one, before the organization is looked up, the same as key creation. Keys can't hold the keys permission any more: the key form doesn't offer it, write members asking for api:write get api:read and publish, and creating a key with it fails validation. Keys that already hold it keep it, and it no longer lets them do anything. The keys OAuth scope keeps working for signed-in users. /docs/keys and /docs/publish say keys can't create or revoke keys.

Hex's Hex.APITest "keys" test revoked keys with a key on main, v2.5 and v2.4, which this CI runs. hexpm/hex#1304 changes it on main, and the same commit is on v2.5 and v2.4, so this CI passes once #1304 merges.

A key can't create other keys since #2055, but the Generate New Key form
still described the Keys permission as creating keys with a subset of the
key's permissions.

The test that read-only organization members can't revoke keys matched any
"Revoke key" text on the page, which the new description contains, so it
now looks for the revoke button's aria-label.
A key, or a token exchanged for one, can no longer revoke keys, the same
way it can't create them since #2055. A leaked key with keys or api:write
could revoke every other key of its account or organization.

Keys can't hold the keys permission any more: the key form doesn't offer
it, write members asking for api:write get api:read and publish, and
creating a key with it fails validation. The keys OAuth scope keeps
working for signed-in users.
@ericmj ericmj changed the title Describe the Keys permission as revoking keys Only let a signed-in person revoke keys Nov 4, 2026
ericmj added a commit to hexpm/hex that referenced this pull request Nov 4, 2026
hexpm is refusing keys, and tokens exchanged for keys, when revoking keys
(hexpm/hexpm#2103). The test now revokes with the
signed-in user, which works against hexpm before and after that change.
ericmj added a commit to hexpm/hex that referenced this pull request Nov 4, 2026
hexpm is refusing keys, and tokens exchanged for keys, when revoking keys
(hexpm/hexpm#2103). The test now revokes with the
signed-in user, which works against hexpm before and after that change.
ericmj added a commit to hexpm/hex that referenced this pull request Nov 4, 2026
hexpm is refusing keys, and tokens exchanged for keys, when revoking keys
(hexpm/hexpm#2103). The test now revokes with the
signed-in user, which works against hexpm before and after that change.
@ericmj
ericmj merged commit 9899d12 into main Nov 4, 2026
17 of 20 checks passed
@ericmj
ericmj deleted the keys-permission-label branch November 4, 2026 17:12
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