Skip to content

CMP-4605: Guard kubevirt NAD rules against NADs without a spec - #15020

Open
Vincent056 wants to merge 1 commit into
ComplianceAsCode:masterfrom
Vincent056:fix-nad-spec-guard
Open

CMP-4605: Guard kubevirt NAD rules against NADs without a spec#15020
Vincent056 wants to merge 1 commit into
ComplianceAsCode:masterfrom
Vincent056:fix-nad-spec-guard

Conversation

@Vincent056

Copy link
Copy Markdown
Contributor

Description

kubevirt-localnet-vlan-required and kubevirt-bridge-mac-spoof-filtering guard only has(n.spec.config). A NetworkAttachmentDefinition with no spec at all is legitimate (e.g. the istio-cni NAD), but it makes has(n.spec.config) raise no such key: spec at evaluation time — and the scanner maps missing-key errors to FAIL, so both rules false-FAIL on any cluster carrying such a NAD. Observed during CIS OCP-Virt profile validation on a 4.22 + Virtualization cluster.

Fix

Prepend !has(n.spec) || to both expressions, and add a spec-less NAD regression fixture to both cel/tests/cases.yaml.

Testing

Via celctl (the Compliance Operator's scanner engine): the new fixture fails against the unfixed expressions (5/6 and 6/7 cases) and 6/6 / 7/7 cases pass with the fix.

🤖 Generated with Claude Code

kubevirt-localnet-vlan-required and kubevirt-bridge-mac-spoof-filtering
guarded only has(n.spec.config). A NetworkAttachmentDefinition with no
spec at all is legitimate (e.g. the istio-cni NAD), but it makes
has(n.spec.config) raise 'no such key: spec' at evaluation time, and
the scanner maps missing-key errors to FAIL - so both rules false-FAIL
on any cluster carrying such a NAD.

Prepend !has(n.spec) to both expressions and add a spec-less NAD
regression fixture: it fails 5/6 and 6/7 against the unfixed
expressions and all cases pass with the fix (celctl, the operator's
scanner engine).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown

@Vincent056: The following tests 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-platform-compliance 0f400ec link true /test e2e-aws-openshift-platform-compliance
ci/prow/e2e-aws-openshift-node-compliance 0f400ec 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant