You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nothing detects the pod-security exception drifting from the mutation scope it claims to mirrorΒ #3224
#2824 exists because two scopes that must agree drifted apart silently: pod-security-mutations exempted controls cluster-wide, while the Kyverno mutation it names as its
compensating control β add-security-context β excludes twelve namespaces. Nothing detected that,
and nothing would detect it happening again.
The narrowing in #2824 makes the two agree today: the exception's NotIn values are now exactly the
mutation's excluded namespace set (verified set-equal, 12 = 12, when that change landed). But that
agreement is held together by a code comment, and the failure mode is silent in both directions:
a namespace removed from the mutation's exclusions but left in the exception's NotIn β
controls stay enforced where the mutation now runs, producing findings that are not real gaps.
Neither shows up as a failing check. Both read as compliance.
Expected behaviour
A check fails when the exception's NotIn namespace set stops matching the mutation rules'
excluded-namespace set, naming the specific namespaces that differ and which side they are on.
Smallest useful change
A script in scripts/ invoked from CI that reads both files structurally (yq, not grep) and
diffs the two sets. It needs no cluster and no scanner β both inputs are in the tree.
Two details worth pinning, because a naive implementation gets them wrong:
add-security-context carries several rules, and only add-pod-security-context / add-container-security-context exclude the twelve. add-imageuid-pod-security-context matches
cert-manager, keda and opencost by name and supplies the fields there β so those three are
correctly not in the exception's NotIn. Read the match blocks, not only the exclusions.
The guard must fail closed: an unparseable file, a missing rule, or a NotIn expression that has
moved must be an error, not an empty set compared against an empty set.
Acceptance criteria
CI fails when the two sets diverge, in either direction, naming the differing namespaces.
The guard has a RED proof: a fixture with a namespace added on one side only fails it.
#3085 - security(kubescape): except the operator-bundle RBAC the CI scan actually sees [merged] #3142 - docs(kubescape): correct the controller-rbac migration guidance [merged] #3212 - docs(kubescape): record the keep decision for the three unfalsifiable controls [merged] #3210 - security(k8s): disposition vendored KubeVirt and CDI operator RBAC as a class [merged] #3203 - security(vault-backup): disposition the last two CKV_K8S_40 findings as one deferred exception [merged]
π Issue Planner
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
π§ͺ Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
π¬ Have feedback or questions? Drop into our discord!
Baseline for this issue, measured 2026-08-19 while sizing C-0211 (#3217): the two scopes are
currently in sync, so what is missing is the detection, not a fix.
add-security-context's add-container-security-context exclusions and pod-security-mutations' namespaceSelectorNotIn values are the same twelve namespaces, sorted and compared:
Compare against add-container-security-context, not add-pod-security-context. The two rules
have different exclusion sets β the pod-level rule additionally excludes cert-manager, keda, opencost and tofu-controller-created pods, which are handled by add-imageuid-pod-security-context instead. A detector keyed on the pod-level rule would report
drift that is not drift.
Activity
coderabbitai commentedon Aug 18, 2026
π Related PRs
#3085 - security(kubescape): except the operator-bundle RBAC the CI scan actually sees [merged]
#3142 - docs(kubescape): correct the controller-rbac migration guidance [merged]
#3212 - docs(kubescape): record the keep decision for the three unfalsifiable controls [merged]
#3210 - security(k8s): disposition vendored KubeVirt and CDI operator RBAC as a class [merged]
#3203 - security(vault-backup): disposition the last two CKV_K8S_40 findings as one deferred exception [merged]
π Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.π§ͺ Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:π¬ Have feedback or questions? Drop into our discord!
devantler commentedon Aug 19, 2026
Baseline for this issue, measured 2026-08-19 while sizing C-0211 (#3217): the two scopes are
currently in sync, so what is missing is the detection, not a fix.
add-security-context'sadd-container-security-contextexclusions andpod-security-mutations'namespaceSelectorNotInvalues are the same twelve namespaces, sorted and compared:Two notes for whoever builds the detector:
add-container-security-context, notadd-pod-security-context. The two ruleshave different exclusion sets β the pod-level rule additionally excludes
cert-manager,keda,opencostand tofu-controller-created pods, which are handled byadd-imageuid-pod-security-contextinstead. A detector keyed on the pod-level rule would reportdrift that is not drift.
pod-security-mutations-unscopeddeliberately has nomatch:block and must not be comparedthis way; it is cluster-wide by design while C-0013 (Six flux-system controllers fail C-0013 on a missing runAsGroup, blocking the C-0013 narrowingΒ #3223) and C-0211 (security(kubescape): C-0211's residual population behind the pod-security exception is unsized and unownedΒ #3217) remain unresolved.
chore: agent-claim #3224 nonce=faa6c3d02d82f239fae55726f08fedeb