fix: reject key writes whose secret is already used by another key entity #1979 - #1980
Open
KirylKurnosenka wants to merge 1 commit into
Open
KirylKurnosenka wants to merge 1 commit into
KirylKurnosenka wants to merge 1 commit into
Conversation
…tity #1979 ApiKeyStore.keys is keyed by the plaintext secret, so two Key entities created with the same secret silently collapsed: auth, roles, rate-limit project, and author attribution flipped to whichever entity was written last. Reject such writes on all write paths (409 on PUT, FAILED per entity on apply/validate), mirroring the schema duplicate-$id guard; the config-file migration endpoint pre-removes the file twin from the scratch so it remains the supported handoff for file-defined keys. Updates that keep the entity's own prior secret stay allowed. Co-Authored-By: Claude Code <noreply@anthropic.com>
KirylKurnosenka
requested review from
Oleksii-Klimov and
astsiapanay
as code owners
September 14, 2026 19:34
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ApiKeyStore.keys is keyed by the plaintext secret, so two Key entities created with the same secret silently collapsed: auth, roles, rate-limit project, and author attribution flipped to whichever entity was written last.
Applicable issues
Description of changes
$idguard. Shared predicateConfigPostProcessor.isKeySecretTakenByAnotherKeyscans the foldedConfig.keysmap, skipping the written entity's own entry.PUT /v1/keys/platform/{name}returns 409 before anything is written;/v1/admin/applyand/v1/admin/validatemark the entity FAILED (within-batch duplicates are caught too, via the scratch).scratch.getKeys().remove(secret)), the same handoffscratchSchemas.remove(id)gives schemas — migration stays the only supported file→blob handoff for keys.ApiKeyStore/MergedConfigStoreregression suites verified locally.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
🤖 Generated with Claude Code