Skip to content

Conversation

@cx-andre-pereira
Copy link
Contributor

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

Reason for Proposed Changes

  • Currently there is no query to ensure that resources of type "azurerm_role_assignment" that target a "azurerm_container_registry" resource in their "scope" field are restricted to read permissions.

  • Quoting CIS_Azure_Kubernetes_Service_(AKS)_Benchmark_V1.8.0 page 119: "5.1.3 Minimize cluster access to read-only for Azure Container Registry (ACR) (Manual) ... The Cluster Service Account does not require administrative access to Azure ACR, only requiring pull access to containers to deploy onto Azure AKS. Restricting permissions follows the principles of least privilege and prevents credentials from being abused beyond the required role".

Proposed Changes

  • Implemented the missing query.

  • The query will flag a given "azurerm_role_assignment" resource if it sets a "scope" field to a value containing "azurerm_container_registry." and sets either :

  • These values were based on official documentation proving "AcrPull" allows target resource to "Pull artifacts from a container registry.", that is to say it guarantees read permissions.

  • NOTE this implementation might be incomplete, the CIS entry is very sparse on possible implementation details but it does reference this documentation, this plus the title of the entry were my main leads to figure out that the "azurerm_role_assignment" and "azurerm_container_registry" would be a major part of the implementation but relevant checks could be missing.

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions bot added feature New feature query New query feature azure PR related with Azure Cloud labels Nov 25, 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 kubernetes Kubernetes query labels Nov 25, 2025
@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review November 25, 2025 18:02
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner November 25, 2025 18:02
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.

1 participant