Skip to main content

More Info:

Roles that grant get, list, or watch access to secrets expose sensitive data to a wider set of subjects. Restrict such access to only those workloads that require it.

Risk Level

High

Address

Security

Compliance Standards

  • CIS EKS

Triage and Remediation

Remediation

Manual Steps

  1. List Roles with secret access (run on any machine with kubectl access)
  2. Review which subjects use each Role (any kubectl machine)
    For each <NAMESPACE> <ROLE_NAME> from step 1, list RoleBindings:
    Decide which workloads or users truly require get, list, or watch on secrets.
  3. Inspect the Role rules before changing them (any kubectl machine)
    Confirm which rules grant access to secrets and whether they are needed (for example, an in‑namespace controller vs. general users).
  4. Edit the Role to remove unnecessary secret privileges (any kubectl machine)
    For each Role where secret access is not strictly required, remove get, list, and/or watch on secrets:
    In the editor:
    • Locate any rules entry where resources includes secrets.
    • Remove get, list, and watch from verbs (or, if no verbs remain, delete that entire rules item).
    • Save and exit to apply.
  5. (Optional) Split roles for least privilege (any kubectl machine)
    If only some subjects need secret access:
    • Clone the original Role, keeping only secret‑related rules:
    • Edit /tmp/<ROLE_NAME>-with-secrets.yaml:
      • Change metadata.name to something like <ROLE_NAME>-secrets.
      • Remove all non‑secret rules.
    • Update RoleBindings so only the specific workloads/users that truly require secret access bind to <ROLE_NAME>-secrets, and other subjects bind to a role without secret verbs:
  6. Verify no unintended Roles retain secrets access (any kubectl machine)
    Review any remaining Roles in this count to ensure their access is justified and documented.
On any machine with kubectl access:
  1. Identify roles with secret read access
  1. Back up each affected Role (example for namespace app-namespace, role app-role)
  1. Edit the Role to remove get, list, watch on secrets
    Interactive edit (recommended when changes are small):
In the editor, find any rule like:
Change it to remove read verbs while keeping only what is required. For example:
or, if the Role does not need any secret access, remove the entire rule block that has resources: ["secrets"].
  1. Declarative update via manifest (alternative to step 3)
    Edit the backed‑up manifest file app-role-backup.yaml, adjust the rules section as above, then apply:
  1. Repeat steps 2–4 for every Role flagged in step 1, ensuring only workloads that truly require secret read access retain get/list/watch on secrets.
  2. Verification