Skip to content

allowing CIDRs, wildcards and Plural in IP and DNS#806

Open
entlein wants to merge 6 commits into
kubescape:mainfrom
k8sstormcenter:upstream-pr/sbob-network
Open

allowing CIDRs, wildcards and Plural in IP and DNS#806
entlein wants to merge 6 commits into
kubescape:mainfrom
k8sstormcenter:upstream-pr/sbob-network

Conversation

@entlein
Copy link
Copy Markdown

@entlein entlein commented May 15, 2026

Overview

network-wildcards: DNS leading/trailing/mid + CIDR + IPAddresses + "*" sentinel

Additional Information

CEL networkneighborhood helpers now query
projected fields with wildcard/CIDR/DNS-wildcard support and the v0.0.2
spec semantics (port/protocol checks degrade to address-only in v1
when only a CIDR is declared).

  • DNS leading-* (RFC 4592 single-label wildcard)
  • DNS trailing-* (subdomain-prefix wildcard)
  • DNS mid- (interior dynamic segment)
  • IPv4/IPv6 literals and CIDR ranges
  • * any-IP sentinel
  • IPAddresses list (deprecated single-IP field) preserved on the
    decode path

How to Test

20 declarative fixture YAMLs under tests/resources/network-wildcards/
pin the wildcard contract end-to-end:

  • Literal IPv4/IPv6
  • CIDR IPv4/IPv6
  • * any-IP and * as CIDR
  • Mixed IP list
  • Deprecated IPAddresses field path
  • DNS literal, leading wildcard, mid-, trailing-*
  • Trailing-dot normalisation
  • Recursive * rejection
  • Egress-and-ingress, egress-none
  • Realistic Stripe API scenario
  • Cluster DNS via mid-
  • Port+protocol with CIDR
  • Multi-container mixed wildcards

Has sister PR in storage

Signed-off-by: entlein <einentlein@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Warning

Review limit reached

@entlein, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 56 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4cef01a7-9e25-4276-b422-aa2f755134d7

📥 Commits

Reviewing files that changed from the base of the PR and between cc59fa0 and 7529d82.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (28)
  • go.mod
  • pkg/rulemanager/cel/libraries/networkneighborhood/fixtures_test.go
  • pkg/rulemanager/cel/libraries/networkneighborhood/network.go
  • pkg/rulemanager/cel/libraries/networkneighborhood/wildcard_test.go
  • tests/component_test.go
  • tests/resources/known-network-neighborhood.yaml
  • tests/resources/network-wildcards/01-literal-ipv4.yaml
  • tests/resources/network-wildcards/02-literal-ipv6.yaml
  • tests/resources/network-wildcards/03-cidr-ipv4.yaml
  • tests/resources/network-wildcards/04-cidr-ipv6.yaml
  • tests/resources/network-wildcards/05-any-ip-sentinel.yaml
  • tests/resources/network-wildcards/06-any-as-cidr.yaml
  • tests/resources/network-wildcards/07-mixed-ip-list.yaml
  • tests/resources/network-wildcards/08-deprecated-ipaddress.yaml
  • tests/resources/network-wildcards/09-dns-literal.yaml
  • tests/resources/network-wildcards/10-dns-leading-wildcard.yaml
  • tests/resources/network-wildcards/11-dns-mid-ellipsis.yaml
  • tests/resources/network-wildcards/12-dns-trailing-star.yaml
  • tests/resources/network-wildcards/13-dns-trailing-dot-normalisation.yaml
  • tests/resources/network-wildcards/14-recursive-star-rejected.yaml
  • tests/resources/network-wildcards/15-egress-and-ingress.yaml
  • tests/resources/network-wildcards/16-egress-none.yaml
  • tests/resources/network-wildcards/17-realistic-stripe-api.yaml
  • tests/resources/network-wildcards/18-cluster-dns-via-mid-ellipsis.yaml
  • tests/resources/network-wildcards/19-port-protocol-with-cidr.yaml
  • tests/resources/network-wildcards/20-multi-container-mixed-wildcards.yaml
  • tests/resources/network-wildcards/README.md
  • tests/resources/nginx-user-defined-deployment.yaml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@entlein
Copy link
Copy Markdown
Author

entlein commented May 16, 2026

@coderabbitai review

Collective re-review request after applying your atomic-split advisory + rabbit-feedback fixes across the full SBOB upstream PR set. Each PR is now scoped to a single tier per your dependency map:

Tier 0 (opens):

Tier 2 (execs):

