More Info:
Roles that grant get, list, or watch on secrets expose sensitive credentials. Access to secrets should be limited to the workloads that genuinely need it.Risk Level
HighAddress
SecurityCompliance Standards
- CIS AKS
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List all Roles that can access Secrets
- Run on: any machine with kubectl access
This shows all Roles that reference thesecretsresource in any rule. -
Review exactly which secret permissions each Role has
- Run on: any machine with kubectl access
For each<namespace> <role-name>pair from step 1, inspect in detail:
Manually check.rulesfor:resources: ["secrets"]or includingsecretsverbscontaining any ofget,list,watch(or*)
- Run on: any machine with kubectl access
-
Determine if each Role’s secret access is justified
- For each Role from step 2, identify which subjects actually use it:
- For each ServiceAccount / user / group listed:
- Identify the workloads (Pods/Deployments/Jobs, etc.) using that ServiceAccount.
- Decide whether those workloads truly need to read Kubernetes Secrets (for example, they use
envFrom: secretRef:orsecretvolumes, or perform runtime secret reads via the API).
- For each Role from step 2, identify which subjects actually use it:
-
Adjust Roles to least privilege where secret access is not required
- Run on: any machine with kubectl access
For a Role whose subjects do not need to read Secrets, removesecrets(or*) from its rules, or removeget/list/watchonsecrets:
In the editor, update.rulesso either:resourcesno longer includessecrets, orverbsno longer includesget,list, orwatchforsecrets.
- Run on: any machine with kubectl access
-
Create replacement least-privileged Roles where needed
If a Role is shared and some subjects still require secret access while others do not:- Create a new Role without
secretsaccess: - Rebind the subjects that should not have secret access to the new Role:
In
.roleRef.name, change the Role to<new-role-name>for the appropriate subjects, or split RoleBindings so that only the intended subjects keep the original Role with secret access.
- Create a new Role without
-
Verify that Roles with secret access are now minimal and intentional
- Re-run the discovery query:
- For the remaining Roles listed, repeat step 2 quickly to confirm that:
- Only workloads that genuinely need secret read access are bound.
verbsforsecretsare limited to what is strictly necessary, typically onlyget(and rarelylist/watch).
- Re-run the discovery query:
Using kubectl
Using kubectl
/tmp/all-roles.yaml, look for rules entries where:resourcesincludessecrets(or["*"]) in combination with:- overly broad
verbs, such as["get", "list", "watch"],["*"], or many verbs where onlygetmight be needed, or none at all. - overly broad
resourceNames(omitted or["*"]), granting access to all secrets in the namespace instead of specific ones. - use in generic/system-wide Roles rather than workload-specific Roles tied to a narrow ServiceAccount.
- overly broad
- it truly needs any access to secrets at all, and
- if so, whether you can scope it down (fewer verbs, specific
resourceNames, or moving access into a more targeted Role).
Automation
Automation
- Any line listed under either:
### Roles with secret access (namespaced) ###, or### ClusterRoles with secret access (cluster-wide) ###shows a Role/ClusterRole that grantsget,list,watch, or*on thesecretsresource.
- These entries must be manually reviewed to determine whether each subject truly requires that level of access; where not required, use
kubectl edit role/kubectl edit clusterroleor manifest updates to remove or narrow these permissions.

