More Info:
Broad get, list and watch access to secret objects allows credentials to be exfiltrated. Restrict these permissions to only the workloads and users that require them.Risk Level
HighAddress
SecurityCompliance Standards
- CIS OKE
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List all ClusterRoles with secret access
- Run on: any machine with
kubectlaccess - Command:
- This identifies ClusterRoles that can
get,list, orwatchsecrets.
- Run on: any machine with
-
Inspect each flagged ClusterRole’s secret permissions in detail
- Run on: any machine with
kubectlaccess - For each ClusterRole name from step 1:
- Review which
secretsresources and verbs are granted, and whether any*verbs or*resources are present.
- Run on: any machine with
-
Map ClusterRoles to subjects via ClusterRoleBindings
- Run on: any machine with
kubectlaccess - For each ClusterRole from step 1:
- Use this to determine which users, groups, or service accounts receive secret access and in which namespaces they operate.
- Run on: any machine with
-
Decide least-privilege requirements per subject
- For each subject from step 3, answer:
- Does it truly need
get/list/watchonsecrets? - If yes, is cluster-wide access required, or only specific namespaces?
- Can access be narrowed to specific secret names (via
resourceNames) or limited togetonly instead oflist/watch?
- Does it truly need
- Document which permissions are justified and which should be removed or scope-reduced.
- For each subject from step 3, answer:
-
Adjust ClusterRoles and bindings to enforce least privilege
- Run on: any machine with
kubectlaccess - To remove or narrow secret access from a ClusterRole:
- In the editor, either:
- Remove the entire rule that includes
secrets, or - Remove
secretsfrom.rules[].resources, or - Remove unnecessary verbs (
list,watch, or*) from.rules[].verbs, or - Add
.resourceNamesto restrict to specific secret names if appropriate.
- Remove the entire rule that includes
- In the editor, either:
- If cluster-scoped access is not needed, create namespace-scoped
Roles andRoleBindings instead and then remove the corresponding ClusterRoleBinding(s).
- Run on: any machine with
-
Re-verify effective secret access after changes
- Run on: any machine with
kubectlaccess - Re-run the detection query:
- Confirm that only the ClusterRoles you explicitly decided to keep with secret access remain, and that their definitions match your least-privilege decisions from step 4.
- Run on: any machine with
Using kubectl
Using kubectl
- Any ClusterRole name printed here has at least one rule granting
get,list, orwatchon thesecretsresource. - Each such role must be manually reviewed to decide if that level of access is truly required.
- Problematic examples:
resources: ["*"]combined withverbs: ["*"]or includingget,list,watch.resources: ["secrets"]withverbsincluding any ofget,list,watchwhere the role is used by broad subjects (e.g., all service accounts in a namespace).
- Safer patterns:
- Roles scoped to specific non-secret resources only.
- Roles that only use non-read verbs for secrets (e.g., rare cases of
createorupdatefor a tightly scoped automation, though these also warrant review).
- Prints:
<clusterrolebinding-name> <subject-kind:namespace:name,...> - Problematic indicators:
- Bindings to
system:authenticated,system:serviceaccounts, orsystem:serviceaccounts:<namespace>when the role has secret read access. - Bindings to many generic service accounts that don’t clearly need secret read access.
- Bindings to
- Roles with secret read verbs in namespaces where many workloads run, especially paired with broad RoleBindings.
- RoleBindings that attach secret-reading Roles to:
- Default service accounts (e.g.,
ServiceAccount:<namespace>:default). - Large groups or all service accounts in a namespace.
- Default service accounts (e.g.,
- Shows effective permissions; lines mentioning
secretswithget,list, orwatchindicate that the associated user/group/service account can read secrets. - Use this as a cross-check to focus your manual review.
Automation
Automation

