Skip to content

Commit

Permalink
feat(sns): enforce ssl with topic policy (#29144)
Browse files Browse the repository at this point in the history
Adds a statement to match the document in the [docs](https://docs.aws.amazon.com/sns/latest/dg/sns-security-best-practices.html#enforce-encryption-data-in-transit):

```
{
  "Id": "ExamplePolicy",
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowPublishThroughSSLOnly",
      "Action": "SNS:Publish",
      "Effect": "Deny",
      "Resource": [
        "arn:aws:sns:us-east-1:1234567890:test-topic"
      ],
      "Condition": {
        "Bool": {
          "aws:SecureTransport": "false"
        }
      },
      "Principal": "*"
    }
  ]
}
```

Closes #29142.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
msambol authored Feb 20, 2024
1 parent 1fd5485 commit a75f447
Show file tree
Hide file tree
Showing 14 changed files with 861 additions and 3 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"Resources": {
"TopicBFC7AF6E": {
"Type": "AWS::SNS::Topic",
"Properties": {
"DisplayName": "fooDisplay",
"TopicName": "fooTopic"
}
},
"TopicPolicyA24B096F": {
"Type": "AWS::SNS::TopicPolicy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "sns:Publish",
"Effect": "Allow",
"Principal": {
"Service": "s3.amazonaws.com"
},
"Resource": {
"Ref": "TopicBFC7AF6E"
},
"Sid": "0"
},
{
"Action": "sns:Publish",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
},
"Effect": "Deny",
"Principal": "*",
"Resource": {
"Ref": "TopicBFC7AF6E"
},
"Sid": "AllowPublishThroughSSLOnly"
}
],
"Version": "2012-10-17"
},
"Topics": [
{
"Ref": "TopicBFC7AF6E"
}
]
}
},
"TopicAddPolicy7DB03706": {
"Type": "AWS::SNS::Topic",
"Properties": {
"DisplayName": "topicDisplayNameAddPolicy",
"TopicName": "topicAddPolicy"
}
},
"TopicAddPolicyAEA24A5A": {
"Type": "AWS::SNS::TopicPolicy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "sns:Publish",
"Effect": "Allow",
"Principal": {
"Service": "s3.amazonaws.com"
},
"Resource": {
"Ref": "TopicAddPolicy7DB03706"
},
"Sid": "0"
},
{
"Action": "sns:Publish",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
},
"Effect": "Deny",
"Principal": "*",
"Resource": {
"Ref": "TopicAddPolicy7DB03706"
},
"Sid": "AllowPublishThroughSSLOnly"
}
],
"Version": "2012-10-17"
},
"Topics": [
{
"Ref": "TopicAddPolicy7DB03706"
}
]
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a75f447

Please sign in to comment.