Skip to content

release/sbob-rc1: TDD fixes for upstream NA rabbit findings (#807, #808)#44

Open
entlein wants to merge 3 commits into
merge/upstream-profile-rearchfrom
release/sbob-rc1
Open

release/sbob-rc1: TDD fixes for upstream NA rabbit findings (#807, #808)#44
entlein wants to merge 3 commits into
merge/upstream-profile-rearchfrom
release/sbob-rc1

Conversation

@entlein
Copy link
Copy Markdown

@entlein entlein commented May 16, 2026

Iterative branch addressing CodeRabbit findings across the atomic upstream NA PRs (kubescape#805, kubescape#806, kubescape#807, kubescape#808, kubescape#810). Each fix lands TDD: failing regression test → minimal code change → full local test suite.

Findings tracked

CodeRabbit self-trigger pattern

Per feedback_coderabbit_always_trigger.md: @coderabbitai review after each push so the rabbit has a chance to flag anything missed by the targeted tests.

@coderabbitai review

Entlein added 2 commits May 16, 2026 11:05
…verlay

CodeRabbit upstream PR kubescape#808 / containerprofilecache.go:414 (Major).
The verifyUserApplicationProfile and verifyUserNetworkNeighborhood
methods already return a boolean reflecting verification outcome —
true when the overlay is unsigned OR when verification succeeded OR
in permissive mode (EnableSignatureVerification=false); false only
in strict mode on actual tamper.

The two call sites in projection-load were discarding that return,
so tampered overlays in strict mode silently merged anyway. The
R1016 alert was emitted but the protection was advisory only.

Now: when verify returns false (strict mode + tamper detected) the
overlay is nilled out before the merge step so the cache never
projects a known-tampered profile. Permissive mode is unchanged —
verify always returns true, the overlay still merges, R1016 still
fires.

New tests:

  - TestVerifyAP_StrictMode_ReturnsFalseOnTamper — sign + tamper an
    ApplicationProfile, construct a cache with
    EnableSignatureVerification=true, and assert
    verifyUserApplicationProfile returns false (caller drops overlay).
  - TestVerifyNN_StrictMode_ReturnsFalseOnTamper — symmetric pin for
    the NetworkNeighborhood path.

The existing legacy-permissive tamper test
(TestVerifyAP_TamperedProfile_PopulatesDedupMap) continues to pass
unchanged — that path still returns true with the R1016 emitted.
…prefix + exec-args

Two doc-only fixes for CodeRabbit cross-PR advisory:

#7 (NA kubescape#807): ap.was_path_opened_with_suffix / _prefix — explicitly
document the false-negative gap when the projection is in pass-through
mode (cp.Opens.All=true). Wildcard Patterns are skipped from the
suffix/prefix scan because their token-bearing text doesn't safely
answer suffix questions. Rule authors who need wildcard-aware coverage
should either declare an Opens-projection slice (so SuffixHits/PrefixHits
become authoritative for the literals they care about) or use
ap.was_path_opened (which runs CompareDynamic over Patterns).

#8 (NA kubescape#807): wasExecutedWithArgs — document the three states of
ExecsByPath:
  1. Path absent from Execs.Values → exec not allowed, fall through.
  2. Path in Values, ABSENT from ExecsByPath → legacy back-compat
     "no argv constraint", match.
  3. Path in Values, PRESENT with empty arg list [] → explicit
     "ran with no args" constraint, NOT a wildcard.
The distinction is load-bearing for profile authors: an entry of
{Path: ..., Args: []} is a constraint, not a free pass.

No behavioural change. Tests pass unchanged.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7966ec39-9ac4-43dd-86fc-86446d6ca096

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch release/sbob-rc1

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

@entlein
Copy link
Copy Markdown
Author

entlein commented May 16, 2026

Status update on syft CVE bump:

Attempted to bump syft v1.32.0 → v1.42.4 (CVE-2026-33481 fix) and remove the kubescape/syft replace. Storage went through cleanly (k8sstormcenter/storage#33 commit bf7ce36c). NA is blocked by a transitive Go modules ambiguity:

go: github.com/moby/moby/client: ambiguous import: found package github.com/moby/moby/client in multiple modules:
    github.com/moby/moby v28.5.2+incompatible (umbrella, has /client subpkg at OLD API)
    github.com/moby/moby/client v0.4.1 (new separately-versioned submodule)

stereoscope v0.1.22 (pulled by syft v1.42.x) uses moby/moby/client v0.4.1; inspektor-gadget pulls the umbrella moby/moby for pkg/stringid. Go cannot disambiguate — replace / exclude / explicit require all fail.

Filed k8sstormcenter/node-agent#45 tracking the blocker with three fix paths. NA stays on syft v1.32.0 via existing kubescape/syft replace until the upstream dep graph resolves (most likely path: inspektor-gadget migrating off the moby/moby umbrella).

Exposure assessment: NA imports syft only for ApplicationProfile schema types (license/pkg/sbom/source/file) — it never invokes the vulnerable cleanup path. CVE practical risk is essentially zero on this binary. The declaration is still wrong-version which would surface in any SBOM scan of the NA binary; that's the cosmetic / process-hygiene concern.

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

@entlein — thanks for the detailed status update and the thorough exposure analysis. A few notes on the CVE and the blocker:

CVE-2026-33481 exposure assessment — confirmed sound.

CVE-2026-33481 is a resource-exhaustion DoS where Syft fails to clean up temporary storage after scanning archives — it unpacks archives into temp storage and exits without cleanup when that storage is exhausted. The CVSS vector is AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L (moderate), with no confidentiality or integrity impact. Since NA imports syft only for schema types and never invokes the archive-scanning path, the vulnerable cleanup code is unreachable in this binary. Your "essentially zero practical risk" conclusion holds.

The SBOM declaration concern is real but purely a cosmetic/compliance issue — the binary isn't affected at runtime.

moby/moby split blocker — well-diagnosed.

The split between github.com/moby/moby (umbrella, incompatible) and github.com/moby/moby/client (new separately-versioned sub-module at v0.4.1) is a known pain point in the Go ecosystem when a monorepo starts publishing independent sub-modules. Go's module resolution cannot reconcile both in the same build graph when different transitive deps require each side. Tracking this in #45 with inspektor-gadget migration as the most likely resolution path is the right call.

Proceeding with the review of the current PR changes.

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

@github-actions
Copy link
Copy Markdown

Performance Benchmark Results

Node-Agent Resource Usage
Metric BEFORE AFTER Delta
Avg CPU (cores) 0.222 0.208 -6.1%
Peak CPU (cores) 0.228 0.216 -5.4%
Avg Memory (MiB) 289.911 270.516 -6.7%
Peak Memory (MiB) 291.316 273.988 -5.9%
Dedup Effectiveness (AFTER only)
Event Type Passed Deduped Ratio
capabilities 0 0 N/A
hardlink 6000 0 0.0%
http 1760 119400 98.5%
network 901 77999 98.9%
open 30574 621183 95.3%
symlink 6000 0 0.0%
syscall 986 1873 65.5%
Event Counters
Metric BEFORE AFTER
capability_counter 9 9
dns_counter 1431 1438
exec_counter 7198 7197
network_counter 94581 94640
open_counter 783158 782757
syscall_counter 3496 3582

…cape/syft fork)

Storage rc1 bumped to syft v1.42.4 (CVE-2026-33481), which transitively
requires stereoscope v0.1.22 + runtime-spec v1.3.0. Those versions use
the new moby/moby/client submodule API, which is incompatible with
inspektor-gadget's moby/moby umbrella requirement on the node-agent
side (ambiguous-import wall — see issue #45).

Node-agent stays on kubescape/syft v1.32.0-ks.2 via the existing
replace, but transitive resolution from storage's go.mod pulls the
newer stereoscope into the build, breaking the build with:

  undefined: client.New
  undefined: client.PingOptions

Adds two replace directives to force the older transitive chain that
matches kubescape/syft v1.32.0-ks.2's expectations:

  github.com/anchore/stereoscope     => v0.1.9-0.20250826202322-...
  github.com/opencontainers/runtime-spec => v1.2.1

This is the minimum set needed for node-agent to build cleanly against
storage rc1 (with syft v1.42.4) while still using kubescape/syft on
its own side. Storage's CVE fix remains in effect at the storage
binary; node-agent's syft surface is unchanged.

Verified locally:
  go build ./...          ok
  go test ./pkg/objectcache/... ./pkg/rulemanager/... -count=1
                          → 30+ packages ok
@github-actions
Copy link
Copy Markdown

Performance Benchmark Results

Node-Agent Resource Usage
Metric BEFORE AFTER Delta
Avg CPU (cores) 0.214 0.209 -2.2%
Peak CPU (cores) 0.223 0.218 -2.2%
Avg Memory (MiB) 277.659 259.997 -6.4%
Peak Memory (MiB) 279.367 264.609 -5.3%
Dedup Effectiveness (AFTER only)
Event Type Passed Deduped Ratio
capabilities 0 0 N/A
hardlink 6000 0 0.0%
http 1771 119398 98.5%
network 906 77998 98.9%
open 31905 619849 95.1%
symlink 6000 0 0.0%
syscall 978 1900 66.0%
Event Counters
Metric BEFORE AFTER
capability_counter 10 8
dns_counter 1404 1419
exec_counter 7023 0
network_counter 92355 93358
open_counter 763773 772079
syscall_counter 3358 3514

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