← Back to Pull requests

CMP-3765: ocp-virt: add rule to enforce MAC spoof filtering #847

Open
stu-gott opened this pull request with 80 lines diff across 4 files
View on GitHub
stu-gott stu-gott commented on Oct 29, 2025 20:33 UTC
Author

Add rules to enforce the usage of MAC spoof filtering. This covers SRIOV devices and Network Attachment Definitions in two separate rules.

Diff: 80 lines (+79 / -1) across 4 files Reviewer: rhmdnd Review duration: 574762m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.41) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.41 · 80 lines diff across 4 files
0.41
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 5 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
88%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.263
Real PR Conversation Timeline
20 items
openshift-ci[bot] openshift-ci[bot] commented on Oct 29, 2025 20:33 UTC
Bot

Hi @stu-gott. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

<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.
</details>

openshift-ci-robot openshift-ci-robot commented on Oct 29, 2025 20:34 UTC
Contributor

@stu-gott: This pull request references CMP-3765 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.21.0" version, but no target version was set.

<details>

In response to this:

>Add rules to enforce the usage of MAC spoof filtering. This covers SRIOV devices and Network Attachment Definitions in two separate rules.

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 openshift-eng/jira-lifecycle-plugin repository.
</details>

rhmdnd rhmdnd commented on code on Oct 29, 2025 21:10 UTC
Code Review
config/samples/custom-rules/openshift-virtualization/kubevirt-macspoof-sriov.yaml:1
@@ -0,0 +1,30 @@
+apiVersion: compliance.openshift.io/v1alpha1
rhmdnd rhmdnd commented on code on Oct 29, 2025 21:10 UTC
Code Review
config/samples/custom-rules/openshift-virtualization/kubevirt-macspoof-nad.yaml:1
@@ -0,0 +1,30 @@
+apiVersion: compliance.openshift.io/v1alpha1
rhmdnd rhmdnd commented on code on Oct 29, 2025 21:11 UTC
Code Review
config/samples/custom-rules/openshift-virtualization/kubevirt-macspoof-nad.yaml:1
@@ -0,0 +1,30 @@
+apiVersion: compliance.openshift.io/v1alpha1
+kind: CustomRule
+metadata:
+  name: kubevirt-macspoof-enabled-for-nad
+  namespace: openshift-compliance
+spec:
+  title: "Macspoof Filtering Must Be Enabled for all Network Attachment Definitions"
+  id: macspoof_filtering_enabled_nad
+  description: |-
+    Mac spoof filtering is a feature that helps prevent man-in-the-middle
+    attacks by verifying the authenticity of MAC addresses in network packets.
+    By checking the MAC address of incoming packets, mac-spoof filtering can
+    help ensure that only authorized devices are able to communicate with a
+    particular device or network.
+  failureReason: |-
+    The '.spec.config.macspoofchk' field is missing or not set to true in the
+    'NetworkAttachmentDefinition' resource.
+  severity: Medium
+  checkType: Platform
+  scannerType: CEL
+  inputs:
+    - name: nadList
+      kubernetesInputSpec:
+        apiVersion: k8s.cni.cncf.io/v1
+        resource: NetworkAttachmentDefinition
+  expression: |
+    nadList.all(s,
+        has(s.spec.config.macspoofchk) &&

If this isn't defined will it default to true? If we set !has(s.spec.config.macspoofcheck) will that also be okay?

rhmdnd rhmdnd commented on Oct 29, 2025 21:11 UTC
Reviewer

Thanks for the PR - just a few comments inline!

stu-gott stu-gott commented on code on Oct 29, 2025 21:28 UTC
Code Review
config/samples/custom-rules/openshift-virtualization/kubevirt-macspoof-nad.yaml:1
@@ -0,0 +1,30 @@
+apiVersion: compliance.openshift.io/v1alpha1
+kind: CustomRule
+metadata:
+  name: kubevirt-macspoof-enabled-for-nad
+  namespace: openshift-compliance
+spec:
+  title: "Macspoof Filtering Must Be Enabled for all Network Attachment Definitions"
+  id: macspoof_filtering_enabled_nad
+  description: |-
+    Mac spoof filtering is a feature that helps prevent man-in-the-middle
+    attacks by verifying the authenticity of MAC addresses in network packets.
+    By checking the MAC address of incoming packets, mac-spoof filtering can
+    help ensure that only authorized devices are able to communicate with a
+    particular device or network.
+  failureReason: |-
+    The '.spec.config.macspoofchk' field is missing or not set to true in the
+    'NetworkAttachmentDefinition' resource.
+  severity: Medium
+  checkType: Platform
+  scannerType: CEL
+  inputs:
+    - name: nadList
+      kubernetesInputSpec:
+        apiVersion: k8s.cni.cncf.io/v1
+        resource: NetworkAttachmentDefinition
+  expression: |
+    nadList.all(s,
+        has(s.spec.config.macspoofchk) &&

This is a great hint. The OpenShift documentation is slightly ambiguous as to whether or not the default is true or false. Let me do some digging.

stu-gott stu-gott commented on code on Oct 30, 2025 11:42 UTC
Code Review
config/samples/custom-rules/openshift-virtualization/kubevirt-macspoof-nad.yaml:1
@@ -0,0 +1,30 @@
+apiVersion: compliance.openshift.io/v1alpha1
+kind: CustomRule
+metadata:
+  name: kubevirt-macspoof-enabled-for-nad
+  namespace: openshift-compliance
+spec:
+  title: "Macspoof Filtering Must Be Enabled for all Network Attachment Definitions"
+  id: macspoof_filtering_enabled_nad
+  description: |-
+    Mac spoof filtering is a feature that helps prevent man-in-the-middle
+    attacks by verifying the authenticity of MAC addresses in network packets.
+    By checking the MAC address of incoming packets, mac-spoof filtering can
+    help ensure that only authorized devices are able to communicate with a
+    particular device or network.
+  failureReason: |-
+    The '.spec.config.macspoofchk' field is missing or not set to true in the
+    'NetworkAttachmentDefinition' resource.
+  severity: Medium
+  checkType: Platform
+  scannerType: CEL
+  inputs:
+    - name: nadList
+      kubernetesInputSpec:
+        apiVersion: k8s.cni.cncf.io/v1
+        resource: NetworkAttachmentDefinition
+  expression: |
+    nadList.all(s,
+        has(s.spec.config.macspoofchk) &&

The default value is false, so the rule is written correctly I think.

openshift-ci[bot] openshift-ci[bot] commented on Jun 30, 2026 01:30 UTC
Bot

Stale PRs are closed after 21d of inactivity.

If this PR is still relevant, comment to refresh it or remove the stale label.
Mark the PR as fresh by commenting /remove-lifecycle stale.

If this PR is safe to close now please do so with /close.

/lifecycle stale

openshift-ci[bot] openshift-ci[bot] commented on Jul 14, 2026 02:01 UTC
Bot

Stale PRs rot after 14d of inactivity.

Mark the PR as fresh by commenting /remove-lifecycle rotten.
Rotten PRs close after an additional 7d of inactivity.

If this PR is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

stu-gott stu-gott commented on Jul 14, 2026 17:40 UTC
Author

/remove-lifecycle rotten

openshift-ci[bot] openshift-ci[bot] commented on Aug 14, 2026 01:30 UTC
Bot

Stale PRs are closed after 21d of inactivity.

If this PR is still relevant, comment to refresh it or remove the stale label.
Mark the PR as fresh by commenting /remove-lifecycle stale.

If this PR is safe to close now please do so with /close.

/lifecycle stale

openshift-ci[bot] openshift-ci[bot] commented on Aug 28, 2026 02:01 UTC
Bot

Stale PRs rot after 14d of inactivity.

Mark the PR as fresh by commenting /remove-lifecycle rotten.
Rotten PRs close after an additional 7d of inactivity.

If this PR is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

stu-gott stu-gott commented on Sep 01, 2026 20:34 UTC
Author

/remove-lifecycle rotten

openshift-ci[bot] openshift-ci[bot] commented on Oct 02, 2026 01:30 UTC
Bot

Stale PRs are closed after 21d of inactivity.

If this PR is still relevant, comment to refresh it or remove the stale label.
Mark the PR as fresh by commenting /remove-lifecycle stale.

If this PR is safe to close now please do so with /close.

/lifecycle stale

stu-gott stu-gott commented on Oct 05, 2026 18:48 UTC
Author

/remove-lifecycle stale

openshift-ci[bot] openshift-ci[bot] commented on Oct 05, 2026 18:56 UTC
Bot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: <a href="https://github.com/ComplianceAsCode/compliance-operator/pull/847#" title="Author self-approved">stu-gott</a>
Once this PR has been reviewed and has the lgtm label, please assign taimurhafeez for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

<details open>
Needs approval from an approver in each of these files:

  • OWNERS
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":["taimurhafeez"]} -->

    stu-gott stu-gott commented on Oct 05, 2026 19:03 UTC
    Author

    @rhmdnd please note new activity on this ancient issue. Sorry for the delay.

    stu-gott stu-gott commented on Nov 03, 2026 15:50 UTC
    Author

    @rhmdnd @jhrozek @xiaojiey? What's the proper review workflow?

    Reviewers
    Assignees
    stu-gott stu-gott
    Labels
    risk: low confidence: 88.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.7% (MEDIUM) · Higher = larger blast radius
    40.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 88.8% · Lower = rushed or shallow review
    88.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 4.6% · Safe to merge
    4.6%