Skip to content

Conversation

@cx-ricardo-jesus
Copy link
Contributor

@cx-ricardo-jesus cx-ricardo-jesus commented Nov 18, 2025

Closes #

Reason for Proposed Changes

  • Currently, there is several terrraform/azure resources, that are not covered by a query that checks if their identity block is not enabled, i.e., by having a block identity defined with the type field with the values SystemAssigned or UserAssigned, or both(except for the resource of type azurerm_kubernetes_cluster that only can have one of the values at time, according to its documentation).

  • For all the resources, this case can be covered just by checking if the identity block is defined.

  • Below is a list of queries and resources supported in each one:

    • Beta - Container Group Managed Identity Disabled:
      • azurerm_container_group
    • Beta - Kubernetes Cluster Managed Identity Disabled:
      • azurerm_kubernetes_cluster
    • Beta - Container App Managed Identity Disabled
      • azurerm_container_app
    • Beta - App Service Slot Managed Identity Disabled
      • azurerm_app_service_slot
      • azurerm_linux_web_app_slot
      • azurerm_windows_web_app_slot
    • Beta - Logic App Managed Identity Disabled
      • azurerm_logic_app_standard
  • There is an exception in one of the queries from this PR, that is the Beta - Redis Cache Managed Identity Is Not Set To System Assigned, which checks if the 'System Assigned Managed Identity' is set to 'On' for Azure Redis Cache (azurerm_redis_cache).

  • This last query covers a different scenario from CIS Benchmark, that instead of checking if the type field inside the identity block is defined to SystemAssigned or UserAssigned, it only checks if the field has the value SystemAssigned.

Proposed Changes

  • Used the same implementation for all the queries and resources since, for all, just checking if the block identity is defined is enough because the field type is required and the only values that can be defined within are the ones mentioned above.
  • For the last query, there is a single policy that uses a helper function called get_res, which covers the two cases that can return a positive result. The first one occurs when the block identity is not defined, and the other one occurs when the field type is defined inside the identity block, but there is no SystemAssigned value specified within the string for this field.

I submit this contribution under the Apache-2.0 license.

@cx-ricardo-jesus cx-ricardo-jesus requested a review from a team as a code owner November 18, 2025 13:28
@github-actions github-actions bot added feature New feature query New query feature terraform Terraform query azure PR related with Azure Cloud kubernetes Kubernetes query labels Nov 18, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

kics-logo

KICS version: v2.1.18

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

Copy link
Contributor

@cx-eduardo-semanas cx-eduardo-semanas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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 kubernetes Kubernetes query query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants