terraform.azure.security.azure-batchaccount-uses-keyvault-encrpytion.azure-batchaccount-uses-keyvault-encrpytion
semgrep
Author
unknown
Download Count*
License
Ensure that Azure Batch account uses key vault to encrypt data
Run Locally
Run in CI
Defintion
rules:
- id: azure-batchaccount-uses-keyvault-encrpytion
message: Ensure that Azure Batch account uses key vault to encrypt data
patterns:
- pattern: resource
- pattern-not-inside: |
resource "azurerm_batch_account" "..." {
...
key_vault_reference {
...
}
...
}
- pattern-inside: |
resource "azurerm_batch_account" "..." {
...
}
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-batchaccount-uses-keyvault-encrpytion.tf
# fail
# ruleid: azure-batchaccount-uses-keyvault-encrpytion
resource "azurerm_batch_account" "example" {
name = "testbatchaccount"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
pool_allocation_mode = "BatchService"
storage_account_id = azurerm_storage_account.example.id
tags = {
env = "test"
}
}
# pass
resource "azurerm_batch_account" "example" {
name = "testbatchaccount"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
pool_allocation_mode = "BatchService"
storage_account_id = azurerm_storage_account.example.id
key_vault_reference {
id = "test"
url = "https://test.com"
}
tags = {
env = "test"
}
}
Short Link: https://sg.run/No9p