rules:
- id: aws-codebuild-project-unencrypted
  patterns:
  - pattern: |
      resource "aws_codebuild_project" $ANYTHING {
        ...
      }
  - pattern-not-inside: |
      resource "aws_codebuild_project" $ANYTHING {
        ...
        encryption_key = ...
        ...
      }
  message: The AWS CodeBuild Project is unencrypted. The AWS KMS encryption key protects projects in the
    CodeBuild. To create your own, create a aws_kms_key resource or use the ARN string of a key in your
    account.
  languages: [hcl]
  severity: WARNING
  metadata:
    owasp:
    - A03:2017 - Sensitive Data Exposure
    cwe:
    - 'CWE-320: CWE CATEGORY: Key Management Errors'
    technology:
    - aws
    - terraform
    category: security
    references:
    - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
    subcategory:
    - vuln
    likelihood: LOW
    impact: MEDIUM
    confidence: MEDIUM
