Skip to content

Files

Latest commit

 

History

History
53 lines (41 loc) · 985 Bytes

aws-sqs-no-wildcards-in-policy-documents.md

File metadata and controls

53 lines (41 loc) · 985 Bytes

Pattern: Use of * for AWS SQS policy document

Issue: -

Description

SQS Policy actions should always be restricted to a specific set.

This ensures that the queue itself cannot be modified or deleted, and prevents possible future additions to queue actions to be implicitly allowed.

Resolution: Keep policy scope to the minimum that is required to be effective.

Examples

Example of incorrect code:

resource "aws_sqs_queue_policy" "bad_example" {
  queue_url = aws_sqs_queue.q.id

  policy = <<POLICY
{
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "*"
    }
  ]
}
POLICY
}

Example of correct code:

resource "aws_sqs_queue_policy" "good_example" {
  queue_url = aws_sqs_queue.q.id

  policy = <<POLICY
{
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "sqs:SendMessage"
    }
  ]
}
POLICY
}