feat(s3): add blockedEncryptionTypes field to s3.Bucket#37047
feat(s3): add blockedEncryptionTypes field to s3.Bucket#37047
Conversation
| * Encryption types that should be blocked for this bucket. Use `NONE` to allow all | ||
| * encryption types. | ||
| * | ||
| * @default - Amazon S3 determines which encryption types to block. |
There was a problem hiding this comment.
Yes, this isn't a particularly helpful comment, but I wrote this because the default is going to change soon. Right now, no encryption types are blocked by default, but in April, SSE-C will start being blocked by default. When that happens, we can update this to say @default - SSE-C is blocked by default.
An alternative is to say @default - no encryption types are blocked, but SSE-C will start being blocked in April 2026, but putting times in doc comments feels wrong.
|
Any idea why the PR Linter workflow is failing with "Bad credentials"? |
|
|
||||||||||||||
|
|
||||||||||||||
|
|
||
| new s3.Bucket(stack, 'MyBucket', { | ||
| encryption: s3.BucketEncryption.S3_MANAGED, | ||
| blockedEncryptionTypes: [s3.BlockedEncryptionType.NONE], |
There was a problem hiding this comment.
Should we have a test that if nothing is provided here then we don't expect there to be a BlockedEncryptionTypes in the BucketEncryption?
There was a problem hiding this comment.
Actually, we already have tests that makes sure that if we don't specify blockedEncryptionTypes, the either BucketEncryption is empty (if bucketEncryption is UNENCRYPTED) or there's no BlockedEncryptionTypes in the CFN template: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-s3/test/bucket.test.ts#L43-L142
I'm not sure if that's what you meant. The intent of those tests isn't actually checking for blockedEncryptionTypes so I guess it's possible they accidentally get removed in the future, but I think it's unlikely
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Issue
Closes #36988.
Reason for this change
S3 recently added a new
BlockedEncryptionTypesfield to server-side encryption rules (docs). This field allows users to explicitly block or unblock SSE-C encryption on their bucket.Users should be able to set this field through CDK. This will become especially important when SSE-C starts being blocked by default in April (blog post).
Description of changes
Added a
blockedEncryptionTypesfield to the L2s3.Bucketconstruct.blockedEncryptionTypesis not set, behavior is same as before. No defaultblockedEncryptionTypesvalue will be chosen (this is important, we want to let S3 choose what default to apply).blockedEncryptionTypesis set andencryptionTypeisBucketEncryption.UNENCRYPTED, a server-side encryption configuration will be added with justblockedEncryptionTypesbucketKeyEnabledis explicitly set. Please confirm that this is behavior you want. I went with it becausebucketKeyEnabledis already ignored whenencryptionTypeisBucketEncryption.UNENCRYPTED.Describe any new or updated permissions being added
N/A
Description of how you validated changes
Ran unit tests, added integ tests.
MySsecBlockedBucketbucket hasSSE-Cblocked (and no default server-side encryption type explicitly set)MyKmsBucketbucket has no encryption types blockedChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license