More Info:
Wildcards in verbs, resources, or apiGroups grant overly broad permissions that violate least privilege. Replace them with explicitly scoped objects and actions.Risk Level
CriticalAddress
SecurityCompliance Standards
- CIS EKS
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List Roles/ClusterRoles using wildcards (run on any machine with kubectl access):
-
For each offending Role/ClusterRole, export its definition for review/edit (example for a ClusterRole named
example-role): -
Manually edit the exported file to replace wildcards with explicit values (run on the machine where the file is saved):
- Replace
verbs: ["*"]orverbs: - "*"with only the needed verbs, e.g.: - Replace
resources: ["*"]orresources: - "*"with specific resources, e.g.: - Replace
apiGroups: ["*"]orapiGroups: - "*"with required API groups, e.g.: - Remove any rule entries that are not actually needed. Save the file.
- Replace
-
Apply the edited Role/ClusterRole back to the cluster (run on any machine with kubectl access):
- If these objects are managed by GitOps or other IaC, update the source manifests similarly (edit the Role/ClusterRole definitions in your Git/IaC repo to match the changes above and run your usual deployment pipeline) to prevent them from being reverted.
-
Verify no Roles/ClusterRoles still use wildcards (run on any machine with kubectl access):
Using kubectl
Using kubectl
On any machine with kubectl access:For a single ClusterRole, inspect details:Example change (illustrative only; adjust to your requirements):Save and exit the editor to apply.Apply:Repeat for each ClusterRole using wildcards.
- Identify ClusterRoles using wildcards
- Edit an existing ClusterRole to remove wildcards
* in verbs, resources, and apiGroups with explicit entries based on actual needs.Interactive edit:- Apply a declarative manifest (preferred for GitOps/IaC-managed roles)
kubectl edit.Example manifest snippet:- Verification
Automation
Automation

