Repository navigation
Description
DescribeKey's KeyMetadata answers 10 of the 26 members API_KeyMetadata publishes. Five of the
missing ones would be present on every real DescribeKey call for a plain customer symmetric key, so a
consumer reading them gets a zero value or a missing key from substrate where AWS always sends a value.
Found while verifying the shape for the RotationEnabled finding filed alongside this. That issue removes
one member substrate emits and AWS does not publish; this one is the opposite direction and is a larger
change, so the two are separate.
What AWS publishes
API_KeyMetadata's Contents section lists 26 members. KeyMetadata is shared by CreateKey,
DescribeKey and ReplicateKey, so any fix must be made where all three reach it, not in describeKey
alone.
Substrate answers 10 unconditionally — KeyId, Arn, Description, KeyUsage, KeySpec, KeyState,
Enabled, MultiRegion, CreationDate, and RotationEnabled (not a published member; see the companion
issue) — plus DeletionDate conditionally, correctly, for the reason #963 recorded.
The 16 absent members split cleanly by whether AWS would send them for a key substrate can actually create:
Always present on a customer symmetric key — these are the defect:
| Member | Type | Value substrate could answer |
|---|---|---|
AWSAccountId |
String | The owning account, which KMSKey already knows — "The twelve-digit account ID of the AWS account that owns the KMS key" |
KeyManager |
String, AWS | CUSTOMER |
CUSTOMER; substrate mints no AWS-managed keys |
Origin |
String, AWS_KMS | EXTERNAL | AWS_CLOUDHSM | EXTERNAL_KEY_STORE |
AWS_KMS; substrate creates all key material itself |
EncryptionAlgorithms |
Array, SYMMETRIC_DEFAULT | RSAES_OAEP_SHA_1 | RSAES_OAEP_SHA_256 | SM2PKE |
Derived from KeySpec; "present only when the KeyUsage of the KMS key is ENCRYPT_DECRYPT" |
CustomerMasterKeySpec |
String, deprecated | "The KeySpec and CustomerMasterKeySpec fields have the same value… to avoid breaking changes, AWS KMS supports both fields" — so it is a duplicate of a member substrate already has |
Conditional, and legitimately absent given what substrate models:
CloudHsmClusterId and CustomKeyStoreId (custom key stores are not modelled), ExpirationModel and
ValidTo ("present only for KMS keys whose Origin is EXTERNAL"; ImportKeyMaterial is not
implemented), XksKeyConfiguration (external key stores), MultiRegionConfiguration ("present only when
the value of the MultiRegion field is True" — substrate stores MultiRegion but models no
replicas), PendingDeletionWindowInDays (confined to PendingReplicaDeletion, already recorded as
deliberately absent in describeKey's own comment), CurrentKeyMaterialId (key material is not
modelled), MacAlgorithms ("present only when the KeyUsage … is GENERATE_VERIFY_MAC") and
SigningAlgorithms ("appears only when the KeyUsage … is SIGN_VERIFY") — though these last two
become answerable for the key specs CreateKey already accepts.
Why the first five matter
AWSAccountId, KeyManager and Origin are the three a caller is most likely to branch on, and each
carries a decision a consumer legitimately makes: whether a key is theirs to administer (KeyManager),
whether its material can be re-imported or expires (Origin), and which account a cross-account grant
would name (AWSAccountId). All three are constants for every key substrate can create, so answering them
is not a simulation — it is reporting what substrate already knows and currently withholds.
EncryptionAlgorithms is the one requiring a derivation rather than a constant, and it is worth having
because it is the member that tells a caller which algorithms Encrypt will accept — a value #969's
unmodelled EncryptionAlgorithm parameters will need a source of truth for.
Acceptance criteria
-
AWSAccountId,KeyManagerandOriginare answered for every key, withKeyManager: CUSTOMERand
Origin: AWS_KMSrecorded as constants that hold because substrate models neither AWS-managed keys
nor imported material. -
EncryptionAlgorithmsis derived fromKeySpecand emitted only whenKeyUsageis
ENCRYPT_DECRYPT, per the member's own condition. -
CustomerMasterKeySpecis answered with the same value asKeySpec, per the deprecation note, or
the decision to omit a deprecated member is recorded with its reason. Whichever way it goes is
substrate's reading, since the page documents the member as still supported. -
MacAlgorithmsandSigningAlgorithmsare decided explicitly for the HMAC and sign/verify specs
CreateKeyaccepts, rather than left absent by omission. - The builder is shared by
CreateKey,DescribeKeyandReplicateKey— or, if those three do not
currently share one, the fix reaches all three and a test asserts one key reports the same member set
through each. Two operations disagreeing about one shape is the defect class secretsmanager: RotateSecret omits VersionId, discards six parameters, and answers 200 where AWS publishes InvalidRequestException #952 catalogued. - Members are asserted against raw JSON, since an absent member and a zero-valued one are the
distinction under test. - The members that stay absent are recorded in
docs/services.mdwith the condition that makes each
unreachable, following the precedent already set forPendingDeletionWindowInDays. - Compatibility: new members appear in a shipped response. Additive, so no consumer breaks, but it
is a wire change and belongs in the notes.
Related
- The companion issue removing
RotationEnabled, which substrate emits andAPI_KeyMetadatadoes not
publish. That one subtracts, this one adds; both are the same shape failing to match the same page. - kms: ReEncrypt decodes two of nine request members and answers three of seven response members, and an unenforced SourceKeyId hides IncorrectKeyException #969 —
ReEncrypt's unmodelledSourceEncryptionAlgorithm/DestinationEncryptionAlgorithm, which need
the sameKeySpec→ algorithms derivation asEncryptionAlgorithmshere.
Activity
feat(kms): one KeyMetadata builder, and the sixteen members it stoppe…
feat(kms): validate KeySpec and KeyUsage, and pair them (#977) (#986)
feat(kms): read CustomerMasterKeySpec on CreateKey (#985) (#987)
fix(kms): CreateKey refuses the key-material parameters it does not m…