Description
In an SNS topic policy, Principal: "*" in an Effect: Allow statement leaves the principal unrestricted. Effective access still depends on the action, topic, conditions and other policies. Omitting Principal from the statement neither grants public access nor defines a restriction.
Potential impact
If unintended principals, including other accounts, can use sns:Publish, their messages may trigger false alerts, processing errors or additional costs for subscribers.
Remediation
- Specify the required account, role or service in
Principal. Allow only the necessary actions on the exact topic ARN. - For service integrations, check the operators and values for supported
aws:SourceArnoraws:SourceAccountconditions. In supported service-to-service requests,aws:SourceAccountidentifies the source resource’s owner.aws:ResourceAccountidentifies the destination resource’s owner. Neither identifies an ordinary caller’s account. - Remove unnecessary grants and check the associated
Topics. Test that required publishers and services succeed and unapproved requests are denied.
Topic policy configuration examples
Both excerpts omit the required Topics property. The ARN arn:aws:sns:MyTopic also lacks a Region and account ID. Supply the complete topic ARN and Topics before deployment.
Publishing grant to a wildcard principal
AWSTemplateFormatVersion: '2010-09-09'
Description: ''
Resources:
snsPolicy:
Type: AWS::SNS::TopicPolicy
Properties:
PolicyDocument:
Statement:
- Sid: MyTopicPolicy
Effect: Allow
Principal: "*"
Action:
- sns:Publish
Resource: arn:aws:sns:MyTopic
The first statement sets no limit on the publisher and includes no conditions.
Incomplete principal specification
AWSTemplateFormatVersion: '2010-09-09'
Description: ''
Resources:
snsPolicy:
Type: AWS::SNS::TopicPolicy
Properties:
PolicyDocument:
Statement:
- Sid: MyTopicPolicy
Effect: Allow
Principal: "otherPrincipal"
Action:
- sns:Publish
Resource: arn:aws:sns:MyTopic
In the second statement, replace otherPrincipal with a valid principal for the publishing account, role or service.