Skip to content

CMP-4426: Add HyperConverged CEL rules for CIS OCP-Virt 1.4/1.6/1.7 - #14917

Merged
rhmdnd merged 4 commits into
ComplianceAsCode:masterfrom
Vincent056:cmp-4426-hco-cel-rules
Aug 7, 2026
Merged

CMP-4426: Add HyperConverged CEL rules for CIS OCP-Virt 1.4/1.6/1.7#14917
rhmdnd merged 4 commits into
ComplianceAsCode:masterfrom
Vincent056:cmp-4426-hco-cel-rules

Conversation

@Vincent056

Copy link
Copy Markdown
Contributor

Summary

Adds three CEL rules for the CIS OCP-Virt benchmark's HyperConverged controls, one commit per Jira:

Commit CIS Rule
CMP-4426 1.4 kubevirt-downward-metrics-disabled — downwardMetrics feature gate off (absent/false compliant)
CMP-4427 1.7 kubevirt-ksm-disabled — any ksmConfiguration fails (an empty selector enables KSM on ALL nodes; KSM is a cross-VM memory side channel)
CMP-4428 1.6 kubevirt-no-jsonpatch-annotations — no unsupported kubevirt/CDI/network-addons/SSP jsonpatch annotations

All three read the hyperconvergeds list (same input as the existing rules, no new RBAC needed) and are added to the cis-vm-extension profile selections.

Testing

Each rule ships cel/tests/cases.yaml fixtures with compliant and non-compliant cases, evaluated through celctl (the compliance-operator scanner engine):

  • celctl cac lint + cac test: 13/13 cases pass
  • Live cluster (OCP 4.22 + CNV): cac live AND a full operator scan (ProfileBundle with celContentFile → ScanSettingBinding) — downward-metrics PASS, jsonpatch PASS, and ksm-disabled correctly reports FAIL on a cluster whose HCO serves ksmConfiguration: {} (KubeVirt treats the empty selector as enable-everywhere)

🤖 Generated with Claude Code

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Jul 23, 2026
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@abushkin-redhat

Copy link
Copy Markdown
Collaborator

Hey Vincent,

I reviewed the PR and it looks good. I think it's ready to merge.

/lgtm

@jan-cerny jan-cerny added the OpenShift OpenShift product related. label Jul 28, 2026
@Vincent056
Vincent056 force-pushed the cmp-4426-hco-cel-rules branch 2 times, most recently from 9ec4e77 to d9977f7 Compare August 4, 2026 15:41
Comment thread applications/openshift-virtualization/kubevirt-ksm-disabled/cel/tests/cases.yaml Outdated

@rhmdnd rhmdnd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@rhmdnd rhmdnd added the CIS CIS Benchmark related. label Aug 5, 2026
@Vincent056
Vincent056 force-pushed the cmp-4426-hco-cel-rules branch from 3b222b1 to 73ede53 Compare August 5, 2026 18:15

@rhmdnd rhmdnd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Comment thread applications/openshift-virtualization/kubevirt-no-jsonpatch-annotations/rule.yml Outdated
@Vincent056
Vincent056 force-pushed the cmp-4426-hco-cel-rules branch from 73ede53 to b162a96 Compare August 6, 2026 20:27
Vincent056 and others added 4 commits August 7, 2026 11:24
…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>
@Vincent056
Vincent056 force-pushed the cmp-4426-hco-cel-rules branch from b162a96 to 1308913 Compare August 7, 2026 18:24
@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown

@Vincent056: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-openshift-node-compliance 1308913 link false /test e2e-aws-openshift-node-compliance

Full PR test history. Your PR dashboard.

Details

Instructions 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.

@rhmdnd rhmdnd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@rhmdnd rhmdnd added this to the 0.1.82 milestone Aug 7, 2026
@rhmdnd
rhmdnd merged commit fb3e17a into ComplianceAsCode:master Aug 7, 2026
70 of 73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CIS CIS Benchmark related. OpenShift OpenShift product related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants