terraform.aws.security.aws-fsx-windows-encrypted-with-cmk.aws-fsx-windows-encrypted-with-cmk

profile photo of semgrepsemgrep
Author
unknown
Download Count*

Ensure FSX Windows file system is encrypted at rest using KMS CMKs. CMKs gives you control over the encryption key in terms of access and rotation.

Run Locally

Run in CI

Defintion

rules:
  - id: aws-fsx-windows-encrypted-with-cmk
    patterns:
      - pattern: |
          resource "aws_fsx_windows_file_system" $ANYTHING {
            ...
          }
      - pattern-not-inside: |
          resource "aws_fsx_windows_file_system" $ANYTHING {
            ...
            kms_key_id = ...
            ...
          }
    message: Ensure FSX Windows file system is encrypted at rest using KMS CMKs.
      CMKs gives you control over the encryption key in terms of access and
      rotation.
    metadata:
      category: security
      technology:
        - terraform
        - aws
      owasp:
        - A03:2017 - Sensitive Data Exposure
      cwe:
        - "CWE-320: CWE CATEGORY: Key Management Errors"
      references:
        - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
      subcategory:
        - audit
      likelihood: LOW
      impact: LOW
      confidence: LOW
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]
      vulnerability_class:
        - Cryptographic Issues
    languages:
      - hcl
    severity: WARNING

Examples

aws-fsx-windows-encrypted-with-cmk.tf

resource "aws_fsx_windows_file_system" "pass" {
  active_directory_id = aws_directory_service_directory.test.id
  kms_key_id          = aws_kms_key.test1.arn
  skip_final_backup   = true
  storage_capacity    = 32
  subnet_ids          = [aws_subnet.test1.id]
  throughput_capacity = 8
}
# ruleid: aws-fsx-windows-encrypted-with-cmk
resource "aws_fsx_windows_file_system" "fail" {
  active_directory_id = aws_directory_service_directory.test.id
  skip_final_backup   = true
  storage_capacity    = 32
  subnet_ids          = [aws_subnet.test1.id]
  throughput_capacity = 8
}