Skip to content

Commit f47d09c

Browse files
authored
feat(s3): specify minimum TLS version (#27297)
Leverages the `s3:TLSVersion` IAM condition key to allow specifying a minimum TLS version for S3 requests. Requires `enforceSSL` to be enabled. Example: ``` const bucket = new s3.Bucket(this, 'Bucket', { enforceSSL: true, minimumTLSVersion: 1.2, }); ``` Closes #27279. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent dd00d05 commit f47d09c

12 files changed

+710
-0
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-minimum-tls-version.js.snapshot/aws-cdk-s3-minimum-tls-version.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"Resources": {
3+
"Bucket83908E77": {
4+
"Type": "AWS::S3::Bucket",
5+
"UpdateReplacePolicy": "Retain",
6+
"DeletionPolicy": "Retain"
7+
},
8+
"BucketPolicyE9A3008A": {
9+
"Type": "AWS::S3::BucketPolicy",
10+
"Properties": {
11+
"Bucket": {
12+
"Ref": "Bucket83908E77"
13+
},
14+
"PolicyDocument": {
15+
"Statement": [
16+
{
17+
"Action": "s3:*",
18+
"Condition": {
19+
"Bool": {
20+
"aws:SecureTransport": "false"
21+
}
22+
},
23+
"Effect": "Deny",
24+
"Principal": {
25+
"AWS": "*"
26+
},
27+
"Resource": [
28+
{
29+
"Fn::GetAtt": [
30+
"Bucket83908E77",
31+
"Arn"
32+
]
33+
},
34+
{
35+
"Fn::Join": [
36+
"",
37+
[
38+
{
39+
"Fn::GetAtt": [
40+
"Bucket83908E77",
41+
"Arn"
42+
]
43+
},
44+
"/*"
45+
]
46+
]
47+
}
48+
]
49+
},
50+
{
51+
"Action": "s3:*",
52+
"Condition": {
53+
"NumericLessThan": {
54+
"s3:TlsVersion": 1.2
55+
}
56+
},
57+
"Effect": "Deny",
58+
"Principal": {
59+
"AWS": "*"
60+
},
61+
"Resource": [
62+
{
63+
"Fn::GetAtt": [
64+
"Bucket83908E77",
65+
"Arn"
66+
]
67+
},
68+
{
69+
"Fn::Join": [
70+
"",
71+
[
72+
{
73+
"Fn::GetAtt": [
74+
"Bucket83908E77",
75+
"Arn"
76+
]
77+
},
78+
"/*"
79+
]
80+
]
81+
}
82+
]
83+
}
84+
],
85+
"Version": "2012-10-17"
86+
}
87+
}
88+
}
89+
},
90+
"Parameters": {
91+
"BootstrapVersion": {
92+
"Type": "AWS::SSM::Parameter::Value<String>",
93+
"Default": "/cdk-bootstrap/hnb659fds/version",
94+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
95+
}
96+
},
97+
"Rules": {
98+
"CheckBootstrapVersion": {
99+
"Assertions": [
100+
{
101+
"Assert": {
102+
"Fn::Not": [
103+
{
104+
"Fn::Contains": [
105+
[
106+
"1",
107+
"2",
108+
"3",
109+
"4",
110+
"5"
111+
],
112+
{
113+
"Ref": "BootstrapVersion"
114+
}
115+
]
116+
}
117+
]
118+
},
119+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
120+
}
121+
]
122+
}
123+
}
124+
}

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-minimum-tls-version.js.snapshot/awscdks3minimumtlsversionintegrationDefaultTestDeployAssert7BC7B4EF.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-minimum-tls-version.js.snapshot/awscdks3minimumtlsversionintegrationDefaultTestDeployAssert7BC7B4EF.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-minimum-tls-version.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-minimum-tls-version.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-minimum-tls-version.js.snapshot/manifest.json

+119
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)