For the complete documentation index, see llms.txt. This page is also available as Markdown.
Cortex CloudApplication Security

Wildcard use is not minimized in Roles and ClusterRoles misconfiguration detected in code

Rule Details

Cortex AppSec Rule ID

APPSEC_K8S_49

Category - Subcategory

Kubernetes - Access Control

Provider

OTHER

Severity

MEDIUM

Framework

Helm, Kubernetes, Kustomize, Terraform, Terraform Plan

Impact

In Kubernetes, roles and ClusterRoles are used to define the permissions that are granted to users, service accounts, and other entities in the cluster. Roles are namespaced and apply to a specific namespace, while ClusterRoles are cluster-wide and apply to the entire cluster. When you define a role or ClusterRole, you can use wildcards to specify the resources and verbs that the role applies to. For example, you might specify a role that allows users to perform all actions on all resources in a namespace by using the wildcard "*" for the resources and verbs. However, using wildcards can be a security risk because it grants broad permissions that may not be necessary for a specific role. If a role has too many permissions, it could potentially be abused by an attacker or compromised user to gain unauthorized access to resources in the cluster.

How to Fix

[source,go]

resource "kubernetes_cluster_role" "pass" { metadata { name = "terraform-example" }

rule { api_groups = [""] resources = ["namespaces", "pods"] verbs = ["get", "list", "watch"] }

Last updated

Was this helpful?