rules:
- id: s3-public-read-bucket
  patterns:
  - pattern-either:
    - pattern: acl = "public-read"
    - pattern: acl = "authenticated-read"
  - pattern-not-inside: |
      resource "aws_s3_bucket" "..." {
        ...
        website { ... }
        ...
      }
  languages:
  - hcl
  severity: WARNING
  message: S3 bucket with public read access detected.
  metadata:
    cwe:
    - 'CWE-200: Exposure of Sensitive Information to an Unauthorized Actor'
    references:
    - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket#acl
    - https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
    category: security
    technology:
    - terraform
    - aws
    owasp:
    - A01:2021 - Broken Access Control
    cwe2021-top25: true
    subcategory:
    - audit
    likelihood: LOW
    impact: LOW
    confidence: LOW
