terraform.azure.security.azure-dataexplorer-uses-disk-encryption.azure-dataexplorer-uses-disk-encryption

profile photo of semgrepsemgrep
Author
unknown
Download Count*

Ensure that Azure Data Explorer uses disk encryption

Run Locally

Run in CI

Defintion

rules:
  - id: azure-dataexplorer-uses-disk-encryption
    message: Ensure that Azure Data Explorer uses disk encryption
    patterns:
      - pattern: resource
      - pattern-not-inside: |
          resource "azurerm_kusto_cluster" "..." {
          ...
          enable_disk_encryption = true
          ...
          }
      - pattern-inside: |
          resource "azurerm_kusto_cluster" "..." {
          ...
          }
    metadata:
      owasp:
        - A03:2017 - Sensitive Data Exposure
      cwe:
        - "CWE-320: CWE CATEGORY: Key Management Errors"
      category: security
      technology:
        - terraform
        - azure
      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

azure-dataexplorer-uses-disk-encryption.tf

# fail
# ruleid: azure-dataexplorer-uses-disk-encryption
resource "azurerm_kusto_cluster" "example" {
    name                = "kustocluster"
    location            = azurerm_resource_group.rg.location
    resource_group_name = azurerm_resource_group.rg.name

    sku {
    name     = "Standard_D13_v2"
    capacity = 2
    }

    tags = {
    Environment = "Production"
    }
}

# fail
# ruleid: azure-dataexplorer-uses-disk-encryption
resource "azurerm_kusto_cluster" "example" {
    name                = "kustocluster"
    location            = azurerm_resource_group.rg.location
    resource_group_name = azurerm_resource_group.rg.name

    sku {
    name     = "Standard_D13_v2"
    capacity = 2
    }

    tags = {
    Environment = "Production"
    }
    enable_disk_encryption = false
}

# pass
resource "azurerm_kusto_cluster" "example" {
    name                = "kustocluster"
    location            = azurerm_resource_group.rg.location
    resource_group_name = azurerm_resource_group.rg.name

    sku {
    name     = "Standard_D13_v2"
    capacity = 2
    }
    tags = {
    Environment = "Production"
    }
    enable_disk_encryption = true
}