CMP-4426: Add HyperConverged CEL rules for CIS OCP-Virt 1.4/1.6/1.7 - #14917
Conversation
|
Skipping CI for Draft Pull Request. |
a03687f to
363faec
Compare
|
Hey Vincent, I reviewed the PR and it looks good. I think it's ready to merge. /lgtm |
9ec4e77 to
d9977f7
Compare
rhmdnd
left a comment
There was a problem hiding this comment.
Overall looks good. Minor recommendations on test name improvement can be addressed in a follow up. Primary concern is if we can simplify the HyperConvergeds resource lookup by removing it from the expression (that would also remove testing surface area from each rule).
3b222b1 to
73ede53
Compare
73ede53 to
b162a96
Compare
…rt 1.4) Automated check that the downwardMetrics feature gate is disabled on the kubevirt-hyperconverged resource. Exposing host metrics to guests leaks node-level information across the isolation boundary. Absent or false is compliant (disabled by default); only an explicit true fails. Fixtures: 4 cases via celctl (cel-go, the scanner engine) - 4/4 pass; lint OK; live on OCP 4.22 + CNV: PASS. Added to cis-vm-extension profile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Automated check that Kernel Samepage Merging is disabled. KSM is a known
cross-VM memory side channel; it is enabled by configuring a
nodeLabelSelector under .spec.ksmConfiguration on the kubevirt-hyperconverged
resource.
IMPORTANT semantics, verified empirically on a stock OpenShift
Virtualization install: the HyperConverged operator serves
'ksmConfiguration: {}' BY DEFAULT and this does NOT enable KSM
(/sys/kernel/mm/ksm/run stays 0 on the nodes). The rule therefore treats
absent, null and empty-object ksmConfiguration as compliant, and fails only
when a nodeLabelSelector is present (an empty selector selects all nodes).
A presence-only check would false-positive on every default install.
Fixtures: 5 cases via celctl - 5/5 pass; lint OK; live on a stock cluster
(HCO serving ksmConfiguration {}): PASS. Added to cis-vm-extension profile.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t 1.6) Automated check that the kubevirt-hyperconverged resource carries none of the unsupported jsonpatch annotations (kubevirt.kubevirt.io/jsonpatch, containerizeddataimporter.kubevirt.io/jsonpatch, networkaddonsconfigs.kubevirt.io/jsonpatch, ssp.kubevirt.io/jsonpatch) that patch operand resources outside the supported API. Environments with an authorized patch waive the rule. Fixtures: 5 cases via celctl - 5/5 pass; lint OK; live on OCP 4.22 + CNV: PASS. Added to cis-vm-extension profile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Requested by rhmdnd: clear prose names (e.g. 'missing HyperConverged configuration is non-compliant') instead of arrow style with parenthetical qualifiers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b162a96 to
1308913
Compare
|
@Vincent056: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
Adds three CEL rules for the CIS OCP-Virt benchmark's HyperConverged controls, one commit per Jira:
kubevirt-downward-metrics-disabled— downwardMetrics feature gate off (absent/false compliant)kubevirt-ksm-disabled— anyksmConfigurationfails (an empty selector enables KSM on ALL nodes; KSM is a cross-VM memory side channel)kubevirt-no-jsonpatch-annotations— no unsupported kubevirt/CDI/network-addons/SSP jsonpatch annotationsAll three read the
hyperconvergedslist (same input as the existing rules, no new RBAC needed) and are added to thecis-vm-extensionprofile selections.Testing
Each rule ships
cel/tests/cases.yamlfixtures with compliant and non-compliant cases, evaluated throughcelctl(the compliance-operator scanner engine):celctl cac lint+cac test: 13/13 cases passcac liveAND a full operator scan (ProfileBundle with celContentFile → ScanSettingBinding) — downward-metrics PASS, jsonpatch PASS, and ksm-disabled correctly reports FAIL on a cluster whose HCO servesksmConfiguration: {}(KubeVirt treats the empty selector as enable-everywhere)🤖 Generated with Claude Code