Revoking One Role Is Not Revoking Access
Suppose a team removes a RoleBinding for a departing service account, then asks whether it can still read shared AI prompts. The question is what grants remain. Kubernetes RBAC is additive: permissions come from grants;
Suppose a team removes a RoleBinding for a departing service account, then asks whether it can still read shared AI prompts. The question is what grants remain. Kubernetes RBAC is additive: permissions come from grants; no binding subtracts. The Kubernetes RBAC documentation states that a RoleBinding grants its role's permissions to its subjects in the binding's namespace, even when the role is a ClusterRole. A ClusterRoleBinding grants those permissions cluster-wide. Removing one binding can leave equivalent access through another grant.
Revocation is a union check
Effective access is the union of every applicable binding. A second binding can grant the same verb and resource in the same scope; a group subject carries it to every member; a ClusterRoleBinding can cover namespaces a RoleBinding does not. Deleting one binding is not proof: recompute the union without it and check that no remaining path covers the target.
Steps: audit the union before you revoke
- Enumerate every binding whose subjects include the identity, directly or through groups, including RoleBindings and ClusterRoleBindings.
- Resolve each role reference into rules: verbs, resources, names, and non-resource URLs.
- Record scope: namespace for a RoleBinding; all namespaces for a ClusterRoleBinding.
- Remove the binding, recompute the union, and compare. If any path still covers the target, access remains.
Test: observe the remaining union
This is a proposed check, not a claim it was run. Inputs: subject identity, target verb and resource, namespaces of interest, and the audit list. Observe authorization for each namespace and cluster scope, including group subjects. Expected: after revocation, no remaining path grants the target verb on the target resource in the intended scopes. If a path remains, identify its binding, scope, and owner; remove it if unintentional. If the result is ambiguous, or the method omits group or namespace scope, record it as unverified.
Limits
RBAC is one layer. Cloud IAM, application ACLs, cached tokens, and static API keys sit outside it. Rotating a key differs from editing a binding. Do both, and repeat the union check on a schedule.
This article was created with AI assistance.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.