Repository navigation
feat(kms): read CustomerMasterKeySpec on CreateKey (#985) - #987
Merged
Merged
Conversation
The member is a request parameter as well as a response member, and substrate decoded only the response half. A caller on an SDK old enough to still send the deprecated name asked for RSA_4096 and silently got a symmetric key — a 200 with a complete KeyMetadata whose own CustomerMasterKeySpec read SYMMETRIC_DEFAULT, contradicting the value it had just been sent. Every rule #977 established applies to the spec it names, because those rules are keyed on the resolved spec rather than on which member carried it. Two decisions AWS does not document, both refused rather than resolved. A value outside the member's own 13 published values answers ValidationError, naming the member, its set and the member that does carry it — the request-side half of the omission #974 chose when reporting it. Both members sent with different values answers the same code naming both, because AWS documents the two as having the same value, so a disagreement is not a request the page describes and substrate cannot tell which was meant. A precedence rule would discard half of a contradictory request silently, which is the failure mode this issue exists to remove rather than relocate. Equal values are accepted.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
5 tasks
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.
Closes #985.
CustomerMasterKeySpecis a request parameter onCreateKeyas well as a response member, and substrate decoded only the response half. So a caller on an SDK old enough to still send the deprecated name asked for anRSA_4096key and silently got a symmetric one.That is the quietest failure available — a
200with a complete, well-formedKeyMetadata— and #974 made it quieter still by adding the response member, so substrate echoed the deprecated name back readingSYMMETRIC_DEFAULT, contradicting the value it had just been sent. Reading it is not a courtesy: AWS still accepts it, per the same sentence #974 cites, so a caller sending it is doing nothing wrong.The pairing rules apply through the older name
#977's rules are keyed on the resolved key spec, not on which member carried it, so resolution happens first and everything downstream is unchanged. A test asserts the required-
KeyUsage, inadmissible-pair and unpublished-usage refusals all fire through the deprecated member — an implementation that resolved it after the pairing check, or beside it, would accept an HMAC key with no usage or an ECC key that encrypts through the older name only.Two decisions AWS does not document
CustomerMasterKeySpecoutside its own 13 published values —ML_DSA_44, say, whichKeySpeccarries and this member does notValidationError/400, naming the member, its set, and the member that does carry itValidationError/400, naming both valuesBoth are recorded as substrate's reading. The two rejected alternatives are worth naming because both look reasonable: a precedence rule (newer member wins) discards half of a contradictory request silently, which is the failure mode this issue exists to remove rather than relocate; and resolving by JSON member order makes the answer depend on something no caller controls meaningfully. Equal values are accepted — an SDK migrating between the two names may send both, and that is a caller agreeing with itself.
The code matches #977's for the same class of defect rather than introducing a second one on one operation, which is what that issue's own analysis warned against.
Verification
The nine-command gate passes. Coverage holds the baseline at 84.4% emulator / 83.9% total.