Skip to content

test(#756): pin KMS's projections and record them - #1347

Merged
scttfrdmn merged 1 commit into
mainfrom
test/756-kms-wire-projections
Oct 3, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
test/756-kms-wire-projections

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

This is the second of ten PRs in #756's 3-line block. Like IAM, it is citation only: no
production code changes.

KMS is already projected

KMSKey declares AccountID and Region, plus EverTagged as ever_tagged,omitempty. None of
them reaches a body:

  • CreateKey and DescribeKey answer KeyMetadata from kmsKeyMetadata
    (emulator/kms_key_metadata.go), which builds the map member by member.
  • Every other operation answers a map of published members.

KeyMetadata publishes AWSAccountId, which is fed from the record's account. That is the service's
own data, not a leak, and the equality fold does not confuse it with AccountID.

What the new test asserts

emulator/kms_wire_test.go drives all twenty-four routed operations with the shared
wireAssertNoMemberJSON:

  • Lifecycle: CreateKey, DescribeKey, ListKeys, Enable/DisableKey, Schedule/CancelKeyDeletion.
  • Tags: TagResource, ListResourceTags, UntagResource.
  • Policy and rotation: Get/PutKeyPolicy, Enable/Disable/GetKeyRotationStatus.
  • Cryptography: Encrypt, Decrypt, ReEncrypt, GenerateDataKey and GenerateDataKeyWithoutPlaintext.
  • Aliases: Create/List/Update/DeleteAlias.

It reads AccountID and Region back from the stored record. It then tags the key and reads
ever_tagged: true back before walking any response (#938, #1304).

Negative controls (each run, then restored; kms_key_metadata.go verified diff-free)

  1. Region added to kmsKeyMetadata failed exactly CreateKey and DescribeKey, which are the
    two operations that answer KeyMetadata.
  2. TagResource removed fails at the ever_tagged read-back.

The ratchet

before: 319 declared, 246 projected across 103 records, 9 internal across 6 records, 64 still reachable
after:  319 declared, 249 projected across 104 records, 9 internal across 6 records, 61 still reachable

Verification

All of these pass:

  • make lint: 0 issues.
  • make test: race, -count=1.
  • docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check.

#756 stays open.

KMSKey declares AccountID, Region and ever_tagged, and none reaches a response:
CreateKey and DescribeKey answer KeyMetadata built member by member, whose
published AWSAccountId is the service's own data, and every other operation
answers a map of published members.

emulator/kms_wire_test.go drives all twenty-four routed operations, tagging the
key and reading ever_tagged back before walking any response.

check-wire-bookkeeping goes from 246 projected across 103 records to 249 across
104, and from 64 still reachable to 61.

#756 stays open.
@codecov

codecov Bot commented Oct 3, 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 89f9574 into main Oct 3, 2026
18 checks passed
@scttfrdmn
scttfrdmn deleted the test/756-kms-wire-projections branch October 3, 2026 02:42
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.

1 participant