Description
Combining Principal: "*" and sqs:* can allow unintended callers to send, read or delete messages. Other policies, conditions and explicit denies affect access, and SQS limits which administrative actions can be delegated across accounts.
Potential impact
An unwanted message can trigger downstream work. An unintended recipient can read a message or delete it before processing.
Remediation
For an application, set Principal to its execution role ARN and allow sqs:SendMessage on the target queue ARN. For direct SNS delivery, use the service principal sns.amazonaws.com and restrict aws:SourceArn to the approved topic ARN. Grant consumers separate actions as needed. Test authorized sending and receiving and denial of unapproved requests.
Examples
Replace the sample account ID and role ARN and configure the role and application separately. Other policy statements can still grant the role additional permissions.
Before
- name: SQS 큐 생성
community.aws.sqs_queue:
name: my-queue1
region: ap-southeast-1
policy:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action: "sqs:*"
Resource: "*"
Principal: "*"
After
- name: SQS 큐 생성
community.aws.sqs_queue:
name: my-queue1
region: ap-southeast-1
policy:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action: sqs:SendMessage
Resource: arn:aws:sqs:ap-southeast-1:123456789012:my-queue1
Principal:
AWS: arn:aws:iam::123456789012:role/app-producer-role