Skip to content

feat(kms): read CustomerMasterKeySpec on CreateKey (#985) - #987

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/kms-customer-master-key-spec-request
Sep 17, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/kms-customer-master-key-spec-request

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes #985.

CustomerMasterKeySpec is a request parameter on CreateKey as 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 an RSA_4096 key and silently got a symmetric one.

That is the quietest failure available — a 200 with a complete, well-formed KeyMetadata — and #974 made it quieter still by adding the response member, so substrate echoed the deprecated name back reading SYMMETRIC_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

Request Substrate answers Why
CustomerMasterKeySpec outside its own 13 published values — ML_DSA_44, say, which KeySpec carries and this member does not ValidationError/400, naming the member, its set, and the member that does carry it The request-side half of the omission #974 chose when reporting it: neither direction now puts a value outside the member's own published set on the wire. The message has to name the set, because the value is a good key spec and a bare refusal would send the caller hunting a typo that is not there
Both members sent with different values ValidationError/400, naming both values AWS documents the two as having "the same value", so a request in which they disagree is not one the page describes, and substrate cannot tell which was meant

Both 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.

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

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 135fb40 into main Sep 17, 2026
17 checks passed
@scttfrdmn
scttfrdmn deleted the feat/kms-customer-master-key-spec-request branch September 17, 2026 05:32
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.

kms: CustomerMasterKeySpec is a CreateKey request parameter too, so an older-SDK caller asking for RSA_4096 silently gets a symmetric key

1 participant