KSV046 ("Manage all resources") match is too broad #7799
Replies: 1 comment
-
hi @evankanderson - while I agree with your reasoning, the check was written based on the CIS benchmark spec which doesn't actually make any mention of
In the link you shared, I couldn't find anything specifically about So I'd like to discuss this and understand it a little more. |
Beta Was this translation helpful? Give feedback.
-
Description
https://avd.aquasec.com/misconfig/kubernetes/general/avd-ksv-0046/ reports that a ClusterRole with
resources = ["*"]
has permission to manage all resources:However, ClusterRole
rules
are required to have anapiGroups
field; if the apiGroups do not contain""
, then permissions are granted on some other API resource (for example, as suggested by Kubernetes user-facing roles as done here: https://github.com/knative/serving/blob/main/config/core/200-roles/clusterrole-namespaced.yaml#L15-L58Desired Behavior
I'd expect KSV046 to only fire if the default (
""
) apiGroup is in the ClusterRole's rule.Actual Behavior
The rule fires with a
CRITICAL
severity regardless, which makes it harder to create these roles for extension APIs that don't ship them.Reproduction Steps
────────────────────────────────────────
CRITICAL: ClusterRole 'envoy-gateway-namespaced-view' shouldn't manage all resources
════════════════════════════════════════
Full control of the cluster resources, and therefore also root on all nodes where workloads can run and has access to all pods, secrets, and data.
See https://avd.aquasec.com/misconfig/ksv046
────────────────────────────────────────
eng-debug.yaml:124-126
────────────────────────────────────────
124 ┌ - apiGroups: ["gateway.networking.k8s.io", "gateway.envoyproxy.io"]
125 │ resources: ["*"]
126 └ verbs: ["get", "list", "watch"]
────────────────────────────────────────
Target
Filesystem
Scanner
Misconfiguration
Output Format
Template
Mode
Standalone
Debug Output
N/A -- using the `trivy-action` on PRs.
Operating System
GitHub Actions
Version
Checklist
trivy clean --all
Beta Was this translation helpful? Give feedback.
All reactions