Skip to content

Conversation

@cx-andre-pereira
Copy link
Contributor

@cx-andre-pereira cx-andre-pereira commented Nov 24, 2025

Reason for Proposed Changes

  • Currently there is no query to ensure a "azurerm_storage_account" resource has CMK encryption enabled.

  • Quoting CIS_Microsoft_Azure_Foundations_Benchmark_v5.0.0 page 203: "By default in Azure, data at rest tends to be encrypted using Microsoft-managed keys. If your organization wants to control and manage encryption keys for compliance and defense-in-depth, customer-managed keys can be established. Configuring the storage account with the activity log export container to use CMKs provides additional confidentiality controls on log data, as a given user must have read permission on the corresponding storage account and must be granted decrypt permission by the CMK. While it is possible to automate the assessment of this recommendation, the assessment status for this recommendation remains 'Manual' due to ideally limited scope. The scope of application—which workloads CMK is applied to—should be carefully considered to account for organizational capacity and targeted to workloads with specific need for CMK."

  • Additionally the "Audit from Azure CLI" section of the CIS Benchmark shows that not all "azurerm_storage_account" resources are to be flagged, only the ones associated with a "azurerm_monitor_diagnostic_setting" should be targeted.

  • To enable CMK encryption for a storage account there are 2 possibilities:

Proposed Changes

  • Implemented the missing query.
  • The query will flag a given"azurerm_storage_account" resource that is associated with a "azurerm_monitor_diagnostic_setting" resource, if it does not set the "customer_managed_key" field and has no association with any "azurerm_storage_account_customer_managed_key" resource within the same project.

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions bot added feature New feature query New query feature labels Nov 24, 2025
@github-actions
Copy link
Contributor

kics-logo

KICS version: v2.1.13

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@github-actions github-actions bot added terraform Terraform query azure PR related with Azure Cloud labels Nov 24, 2025
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review November 24, 2025 15:53
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner November 24, 2025 15:53
…stomer_managed_keys' of https://github.com/Checkmarx/kics into AST-120693_67_ensure_critical_data_is_encrypted_with_customer_managed_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure PR related with Azure Cloud feature New feature query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant