Skip to content

Commit b3975c5

Browse files
go-to-kGavinZZ
andauthored
fix(sns): topic policy is not created even if enforceSSL enabled (#31569)
### Issue # (if applicable) Closes #31558. ### Reason for this change <!--What is the bug or use case behind this change?--> SNS topic policy is not created even if `enforceSSL` is enabled, until calling `addToResourcePolicy` method. But, originally, the policy should be created without calling the `addToResourcePolicy` method. ### Description of changes <!--What code changes did you make? Have you made any important design decisions?--> The topic policy is created first if the `enforceSSL` is enabled. ### Description of how you validated changes <!--Have you added any unit tests and/or integration tests?--> Unit and integ tests. ### 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* Co-authored-by: GZ <[email protected]>
1 parent 330a919 commit b3975c5

File tree

11 files changed

+233
-62
lines changed

11 files changed

+233
-62
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-topic-policy.js.snapshot/SNSTopicPolicyIntegDefaultTestDeployAssert005CA6BA.assets.json

+1-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-sns/test/integ.sns-topic-policy.js.snapshot/SNSTopicPolicyStack.assets.json

+3-3
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-sns/test/integ.sns-topic-policy.js.snapshot/SNSTopicPolicyStack.template.json

+36-4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@
5959
"Properties": {
6060
"PolicyDocument": {
6161
"Statement": [
62+
{
63+
"Action": "sns:Publish",
64+
"Condition": {
65+
"Bool": {
66+
"aws:SecureTransport": "false"
67+
}
68+
},
69+
"Effect": "Deny",
70+
"Principal": "*",
71+
"Resource": {
72+
"Ref": "TopicAddPolicy7DB03706"
73+
},
74+
"Sid": "AllowPublishThroughSSLOnly"
75+
},
6276
{
6377
"Action": "sns:Publish",
6478
"Effect": "Allow",
@@ -68,8 +82,26 @@
6882
"Resource": {
6983
"Ref": "TopicAddPolicy7DB03706"
7084
},
71-
"Sid": "0"
72-
},
85+
"Sid": "1"
86+
}
87+
],
88+
"Version": "2012-10-17"
89+
},
90+
"Topics": [
91+
{
92+
"Ref": "TopicAddPolicy7DB03706"
93+
}
94+
]
95+
}
96+
},
97+
"TopicWithSSLC879A4EA": {
98+
"Type": "AWS::SNS::Topic"
99+
},
100+
"TopicWithSSLPolicy3E7ECD75": {
101+
"Type": "AWS::SNS::TopicPolicy",
102+
"Properties": {
103+
"PolicyDocument": {
104+
"Statement": [
73105
{
74106
"Action": "sns:Publish",
75107
"Condition": {
@@ -80,7 +112,7 @@
80112
"Effect": "Deny",
81113
"Principal": "*",
82114
"Resource": {
83-
"Ref": "TopicAddPolicy7DB03706"
115+
"Ref": "TopicWithSSLC879A4EA"
84116
},
85117
"Sid": "AllowPublishThroughSSLOnly"
86118
}
@@ -89,7 +121,7 @@
89121
},
90122
"Topics": [
91123
{
92-
"Ref": "TopicAddPolicy7DB03706"
124+
"Ref": "TopicWithSSLC879A4EA"
93125
}
94126
]
95127
}

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-topic-policy.js.snapshot/cdk.out

+1-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-sns/test/integ.sns-topic-policy.js.snapshot/integ.json

+1-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-sns/test/integ.sns-topic-policy.js.snapshot/manifest.json

+16-2
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-sns/test/integ.sns-topic-policy.js.snapshot/tree.json

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

0 commit comments

Comments
 (0)