rules:
- id: aws-athena-client-can-disable-workgroup-encryption
  patterns:
  - pattern: |
      resource "aws_athena_workgroup" $ANYTHING {
        ...
        configuration {
          ...
          enforce_workgroup_configuration = false
          ...
          result_configuration {
            ...
            encryption_configuration {
              ...
            }
            ...
          }
          ...
        }
        ...
      }
  message: The Athena workgroup configuration can be overriden by client-side settings.
    The client can make changes to disable encryption settings. Enforce the configuration
    to prevent client overrides.
  languages:
  - hcl
  severity: WARNING
  metadata:
    category: security
    technology:
    - terraform
    - aws
    owasp:
    - A03:2017 - Sensitive Data Exposure
    - A04:2021 - Insecure Design
    cwe:
    - 'CWE-311: Missing Encryption of Sensitive Data'
    references:
    - https://owasp.org/Top10/A04_2021-Insecure_Design
    subcategory:
    - audit
    likelihood: LOW
    impact: MEDIUM
    confidence: LOW
