Skip to main content

More Info:

Roles that grant get, list or watch on Secret objects expose sensitive credentials. Access to Secrets should be minimized across the cluster.

Risk Level

High

Address

Security

Compliance Standards

  • CIS GKE

Triage and Remediation

Remediation

Manual Steps

  1. Identify all Roles with sensitive Secret access
    • Run on: any machine with kubectl access
    • Review each Role to understand which subjects (RoleBindings) depend on it and what applications/functions they support:
  2. Decide which Roles truly need Secret access
    • For each Role found, determine:
      • Does the workload actually need to read Secret contents (e.g., a controller that manages Secrets)?
      • Or is Secret reference in Pod specs (which does not require RBAC get/list/watch) sufficient?
    • Mark Roles as:
      • “Keep read to secrets” (strictly required), or
      • “Can be removed or narrowed” (preferred).
  3. Remove unnecessary Secret rules from a Role
    • Run on: any machine with kubectl access
    • Export the Role manifest, edit locally, and remove secrets from resources and/or remove get, list, watch from verbs where not strictly needed:
    • Edit /tmp/role-<namespace>-<role-name>.yaml:
      • In .rules[], delete secrets from resources: or delete the entire rule if only for secrets.
      • If some verbs are truly required, keep only the minimal needed subset.
    • Apply the updated Role:
  4. Split roles when only some subjects need Secret access
    • If some workloads bound to the Role require Secret access and others do not:
      • Create a new, narrow Role only for those workloads:
      • Update RoleBindings so only the specific service accounts/users that truly need Secret access bind to <new-name>, and others bind to a Role without Secret permissions:
        Adjust .roleRef.name and/or split into multiple RoleBindings as needed.
  5. Re-test workloads depending on modified Roles
    • Run on: any machine with kubectl access
    • For each namespace where Roles were changed, check Pods for errors indicating missing Secret access:
    • If a workload fails due to required Secret reads, minimally re-add the specific verbs it needs (e.g., only get on specific secrets via resourceNames if appropriate).
  6. Verification (no Roles with unnecessary Secret read access)
    • Run on: any machine with kubectl access
Verification: