Repository navigation
Description
DescribeKey renders a RotationEnabled member on KeyMetadata. API_KeyMetadata does not publish
one, and the string does not appear on the page at all.
Found while answering #964's first acceptance criterion, which asked where rotation state is
observable. It is the mirror image of that issue: #964 is the rotation period missing from the operation
AWS publishes it on, this is rotation state present on the shape AWS omits it from. The two are one
defect seen from opposite ends, so the #964 PR should close both.
What AWS publishes
API_KeyMetadata's Contents section lists 26 members:
KeyId, Arn, AWSAccountId, CloudHsmClusterId, CreationDate, CurrentKeyMaterialId,
CustomerMasterKeySpec, CustomKeyStoreId, DeletionDate, Description, Enabled,
EncryptionAlgorithms, ExpirationModel, KeyAgreementAlgorithms, KeyManager, KeySpec,
KeyState, KeyUsage, MacAlgorithms, MultiRegion, MultiRegionConfiguration, Origin,
PendingDeletionWindowInDays, SigningAlgorithms, ValidTo, XksKeyConfiguration.
RotationEnabled is not among them. The shape is shared by CreateKey, DescribeKey and
ReplicateKey, so the extra member is not confined to one operation's response.
Rotation state is reachable through GetKeyRotationStatus and ListKeyRotations only. That is why
API_EnableKeyRotation directs a caller to "use the GetKeyRotationStatus operation to identify any in
progress rotations" rather than to DescribeKey, and why API_GetKeyRotationStatus exists as a
separate operation for a single boolean at all.
What substrate does
describeKey (emulator/kms_plugin.go:380-404) builds the metadata map with ten unconditional members,
one of which is not published:
metadata := map[string]interface{}{
"KeyId": key.KeyID,
"Arn": key.ARN,
"Description": key.Description,
"KeyUsage": key.KeyUsage,
"KeySpec": key.KeySpec,
"KeyState": key.KeyState,
"Enabled": key.Enabled,
"MultiRegion": key.MultiRegion,
"RotationEnabled": key.RotationEnabled, // <- not a KeyMetadata member
"CreationDate": key.CreationDate.Unix(),
}DeletionDate is added conditionally below it, correctly and for the reason #963 recorded.
Why it matters rather than being merely extra
An extra member is not harmless here, because it is one a caller will plausibly use. A consumer that
branches on DescribeKey().KeyMetadata.RotationEnabled gets a usable answer from substrate and an absent
field from AWS — a test that passes against the emulator for code that cannot work against the service.
That is the #765 failure mode (a value readable only through a path the owning service does not offer)
applied to a response member instead of to a tag, and it is the same class as the fabricated members
v0.115.0 removed elsewhere.
It also lets a caller reach rotation state without the key-state and key-type rules that guard it.
GetKeyRotationStatus is the operation AWS gives that state, and it documents that a key pending
deletion reports false; DescribeKey carries no such rule because it does not carry the member.
Acceptance criteria
-
DescribeKey'sKeyMetadatano longer carriesRotationEnabled, and a test asserts its absence
against raw JSON — a decoded struct cannot distinguish an absent member from a false one, which
is exactly the distinction at issue here. - The same test asserts that rotation state is still reachable through
GetKeyRotationStatusfor the
same key, so the removal is shown to remove a duplicate rather than an only route. -
KMSKey.RotationEnabledstays — it is the stored stateGetKeyRotationStatusreports and
EnableKeyRotation/DisableKeyRotationwrite. Only the rendering goes. - A comment on the metadata builder records that the member was removed and why, so a later change
does not restore it as an obvious convenience. -
docs/services.md's KMS section records the removal underDescribeKey, and states that rotation
state is observable throughGetKeyRotationStatusalone. - Compatibility is called out in
CHANGELOG.md: this removes a member from a shipped response,
so a consumer reading it will see it disappear. No in-tree test asserts it — a repo-wide grep finds
every KMS rotation assertion readingKeyRotationEnabledfromGetKeyRotationStatus— so nothing
in the suite needs relaxing.
Adjacent and deliberately not in scope
Substrate omits 16 published KeyMetadata members, five of which a real DescribeKey on a plain
customer symmetric key would always carry (AWSAccountId, KeyManager, Origin,
EncryptionAlgorithms, CustomerMasterKeySpec). That is the opposite direction of this issue and a
larger change, filed separately. This issue removes one member that should not be there; it does not add
the ones that should.
Activity
fix(kms): store EnableKeyRotation's period, and stop DescribeKey inve…
feat(kms): one KeyMetadata builder, and the sixteen members it stoppe…