Tier 3 (network):

Tier 4 (tamper/sign):

Umbrellas:

Please confirm atomicity per your earlier advisory and flag any remaining cross-PR coupling we missed.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

@entlein, triggering a fresh review of PR #806 (Tier 3 – network wildcards CEL) now.

On your atomicity question for the full SBOB set: the tier structure you've described looks well-scoped. A few cross-PR coupling observations specific to this PR's position:

Tier 3 coupling checks (PR #806 + storage#324)

  • PR #806 (CEL helpers) has a direct dependency on storage#324 (networkmatch package). If storage#324 is not yet merged when #806 lands, the CEL helpers that call into networkmatch will be broken at runtime. Make sure storage#324 is merged (or at minimum vendored/updated in node-agent's go.mod) before #806 is merged.
  • No observable upward coupling into Tier 4 from the network layer is expected unless the projection overlay in #808 references network-match results — worth double-checking in #808.

Tier 4 coupling risk

  • PR #808 (projection overlay + tamper + NN resource) sits above Tier 3. If its projection overlay reads from fields produced by the Tier 3 CEL helpers, #808 must not merge before #806 + storage#324 are in.

General atomicity verdict
The split looks correct per your dependency map. The merge order constraint is:

storage#323 → storage#324 → node-agent#806
storage#322, `#325` → node-agent#805, `#807`, `#812`
(above) → node-agent#808, `#809`
umbrellas last: storage#326, node-agent#810

No cross-tier coupling jumps are apparent from the tier descriptions alone. The re-review will surface any remaining intra-PR issues in #806.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@matthyx matthyx moved this to WIP in KS PRs tracking May 26, 2026
"github.com/kubescape/node-agent/pkg/objectcache"
"github.com/kubescape/node-agent/pkg/rulemanager/cel/libraries/cache"
"github.com/kubescape/node-agent/pkg/rulemanager/profilehelper"
"github.com/kubescape/storage/pkg/registry/file/networkmatch"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking: this introduces github.com/kubescape/storage/pkg/registry/file/networkmatch, but this branch still pins github.com/kubescape/storage v0.0.258, and that version does not ship this package. go test ./pkg/rulemanager/cel/libraries/networkneighborhood/... currently fails immediately with no required module provides package github.com/kubescape/storage/pkg/registry/file/networkmatch.

Can we either bump github.com/kubescape/storage in this PR or add a temporary replace to the sister storage branch so the PR builds in this repo as-is?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

replace github.com/kubescape/storage => github.com/k8sstormcenter/storage v0.0.240-0.20260527173728-46f37d32b969 , please remove before merge :)

Copy link
Copy Markdown
Contributor

@matthyx matthyx left a comment

Choose a reason for hiding this comment

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

Requesting changes for one blocking issue: this PR imports github.com/kubescape/storage/pkg/registry/file/networkmatch, but the repo still pins github.com/kubescape/storage v0.0.258, which does not contain that package. As a result, go test ./pkg/rulemanager/cel/libraries/networkneighborhood/... fails before the new tests can run.

I left the inline comment on the import; once the storage dependency is wired to a version/replace that includes networkmatch, I’m happy to re-review.

Entlein and others added 5 commits May 27, 2026 20:00
Resolves matthyx review on network.go:12 (2026-05-27).
  Test_28_UserDefinedNetworkNeighborhood + fixtures
  Test_28_UserDefinedNetworkNeighborhood + fixtures
Copy link
Copy Markdown
Contributor

@matthyx matthyx left a comment

Choose a reason for hiding this comment

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

Rechecked the updated branch: the original missing-package blocker is fixed, but the new github.com/kubescape/storage replace still leaves this PR unbuildable.

On a fresh checkout, go test ./pkg/rulemanager/cel/libraries/networkneighborhood/... now stops with go: updates to go.mod needed; to update it: go mod tidy, so go.mod/go.sum are not in a buildable state as committed.

If I let Go resolve modules (GOFLAGS=-mod=mod go build ./pkg/rulemanager/cel/libraries/networkneighborhood/...), the dependency graph shifts and the build then fails in github.com/containerd/containerd/oci with cannot use limit (variable of type int64) as *int64 value in assignment.

So the branch still needs a storage version / dependency set that builds cleanly in node-agent as committed, without requiring local module rewrites.

@entlein
Copy link
Copy Markdown
Author

entlein commented May 28, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Labels

None yet

Projects

Status: WIP

Development

Successfully merging this pull request may close these issues.

2 participants