Deleting a RoleBinding Is Not Kubernetes Revocation
Illustrative scenario, not a reported incident: a team retires an internal agent and deletes its RoleBinding. Access looks gone, but the service account may still have the same permissions through another grant. Kuberne
Illustrative scenario, not a reported incident: a team retires an internal agent and deletes its RoleBinding. Access looks gone, but the service account may still have the same permissions through another grant.
Kubernetes RBAC combines grants additively. A RoleBinding grants permissions to its subjects in the binding's namespace, even when it references a ClusterRole. A ClusterRoleBinding grants the referenced role's permissions cluster-wide. Removing one binding can therefore leave equivalent access through another grant. See the Kubernetes RBAC documentation.
Steps
- Name the exact subject under review, including its namespace if it is a service account. A similarly named subject is not the same subject.
- Snapshot effective permissions before editing. Proposed practice: use the cluster's authorization review facility to ask whether that subject can perform each verb/resource pair you care about in the relevant namespace. Record the answers as the baseline. This checks one subject, not every identity.
- Enumerate grants that name the subject. Inspect namespace-scoped and cluster-scoped bindings; do not assume a namespace-scoped view is complete. Record each binding's namespace, referenced role, and subject.
- Write the intended end state before changing anything. "No verbs" and "read-only on two resources" produce different diffs.
- Apply the removals, then repeat the authorization review and diff it against the baseline.
Test
Input: the subject string, namespace, and verb/resource pairs from step 4. Observation: the post-change review should match the intended end state. If it is unchanged, at least one remaining binding still names the subject, or the review used a different subject/namespace. If it shows fewer permissions than intended, stop and check whether the change removed a required grant. If it shows permissions absent from the baseline, you are not inspecting the subject you think you are; redo step 1.
An RBAC diff is evidence only about the subject you reviewed. If the workload authenticates as another identity or through a broker, check that revocation point separately. Do not infer already-issued credential lifetime from a binding diff; verify it through the authentication mechanism in use.
This article was created with AI assistance.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.