Description
This queue policy permits both sending and receiving. With Principal: "*", callers beyond your intended applications may get both permissions, subject to conditions and explicit denies.
Potential impact
An unintended caller could add work to the queue or read message bodies.
Remediation
Specify the queue ARN and the approved principals. Give each producer or consumer only its required actions. When delegating to another account, check which callers its IAM policies authorize.
Examples
The second excerpt limits both actions to account 111122223333. To deploy either excerpt, supply the target queue URL in Queues and use the same queue’s ARN in Resource.
Before
yaml
Resources:
SampleSQSPolicy:
Type: AWS::SQS::QueuePolicy
Properties:
PolicyDocument:
Statement:
- Action:
- SQS:SendMessage
- SQS:ReceiveMessage
Effect: Allow
Resource: arn:aws:sqs:us-east-2:444455556666:queue2
Principal: "*"
After
yaml
Resources:
SampleSQSPolicy:
Type: AWS::SQS::QueuePolicy
Properties:
PolicyDocument:
Statement:
- Action:
- SQS:SendMessage
- SQS:ReceiveMessage
Effect: Allow
Resource: arn:aws:sqs:us-east-2:444455556666:queue2
Principal:
AWS:
- "111122223333"