Skip to content

fix(s3vectors): read EncryptionConfiguration with the CFn SseType / KmsKeyArn spellings - #1397

Merged
go-to-k merged 4 commits into
mainfrom
fix/1385-s3vectors-encryption-spelling
Aug 9, 2026
Merged

fix(s3vectors): read EncryptionConfiguration with the CFn SseType / KmsKeyArn spellings#1397
go-to-k merged 4 commits into
mainfrom
fix/1385-s3vectors-encryption-spelling

Conversation

@go-to-k

@go-to-k go-to-k commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

S3VectorsProvider read the vector bucket's encryption sub-keys as SSEType /
KMSKeyArn, which the AWS::S3Vectors::VectorBucket CFn registry schema and
CDK's CfnVectorBucket renderer never emit — both spell them SseType /
KmsKeyArn
(verified live against cloudformation:describe-type and
aws-cdk-lib's generated renderer on 2026-08-09).

Both lookups were therefore permanently undefined, so CreateVectorBucket
shipped the account-default encryption instead of the requested
customer-managed KMS key. Deploy reported success; nothing surfaced the
divergence, because readCurrentState re-emitted the same wrong spellings, so
cdkd drift compared SSEType against SSEType and saw no drift while state
held the template's SseType.

What changed

  • create() reads SseType / KmsKeyArn and maps them onto the SDK's
    sseType / kmsKeyArn.
  • readCurrentState() emits SseType / KmsKeyArn (the CFn spelling), so
    state and the AWS-current snapshot compare on the same keys. The Class-1
    KMS-only guard on KmsKeyArn is preserved verbatim.
  • Existing unit tests that pinned the wrong spellings were corrected; two new
    create-path tests pin the mapping.

Test plan

  • vp run check / typecheck:test / build / test — 515 files, 8693 tests, 0 type errors.
  • Revert probe: re-introducing SSEType / KMSKeyArn into the real
    provider makes the two new create tests fail (sseType: undefined), then
    restoring turns them green — the tests fail without the fix.
  • Real AWS: the s3-vectors fixture now deploys a CMK-encrypted vector
    bucket and verify.sh asserts GetVectorBucket returns
    sseType=aws:kms plus the exact key ARN from the stack output. Run
    2026-08-09: all assertions green, destroy 2 deleted / 0 errors, 0 orphans
    (the CMK is asserted to be PendingDeletion, which is the only state AWS
    offers for a deleted key). Recorded in docs/_generated/integ-last-run.tsv.

Upgrade notes for existing stacks

Two consequences of the wire-format change that reviewers surfaced, both
recorded here rather than papered over:

  1. A bucket created by the pre-fix binary stays wrongly encrypted. The bug
    was purely on the wire — the template and state.properties both already
    held SseType, so a post-upgrade cdkd deploy sees no diff and the bucket
    silently keeps the account-default encryption. EncryptionConfiguration is
    create-only, so only a replacement fixes it. After upgrading, run
    cdkd drift <stack>; a vector bucket that reports EncryptionConfiguration
    drift must be recreated.
  2. cdkd drift reports two phantom rows on such a bucket (SSEType -> undefined plus SseType: undefined -> …), because the
    observedProperties baseline written by the old binary holds the old
    spellings while readCurrentState now emits the new ones. This does not
    self-heal: kickOffAutoRefreshObservedProperties skips any resource that
    already has a baseline (src/deployment/deploy-engine.ts:876), and
    EncryptionConfiguration is create-only so no UPDATE ever refreshes it —
    the rows persist on every subsequent run. Clear them with
    cdkd state refresh-observed <stack>, which overwrites the baseline
    unconditionally. drift --revert on those rows dead-ends in
    ResourceUpdateNotSupportedError (create-only), which is correct — see
    point 1 for the real remedy.

Notes

AWS::S3Vectors::VectorBucket is not in NESTED_KEY_TARGETS
(scripts/gen-nested-key-coverage.ts), and the critic could not have caught
this class anyway: the CFn key SseType lower-firsts cleanly to the SDK's
sseType, so the pass classifies it same-spelling and never looks at what
spelling the provider actually reads. Extending the critic to that blind spot
is tracked in (#1393).

Closes #1385

go-to-k added 4 commits August 9, 2026 12:33
…msKeyArn spellings

The provider read the vector bucket's encryption sub-keys as SSEType /
KMSKeyArn, which the AWS::S3Vectors::VectorBucket CFn registry schema and
CDK's CfnVectorBucket renderer never emit (both spell them SseType /
KmsKeyArn). Both lookups were therefore always undefined, so
CreateVectorBucket shipped the account-default encryption instead of the
requested customer-managed KMS key - a silent, security-relevant drop.

readCurrentState re-emitted the same wrong spellings, so cdkd drift could
not surface the divergence either.

- create: read SseType / KmsKeyArn and map to the SDK sseType / kmsKeyArn
- readCurrentState: emit SseType / KmsKeyArn (CFn spelling) so state and
  the AWS-current snapshot compare on the same keys
- unit tests pin both directions; the two new create tests were verified
  to fail without the fix
- s3-vectors integ fixture gains a CMK-encrypted vector bucket and
  verify.sh asserts GetVectorBucket returns the requested key ARN

Closes #1385
…describe-key probe

Re-review follow-ups: the sibling KMS create assertion still used toEqual
(which ignores undefined-valued keys) while the AES256 one had been made
strict, and the post-destroy 'aws kms describe-key' ran bare under
set -euo pipefail so a throttle/AccessDenied aborted with the raw AWS error
instead of the named FAIL line.
@go-to-k
go-to-k merged commit 58aa6ee into main Aug 9, 2026
5 checks passed
@go-to-k
go-to-k deleted the fix/1385-s3vectors-encryption-spelling branch August 9, 2026 05:05
github-actions Bot pushed a commit that referenced this pull request Aug 9, 2026
## [0.278.4](v0.278.3...v0.278.4) (2026-08-09)

### Bug Fixes

* **s3vectors:** read EncryptionConfiguration with the CFn SseType / KmsKeyArn spellings ([#1397](#1397)) ([58aa6ee](58aa6ee))
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 0.278.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS::S3Vectors::VectorBucket: provider reads SSEType/KMSKeyArn but CFn spells SseType/KmsKeyArn — KMS encryption config is dead code

1 participant