fix: allow erasing write-only secrets with explicit null on PUT #1949 - #1950
Open
KirylKurnosenka wants to merge 1 commit into
Open
fix: allow erasing write-only secrets with explicit null on PUT #1949#1950KirylKurnosenka wants to merge 1 commit into
KirylKurnosenka wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Code <noreply@anthropic.com>
KirylKurnosenka
requested review from
Oleksii-Klimov and
astsiapanay
as code owners
September 9, 2026 21:04
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.
On a per-entity PUT update there was no way to erase a write-only secret: an explicit
nullwas treated identically to an omitted field and silently preserved the stored ciphertext (see #1949 — once a JSONsecretExtraDatawas stored, the upstream could never be switched to a plain-stringextraData). This change makes the three update intents explicit: omitted → preserve, explicitnull→ erase, a literal value (including the empty string) → replace.Applicable issues
Description of changes
SecretFieldProcessor.mergeInto: the preserve branch no longer treats an explicitnullas omit — the request'sNullNodenow flows into the entity and the blob writer omits the field, so the erase carries end-to-end. RenamedmergePreservingOmittedSecrets→mergeUpdateSecretsto reflect the three-intent contract.ConfigResourceController.handlePut: updated call site and replaced the stale sentinel-era comment.Model.upstreams,Route.upstreams,Upstream.interfaces) are covered automatically by the existing recursion inmergeArray/mergeMap.Key.keyis unchanged: an explicitnullstill yields 400 viavalidateKeyForApiWrite— erase does not apply to a mandatory field.SecretFieldProcessorTestcases (top-level, upstream array element, interface map entry, empty string, null with no prior value); end-to-endModelWriteApiTest.testPutExplicitNullUpstreamKeyErasesSecret(noX-UPSTREAM-KEYheader after erase) andConfigEntityWriteApiTest.testKeyPutExplicitNullKeyRejected400.nullable: true+ descriptions on theUpstream/UpstreamInterfacesecret fields documenting the three intents.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.