Commit 262e8a7
authored
feat(s3): add blockedEncryptionTypes field to s3.Bucket (#37047)
### Issue #
Closes #36988.
### Reason for this change
S3 recently added a new `BlockedEncryptionTypes` field to server-side encryption rules ([docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/blocking-unblocking-s3-c-encryption-gpb.html)). 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](https://aws.amazon.com/blogs/storage/advanced-notice-amazon-s3-to-disable-the-use-of-sse-c-encryption-by-default-for-all-new-buckets-and-select-existing-buckets-in-april-2026/)).
### Description of changes
Added a `blockedEncryptionTypes` field to the L2 `s3.Bucket` construct.
- If `blockedEncryptionTypes` is not set, behavior is same as before. No default `blockedEncryptionTypes` value will be chosen (this is important, we want to let S3 choose what default to apply).
- If `blockedEncryptionTypes` is set and `encryptionType` is `BucketEncryption.UNENCRYPTED`, a server-side encryption configuration will be added with just `blockedEncryptionTypes`
- **This happens even if `bucketKeyEnabled` is explicitly set**. Please confirm that this is behavior you want. I went with it because `bucketKeyEnabled` is already ignored when `encryptionType` is `BucketEncryption.UNENCRYPTED`.
### Describe any new or updated permissions being added
N/A
### Description of how you validated changes
Ran unit tests, added integ tests.
- Verified that the `MySsecBlockedBucket` bucket has `SSE-C` blocked (and no default server-side encryption type explicitly set)
- Verified that the `MyKmsBucket` bucket has no encryption types blocked
### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*1 parent 73e5006 commit 262e8a7
File tree
11 files changed
+865
-70
lines changed- packages
- @aws-cdk-testing/framework-integ/test/aws-s3/test
- integ.bucket-encryption.js.snapshot
- aws-cdk-lib/aws-s3
- lib
- test
11 files changed
+865
-70
lines changedLines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
94 | 117 | | |
95 | 118 | | |
96 | 119 | | |
| |||
127 | 150 | | |
128 | 151 | | |
129 | 152 | | |
130 | | - | |
| 153 | + | |
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments