Repository navigation
fix(keys): hide key secrets from callers without keys.write - #14600
Conversation
A key holding only keys.read could list or get other project keys and receive their plaintext secrets, then authenticate with their scopes. Blank the secret for API keys that cannot write keys on the project and organization key endpoints. Console roles hold both scopes, so the Console is unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
The change masks the
Reviewed commit: fc9c334 |
🟢 Tier S · Ready to merge
Project and organization key get/list endpoints now blank the
📂 Walkthrough · 6
Reviewed |
Security rulesNo new WARNING or ERROR findings from security rules. 19 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
What
GETon project keys (/v1/project/keys,/v1/projects/:projectId/keys,/v1/organization/projects/:projectId/keys, and the/:keyIdvariants) returned every key'ssecretto any caller withkeys.read. A key limited tokeys.readcould read the secret of a broader key and act with its scopes.The list and get actions now blank
secretwhen the caller is an API key withoutkeys.write(ororganization.projects.keys.writeon the organization routes). A caller with write access can already rewrite any key's scopes, so showing it the secret grants nothing new.Console roles (owner, developer, admin) always hold both scopes, so the Console still shows secrets. Create and ephemeral create still return the secret.
Tests
testGetKeySecretRequiresWriteScopeinOrganization/KeysBase: akeys.readephemeral key gets''on get and list, while akeys.read+keys.writekey gets the real secret.Project/KeysBaselifecycle smoke test.main(secret returned) and passes with this change. Organization and Project key suites pass locally (console + server).🤖 Generated with Claude Code