Repository navigation
Description
CustomerMasterKeySpec is a request parameter on CreateKey, not only a response member, and substrate decodes only the response half. So a caller using an SDK old enough to still send the deprecated name asks for an RSA_4096 key and silently gets a symmetric one — with KeySpec: "SYMMETRIC_DEFAULT" in the response it reads back.
Found while verifying API_CreateKey for #977. #974 answered the response member; this is its request-side twin, and it is the more consequential of the two, because a wrong response member misinforms a caller while a wrong request member hands them a key of the wrong type.
What substrate does today
createKey (emulator/kms_plugin.go) decodes KeySpec and nothing else in that family:
if input.KeySpec == "" {
input.KeySpec = kmsSymmetricDefaultKeySpec
}A request body of {"CustomerMasterKeySpec": "RSA_4096"} therefore leaves KeySpec empty, the default fires, and the key is symmetric. Every downstream observation follows from that one silent substitution: Encrypt succeeds where the caller expected it to be unavailable, Sign refuses, GetPublicKey has nothing to answer, and #974's builder reports EncryptionAlgorithms where the caller expected SigningAlgorithms.
The failure is quiet in the worst way — a 200 with a complete, well-formed KeyMetadata whose CustomerMasterKeySpec (which #974 now emits) reads SYMMETRIC_DEFAULT, i.e. substrate echoes the deprecated member back with a value contradicting the one it was sent.
What AWS publishes
API_CreateKey's Request Parameters list CustomerMasterKeySpec alongside KeySpec, Type String, Valid Values the same 13 as its response counterpart:
RSA_2048 | RSA_3072 | RSA_4096 | ECC_NIST_P256 | ECC_NIST_P384 | ECC_NIST_P521 | ECC_SECG_P256K1 | SYMMETRIC_DEFAULT | HMAC_224 | HMAC_256 | HMAC_384 | HMAC_512 | SM2
— four fewer than KeySpec's 17, the four post-deprecation specs (ML_DSA_44, ML_DSA_65, ML_DSA_87, ECC_NIST_EDWARDS25519) being absent for the reason #974 already recorded on the response side.
The parameter is marked deprecated with the same sentence the response member carries — "the KeySpec and CustomerMasterKeySpec fields have the same value… to avoid breaking changes, AWS KMS supports both fields" — which is exactly why it must be decoded rather than treated as obsolete: AWS still accepts it, so a caller sending it is not doing anything wrong.
API_CreateKey publishes no ValidationException. The code for a conflicting or malformed value has to be chosen and recorded, the same open question #977 carries; ValidationError/400 from CommonErrors.html is the in-tree precedent (#969).
What needs deciding
AWS does not document what happens when both members are sent with different values. The available readings:
- Refuse the conflict. The two members are documented to have the same value, so disagreeing values are a malformed request. Most defensible, and it cannot silently mislead.
KeySpecwins. The newer member takes precedence and the deprecated one is ignored when both are present.- Last-writer-wins by JSON order — not a real option; it makes the answer depend on member order in a JSON object, which is not a thing a caller controls meaningfully.
Reading 1 is the recommendation, with the code stated as substrate's reading since AWS publishes none for it.
Also to decide: a CustomerMasterKeySpec value outside its own 13 — ML_DSA_44, say, which is valid under KeySpec and not under this member. Refusing it is the narrow reading and matches what #974 does on the response side, where such a key omits the member entirely rather than reporting a value outside its published set.
Relationship to #977
#977 validates KeySpec and KeyUsage against their published enums, and this issue adds a third member to the same validation surface with a narrower enum than the one beside it. They touch the same handler and the same decision about which error code a malformed enum member gets. Either land this inside #977, or land it immediately after and reuse whatever code #977 settles on — what must not happen is two different codes for the same class of malformed input on one operation.
Acceptance criteria
-
createKeydecodesCustomerMasterKeySpecand honours it whenKeySpecis absent, so an older-SDK caller gets the key type it asked for. - Both members sent with different values answers a refusal, with the code cited to whatever kms: CreateKey validates neither KeySpec nor KeyUsage, and no cryptographic operation refuses a key whose KeyUsage is not ENCRYPT_DECRYPT #977 settles on and the reading recorded — AWS documents no answer for the conflict.
- A
CustomerMasterKeySpecoutside its own 13 published values is refused rather than accepted as aKeySpec, matching the response-side narrowing kms: DescribeKey answers 10 of KeyMetadata's 26 members, omitting AWSAccountId, KeyManager and Origin #974 recorded. -
docs/services.md'sCreateKeyrow records that the deprecated request member is honoured and that its enum is narrower thanKeySpec's, stating which parts are AWS's and which are substrate's reading. - Tests go over the wire (cfn: the aws:cloudformation:* stamp covers EC2 only, so the rest of a stack is unstamped #765) and assert the status alongside the code (fix(kms): NotFoundException is HTTP 400, and InvalidRequest is not a KMS code #923). At minimum:
CustomerMasterKeySpec: "RSA_4096"alone yields an asymmetric key whoseKeySpecreadsRSA_4096, and the conflict case is pinned.
Activity
feat(kms): read CustomerMasterKeySpec on CreateKey (#985) (#987)
scttfrdmn commentedon Sep 17, 2026
Shipped in #987, merged to
mainat135fb40, and moved from v0.119.0 to v0.118.0 — the milestone should name the release the work actually appears in, and this landed inside the v0.118.0 cycle rather than being deferred past it.The move was not a scheduling convenience. This issue's own instruction was "either land this inside #977, or land it immediately after and reuse whatever code #977 settles on — what must not happen is two different codes for the same class of malformed input on one operation." #977 is a v0.118.0 issue, so honouring that instruction meant landing here too; leaving the milestone at v0.119.0 would have recorded the opposite of what happened, with the two halves of one validation surface split across two releases.
What shipped:
CustomerMasterKeySpecis decoded as aCreateKeyrequest parameter, so a caller on an SDK old enough to send the deprecated name gets the key it asked for instead of a symmetric one.KeyUsage, inadmissible-pair and unpublished-usage refusals all fire through the deprecated member.ML_DSA_44,ML_DSA_65,ML_DSA_87andECC_NIST_EDWARDS25519are refused under it and accepted underKeySpec. That is the request-side half of the omission kms: DescribeKey answers 10 of KeyMetadata's 26 members, omitting AWSAccountId, KeyManager and Origin #974 chose when reporting the member.ValidationError/400, matching kms: CreateKey validates neither KeySpec nor KeyUsage, and no cryptographic operation refuses a key whose KeyUsage is not ENCRYPT_DECRYPT #977 rather than introducing a second code on one operation.