path-wildcards: anchored trailing-* + per-endpoint port + R0040 args#807
path-wildcards: anchored trailing-* + per-endpoint port + R0040 args#807entlein wants to merge 17 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR extends ApplicationProfile-based CEL rule evaluation by adding per-path exec-argument projection, implementing argument-aware matching in CEL with wildcard support, refining open-path pattern handling to avoid false negatives, and validating the changes with comprehensive end-to-end component tests using new Kubernetes test workloads. ChangesApplicationProfile CEL Rule Evaluation Improvements
Sequence Diagram(s)sequenceDiagram
participant CEL as CEL Runtime
participant wasExec as wasExecutedWithArgs
participant Cache as Profile Cache
participant Matcher as CompareExecArgs
CEL->>wasExec: path, runtime args
wasExec->>Cache: load projected container profile
wasExec->>Cache: lookup ExecsByPath[path]
Cache-->>wasExec: projected argv vectors or nil
alt ExecsByPath present (constraint mode)
wasExec->>Matcher: compare runtime args vs profile args
Matcher-->>wasExec: match result with wildcard support
else ExecsByPath absent (back-compat)
wasExec-->>CEL: match any runtime args if path exists
end
wasExec-->>CEL: true or false
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a 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. Comment |
|
@CodeRabbit review this please together with kubescape/storage#323 |
🧩 Analysis chain🏁 Script executed: Length of output: 143814 🏁 Script executed: Length of output: 28898 🏁 Script executed: Length of output: 18 🏁 Script executed: Length of output: 1010 🏁 Script executed: Length of output: 241 🏁 Script executed: Length of output: 422
🔴 Critical — Build break
|
| Issue | Location | Severity |
|---|---|---|
CompareExecArgs missing from kubescape/storage |
exec.go + storage PR #323 |
🔴 Build break |
Stale comment k8sstormcenter/storage#23 |
exec_test.go |
🔵 |
was_path_opened_with_flags loses all test coverage |
open_test.go |
🟡 |
| PR description misleads on pattern delegation | open.go |
🟡 |
Back-compat silent tier in wasExecutedWithArgs |
exec.go |
🔵 |
removeEndpoint in-place mutation undocumented |
analyze_endpoints.go |
🔵 |
The storage PR #323 changes are solid — the per-port endpoint isolation, CompareDynamic rewrite with proper trailing-* anchoring, consolidateOpens, bufPool, and the extensive test suite all look correct. The node-agent changes are also logically sound, contingent on resolving the missing CompareExecArgs definition.
✅ 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.
…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 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. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainI'll fetch all PRs in the set to verify atomicity and cross-PR coupling. 🏁 Script executed: Length of output: 2908 🏁 Script executed: Length of output: 101307 🏁 Script executed: Length of output: 93396
✅ Confirmed Atomic (no cross-PR coupling issues found)
🔴 Remaining Cross-PR Coupling (must resolve before merging)1 — storage#324 ↔ storage#325: protobuf test cannot pass without the sibling
Fix options:
2 — node-agent#808 ↔ node-agent#812:
|
| Item | Location |
|---|---|
| storage#323 title still says "R0040 args" | That scope moved to node-agent#807; update the title |
| node-agent#808 still bundles 4 concerns | stampOverlayIdentity, tamper detection, IPAddresses extraction, isNetworkIPWildcard/DNS classifiers — acceptable if you want a single Tier 4 PR, but worth noting for future bisect |
Revised Merge Ordering (after fixes)
graph TD
S322["storage#322\nCompareExecArgs"] --> NA807["node-agent#807\nR0040 args"]
S323["storage#323\npath-wildcards core"] --> NA811["node-agent#811\nwas_path_opened*"]
S323 --> S325["storage#325\nCollapseConfig CRD"]
S324["storage#324 + IPAddresses pb\nnetworkmatch"] --> NA806["node-agent#806\nnetwork CEL"]
S324 --> NA808["node-agent#808\nprojection overlay + tamper"]
S325 --> NA808
NA812["node-agent#812\nExecsByPath surface"] --> NA807
NA812 --> NA808
NA805["node-agent#805\nresolveExecPath"] --> NA807
NA808 --> NA806
NA808 --> S326["storage#326 umbrella"]
NA810["node-agent#810 umbrella"] --> S326
…e#807, kubescape#808) (#44) * fix(containerprofilecache): honor verify result before merging user overlay 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. * docs(applicationprofile): rule-author contracts on opens-with-suffix/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. * deps: pin stereoscope v0.1.9 + runtime-spec v1.2.1 (compat with kubescape/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 --------- Co-authored-by: Entlein <eineintlein@gmail.com>
|
Blocking: this branch still does not build against current |
This PR (R0040 args consumer) references dynamicpathdetector.CompareExecArgs, which ships in k8sstormcenter/storage's upstream-pr/sbob-execs branch (the storage sibling of kubescape/storage#322), not in any released kubescape/storage tag. The PR's existing go.mod pin (v0.0.258) does not contain it. Adds a replace directive to the sister branch's current tip (5e39d001 — feat(apis): add ExecCalls.ArgsRequired + MatchExecArgs to express 'no args'). Removed when the sister storage PR kubescape/storage#322 merges and a release ships CompareExecArgs. Companion to the stacking-on-NA-kubescape#812 cherry-pick (provides cp.ExecsByPath) in the previous commits on this branch. Resolves the matthyx 'does not build' blocker on PR kubescape#807 (2026-05-27).
70a9d9b to
ce0d6a4
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
pkg/rulemanager/cel/libraries/applicationprofile/open_test.go (1)
117-122: ⚡ Quick winKeep direct coverage for
ap.was_path_opened_with_flags.These edits convert the old flag-focused cases into
ap.was_path_opened(...), sowasPathOpenedWithFlagsno longer has a test for its remaining contract: CEL list parsing and malformed-flagsrejection. Please keep at least one happy-path case and one invalid-flags case here.Also applies to: 186-205, 210-241
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/rulemanager/cel/libraries/applicationprofile/open_test.go` around lines 117 - 122, Restore direct coverage for ap.was_path_opened_with_flags in TestOpenInProfile by adding at least two cases: one happy-path where the CEL list of flags parses correctly and the function returns true (e.g., supply a valid flags list and expected open event), and one invalid-flags case where a malformed flags CEL list causes the function to reject the input (assert an error or false per contract). Locate the test table or assertions around TestOpenInProfile and reintroduce cases that call ap.was_path_opened_with_flags (not ap.was_path_opened) so you exercise CEL list parsing and malformed-`flags` rejection behavior; keep the existing ap.was_path_opened cases as well.go.mod (1)
474-474: Supply chain and merge coordination risk.Using a fork (
k8sstormcenter/storage) instead of the canonicalkubescape/storageintroduces supply chain concerns and requires careful coordination:
- Provenance: Verify that the fork maintainer is trustworthy and the fork accurately cherry-picks only the needed
CompareExecArgschanges- Atomicity: Ensure this replace directive is removed in the same release cycle that upgrades to the official storage version containing the fix
- Drift risk: The fork may diverge from upstream, introducing subtle behavioral differences
Consider these alternatives to reduce risk:
- Feature gating: Guard the new
ExecsByPath/CompareExecArgscalls behind a feature flag until storage PR#323ships- Atomic merge: Coordinate merging this PR simultaneously with storage PR
#323to avoid the fork entirely- Tracking issue: Create a GitHub issue to track removal of this replace directive, linked to storage PR
#323closure🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@go.mod` at line 474, The go.mod replace directive pointing at github.com/k8sstormcenter/storage (replacing github.com/kubescape/storage) creates supply-chain and merge coordination risk; either remove this replace and coordinate merging with the upstream storage PR `#323` so the official module contains CompareExecArgs/ExecsByPath, or gate uses of the new APIs (ExecsByPath/CompareExecArgs) behind a feature flag until upstream lands, and add a tracking GitHub issue to remove the go.mod replace as soon as storage PR `#323` is merged; ensure the replace removal is done atomically with the upgrade to the official release to avoid drift.pkg/rulemanager/cel/libraries/applicationprofile/exec.go (1)
127-130: ⚡ Quick winAdd visibility when legacy profiles bypass argv constraints.
Line 127 and Line 140 return
truewhenExecsByPathlacks a key for a matched path. Add a warn/metric (ideally once per container/profile hash) so silent back-compat matches are observable.Also applies to: 140-142
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/rulemanager/cel/libraries/applicationprofile/exec.go` around lines 127 - 130, The branch that returns types.Bool(true) when ExecsByPath lacks a key for a matched path (the legacy "no argv constraint" back-compat in the ExecsByPath handling) should emit an observable signal so these silent matches are visible; update the code paths that currently return types.Bool(true) (the branches referencing ExecsByPath) to log or increment a metric including the container/profile hash and ensure the signal is emitted at most once per container/profile by deduplicating with a short-lived in-memory cache or an "emit-once" set keyed by containerID+profileHash; apply the same change to both places where types.Bool(true) is returned so legacy bypasses are recorded.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@go.mod`:
- Line 474: Add a clear TODO comment immediately above the replace directive
"replace github.com/kubescape/storage => github.com/k8sstormcenter/storage
v0.0.240-0.20260527160734-5e39d0018391" explaining this is a temporary override,
referencing the upstream storage PR (`#323`), the criteria for removal (e.g., when
that PR is merged and a released version is available), and include the
author/date or ticket that added the workaround so it can be tracked and removed
later.
In `@pkg/rulemanager/cel/libraries/applicationprofile/exec_test.go`:
- Around line 317-318: Update the test comment in exec_test.go that references
the old storage repo; replace the text "k8sstormcenter/storage#23" with the
correct "kubescape/storage#23" (locate the comment block in
pkg/rulemanager/cel/libraries/applicationprofile/exec_test.go where the matcher
note appears) so the PR link points to the correct repository.
---
Nitpick comments:
In `@go.mod`:
- Line 474: The go.mod replace directive pointing at
github.com/k8sstormcenter/storage (replacing github.com/kubescape/storage)
creates supply-chain and merge coordination risk; either remove this replace and
coordinate merging with the upstream storage PR `#323` so the official module
contains CompareExecArgs/ExecsByPath, or gate uses of the new APIs
(ExecsByPath/CompareExecArgs) behind a feature flag until upstream lands, and
add a tracking GitHub issue to remove the go.mod replace as soon as storage PR
`#323` is merged; ensure the replace removal is done atomically with the upgrade
to the official release to avoid drift.
In `@pkg/rulemanager/cel/libraries/applicationprofile/exec.go`:
- Around line 127-130: The branch that returns types.Bool(true) when ExecsByPath
lacks a key for a matched path (the legacy "no argv constraint" back-compat in
the ExecsByPath handling) should emit an observable signal so these silent
matches are visible; update the code paths that currently return
types.Bool(true) (the branches referencing ExecsByPath) to log or increment a
metric including the container/profile hash and ensure the signal is emitted at
most once per container/profile by deduplicating with a short-lived in-memory
cache or an "emit-once" set keyed by containerID+profileHash; apply the same
change to both places where types.Bool(true) is returned so legacy bypasses are
recorded.
In `@pkg/rulemanager/cel/libraries/applicationprofile/open_test.go`:
- Around line 117-122: Restore direct coverage for ap.was_path_opened_with_flags
in TestOpenInProfile by adding at least two cases: one happy-path where the CEL
list of flags parses correctly and the function returns true (e.g., supply a
valid flags list and expected open event), and one invalid-flags case where a
malformed flags CEL list causes the function to reject the input (assert an
error or false per contract). Locate the test table or assertions around
TestOpenInProfile and reintroduce cases that call ap.was_path_opened_with_flags
(not ap.was_path_opened) so you exercise CEL list parsing and malformed-`flags`
rejection behavior; keep the existing ap.was_path_opened cases as well.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 13925bf1-e737-4b6b-a4c1-a13450f2d4a9
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (8)
go.modpkg/objectcache/containerprofilecache/projection_apply.gopkg/objectcache/containerprofilecache/projection_apply_test.gopkg/objectcache/projection_types.gopkg/rulemanager/cel/libraries/applicationprofile/exec.gopkg/rulemanager/cel/libraries/applicationprofile/exec_test.gopkg/rulemanager/cel/libraries/applicationprofile/open.gopkg/rulemanager/cel/libraries/applicationprofile/open_test.go
This PR (R0040 args consumer) references dynamicpathdetector.CompareExecArgs, which ships in k8sstormcenter/storage's upstream-pr/sbob-execs branch (the storage sibling of kubescape/storage#322), not in any released kubescape/storage tag. The PR's existing go.mod pin (v0.0.258) does not contain it. Adds a replace directive to the sister branch's current tip (5e39d001 — feat(apis): add ExecCalls.ArgsRequired + MatchExecArgs to express 'no args'). Removed when the sister storage PR kubescape/storage#322 merges and a release ships CompareExecArgs. Companion to the stacking-on-NA-kubescape#812 cherry-pick (provides cp.ExecsByPath) in the previous commits on this branch. Resolves the matthyx 'does not build' blocker on PR kubescape#807 (2026-05-27). Signed-off-by: entlein <einentlein@gmail.com>
ce0d6a4 to
d3cd5cc
Compare
matthyx
left a comment
There was a problem hiding this comment.
Re-checked this at the current HEAD (9c89feb). The old missing-symbol blocker is fixed, but I still see three blocker-level issues:
tests/component_test.gonow contains a second//go:build component, a secondpackage tests, a second import block, and a duplicatedTest_32_UnexpectedProcessArgumentsbody.gofmt -e tests/component_test.gofails with parse errors at1574,1576,4978, and5206, so the component test file does not parse.- The new storage replace in
go.modis not readonly-clean.go test -mod=readonly ./pkg/objectcache/containerprofilecachefails immediately withgo: updates to go.mod needed; to update it: go mod tidy, so clean/reproducible CI runs fail before tests even start. pkg/objectcache/containerprofilecache/projection_apply.go/pkg/rulemanager/cel/libraries/applicationprofile/exec.go:ExecsByPathis keyed only by path, so duplicateExecCallscollapse to the last argv shape. That breaks merged profiles that legitimately append multiple allowed argv variants for the same executable path (mergeApplicationProfileappendsmatched.Execs), andap.was_executed_with_args(...)will reject valid executions unless they match the final entry.
Previous Test_32 add appended the full umbrella component_test.go on top of the legitimate one, producing two //go:build directives, two package clauses, two import blocks and a triplicated Test_32 body. gofmt -e rejected the file at lines 1574, 1576, 4978, 5206. Truncates to the last legitimate line and re-appends only the Test_32 function from the umbrella branch. File parses clean, single instance of each top-level element. Resolves matthyx blocker (1) on PR kubescape#807 (2026-05-28). Signed-off-by: entlein <einentlein@gmail.com>
b27f8bc to
e5069fd
Compare
Storage v0.0.278 bump pulled in a transitive dep set that drove runtime-spec up to v1.3.0, which is incompatible with containerd v1.7.32's spec_opts.go (cannot use int64 as *int64). Upstream NA main runs on runtime-spec v1.2.1; pin it the same way here via replace so 'go test -mod=readonly' is clean (matthyx blocker 2 on PR kubescape#807, 2026-05-28). Also runs full mod tidy now that v0.0.278 has shipped — populates the transitive go.sum entries that were missing under the previous sister-branch replace, so CI's -mod=readonly accepts the module graph. Signed-off-by: entlein <einentlein@gmail.com>
Previous shape (map[string][]string) collapsed duplicate Path entries to the last seen, breaking merged profiles where mergeApplicationProfile legitimately appends multiple ExecCalls per path with distinct argv shapes. ap.was_executed_with_args silently rejected valid executions that matched any but the final entry (matthyx blocker 3 on PR kubescape#807, 2026-05-28). extractExecsByPath now appends each Args slice to a per-path list. wasExecutedWithArgs iterates the list and returns true when any vector matches via CompareExecArgs. The 'absent key means no argv constraint' back-compat semantic is unchanged. Cloned-slice invariant preserved. Updates TestApply_ExecsByPath_PopulatesFromSpec to assert the appended-list shape and the second-entry mutation invariant. Signed-off-by: entlein <einentlein@gmail.com>
|
@claude test this again please using the same upstream-mirror image, please |
regress-upstream-pr-mirror: upstream-pr=kubescape#807 source=upstream-pr/sbob-path-wildcards
|
Re-running on current HEAD `e5069fd6` (the rebase tip — 10 new commits since this morning's run on `90465661`), reusing the same storage image `ghcr.io/k8sstormcenter/storage:regress-v0.0.278-20260529-081531` per your ask. NA build: https://github.com/k8sstormcenter/node-agent/actions/runs/26629665648. CT will auto-chain after build completes (same shared tag on both images, so the deploy sees a coherent pair). Will report the matrix outcome. |
|
Retry result on rebased tip `e5069fd6` (reused storage `regress-v0.0.278-20260529-081531`): 21/21 GREEN ✓ (run 26629884873). Same result as this morning's pre-rebase run — the rebase didn't introduce regressions. Full pass list unchanged (Test_01, 02, 06–08, 10–24, 27). |
…ontainerProfile Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
This PR (R0040 args consumer) references dynamicpathdetector.CompareExecArgs, which ships in k8sstormcenter/storage's upstream-pr/sbob-execs branch (the storage sibling of kubescape/storage#322), not in any released kubescape/storage tag. The PR's existing go.mod pin (v0.0.258) does not contain it. Adds a replace directive to the sister branch's current tip (5e39d001 — feat(apis): add ExecCalls.ArgsRequired + MatchExecArgs to express 'no args'). Removed when the sister storage PR kubescape/storage#322 merges and a release ships CompareExecArgs. Companion to the stacking-on-NA-kubescape#812 cherry-pick (provides cp.ExecsByPath) in the previous commits on this branch. Resolves the matthyx 'does not build' blocker on PR kubescape#807 (2026-05-27). Signed-off-by: entlein <einentlein@gmail.com>
fixtures Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
….278 Storage PR kubescape/storage#322 (CompareExecArgs + MatchExecArgs + ExecCalls.ArgsRequired) merged to kubescape/storage main and a release was cut (v0.0.278, 2026-05-28). The k8sstormcenter sister-branch replace is no longer needed — pinning the real tag. Signed-off-by: entlein <einentlein@gmail.com>
Previous Test_32 add appended the full umbrella component_test.go on top of the legitimate one, producing two //go:build directives, two package clauses, two import blocks and a triplicated Test_32 body. gofmt -e rejected the file at lines 1574, 1576, 4978, 5206. Truncates to the last legitimate line and re-appends only the Test_32 function from the umbrella branch. File parses clean, single instance of each top-level element. Resolves matthyx blocker (1) on PR kubescape#807 (2026-05-28). Signed-off-by: entlein <einentlein@gmail.com>
Storage v0.0.278 bump pulled in a transitive dep set that drove runtime-spec up to v1.3.0, which is incompatible with containerd v1.7.32's spec_opts.go (cannot use int64 as *int64). Upstream NA main runs on runtime-spec v1.2.1; pin it the same way here via replace so 'go test -mod=readonly' is clean (matthyx blocker 2 on PR kubescape#807, 2026-05-28). Also runs full mod tidy now that v0.0.278 has shipped — populates the transitive go.sum entries that were missing under the previous sister-branch replace, so CI's -mod=readonly accepts the module graph. Signed-off-by: entlein <einentlein@gmail.com>
Previous shape (map[string][]string) collapsed duplicate Path entries to the last seen, breaking merged profiles where mergeApplicationProfile legitimately appends multiple ExecCalls per path with distinct argv shapes. ap.was_executed_with_args silently rejected valid executions that matched any but the final entry (matthyx blocker 3 on PR kubescape#807, 2026-05-28). extractExecsByPath now appends each Args slice to a per-path list. wasExecutedWithArgs iterates the list and returns true when any vector matches via CompareExecArgs. The 'absent key means no argv constraint' back-compat semantic is unchanged. Cloned-slice invariant preserved. Updates TestApply_ExecsByPath_PopulatesFromSpec to assert the appended-list shape and the second-entry mutation invariant. Signed-off-by: entlein <einentlein@gmail.com>
Mirrors containerprofilecache.Apply's extractExecsByPath shape so exec-args unit tests exercise the real wildcard matcher instead of hitting the absent-key 'no argv constraint' back-compat fallback. Same per-Path append + nil→empty-slice rules. Fixes the four TestExecWithArgsWildcardInProfile cases that were silently returning true (back-compat) and getting marked as failing expected:false (sh -x wrong flag, ls -l no directory, echo goodbye world wrong literal anchor, curl --pass alice wrong literal). Signed-off-by: entlein <einentlein@gmail.com>
…o go mod sync with main Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
e5069fd to
c5dd143
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/resources/nginx-user-profile-deployment.yaml`:
- Line 20: The nginx image version nginx:1.14.2 in the
nginx-user-profile-deployment.yaml file is outdated and affected by known
security vulnerabilities. Either update the image to a current stable version
such as nginx:1.28, or if this specific version is intentionally pinned for the
test scenario, add a comment above the image line documenting the reason why
this particular version is required for test reproducibility.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e332298d-423b-478e-860d-92545216f6f9
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (13)
.github/workflows/component-tests.yamlgo.modpkg/objectcache/containerprofilecache/projection_apply.gopkg/objectcache/containerprofilecache/projection_apply_test.gopkg/objectcache/projection_types.gopkg/objectcache/v1/mock.gopkg/rulemanager/cel/libraries/applicationprofile/exec.gopkg/rulemanager/cel/libraries/applicationprofile/exec_test.gopkg/rulemanager/cel/libraries/applicationprofile/open.gopkg/rulemanager/cel/libraries/applicationprofile/open_test.gotests/component_test.gotests/resources/curl-user-profile-wildcards-deployment.yamltests/resources/nginx-user-profile-deployment.yaml
🚧 Files skipped from review as they are similar to previous changes (11)
- .github/workflows/component-tests.yaml
- pkg/rulemanager/cel/libraries/applicationprofile/open.go
- tests/resources/curl-user-profile-wildcards-deployment.yaml
- pkg/rulemanager/cel/libraries/applicationprofile/exec_test.go
- pkg/objectcache/projection_types.go
- pkg/objectcache/v1/mock.go
- pkg/rulemanager/cel/libraries/applicationprofile/exec.go
- tests/component_test.go
- pkg/objectcache/containerprofilecache/projection_apply_test.go
- go.mod
- pkg/rulemanager/cel/libraries/applicationprofile/open_test.go
| spec: | ||
| containers: | ||
| - name: nginx | ||
| image: nginx:1.14.2 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check nginx:1.14.2 for security advisories and compare with latest version.
# Check for security vulnerabilities in nginx:1.14.2
echo "=== Checking for vulnerabilities in nginx:1.14.2 ==="
gh api graphql -f query='
{
securityVulnerabilities(first: 10, ecosystem: ACTIONS, package: "nginx", orderBy: {field: UPDATED_AT, direction: DESC}) {
nodes {
advisory {
summary
severity
publishedAt
}
vulnerableVersionRange
firstPatchedVersion {
identifier
}
}
}
}'
# Get latest nginx version from Docker Hub
echo -e "\n=== Latest nginx versions on Docker Hub ==="
curl -s 'https://registry.hub.docker.com/v2/repositories/library/nginx/tags?page_size=5&ordering=last_updated' | jq -r '.results[] | "\(.name) - updated: \(.last_updated)"'Repository: kubescape/node-agent
Length of output: 1992
🌐 Web query:
nginx 1.14.2 release date security vulnerabilities CVEs
💡 Result:
Nginx version 1.14.2 was released on December 4, 2018 [1][2][3]. Regarding security vulnerabilities, nginx 1.14.2 was a maintenance release that addressed several bug fixes and reliability improvements, rather than a security-focused release itself [1][3]. However, the release preceding it, version 1.14.1, contained critical security fixes [4]. Vulnerabilities often associated with this era of nginx (1.14.x series) include: - CVE-2018-16843: A vulnerability in the HTTP/2 implementation where a client could cause excessive memory consumption [4][5]. - CVE-2018-16844: A vulnerability in the HTTP/2 implementation where a client could cause excessive CPU usage [4][5]. - CVE-2018-16845: A memory disclosure vulnerability in the ngx_http_mp4_module, occurring when processing specially crafted mp4 files [4][5]. These issues were addressed in nginx 1.14.1 [4]. Users are advised that the 1.14.x branch is an end-of-life stable branch and is no longer supported [6]. To ensure security, it is recommended to upgrade to a currently supported stable or mainline version [6].
Citations:
- 1: http://mailman.nginx.org/pipermail/nginx-announce/2018/000225.html
- 2: http://nginx.org/en/CHANGES-1.14
- 3: https://mailman.nginx.org/pipermail/nginx-devel/2018-December/011681.html
- 4: https://osv.dev/vulnerability/openSUSE-SU-2019:0195-1
- 5: https://www.suse.com/support/update/announcement/2019/suse-su-20190334-1/
- 6: https://endoflife.date/nginx
🌐 Web query:
nginx latest stable version 2024 2025
💡 Result:
As of June 17, 2026, the NGINX project maintains its release history through distinct mainline and stable branches [1]. During 2024 and 2025, the following stable versions were the primary releases: For 2024, NGINX 1.26.0 was released as the stable version in April 2024, following the retirement of the 1.25.x branch [2][1]. For 2025, NGINX 1.28.0 was released as the new stable version on April 23, 2025, succeeding the 1.26.x stable branch [3][4][1]. Subsequent updates to the 1.28.x stable branch were released throughout the remainder of 2025 to incorporate critical bug fixes [3][5]. The NGINX versioning scheme uses even numbers for the stable branch (e.g., 1.26.x, 1.28.x) and odd numbers for the mainline branch (e.g., 1.27.x, 1.29.x) [1]. New stable branches are typically created by forking the current mainline branch every April [1].
Citations:
- 1: https://endoflife.date/nginx
- 2: https://nginx.org/en/CHANGES
- 3: https://nginx.org/2025.html
- 4: https://community.nginx.org/t/nginx-open-source-core-1-28-0-released-2025-04-23/4189
- 5: http://nginx.org/2025.html
🌐 Web query:
nginx 1.14.2 known vulnerabilities advisories
💡 Result:
NGINX 1.14.2 is a significantly outdated version released around 2018–2019 and is no longer supported [1]. It is susceptible to numerous security vulnerabilities discovered after its release [2][3][4]. Key vulnerabilities and security context for NGINX 1.14.2 include: 1. Notable Vulnerabilities: NGINX 1.14.2 is affected by several well-documented CVEs that were discovered during its operational lifetime or persist due to its age [2][4]. Examples include: - CVE-2021-3618: Related to ALPACA (Application Layer Protocol Content Confusion) attacks [2]. - CVE-2022-41741 & CVE-2022-41742: Vulnerabilities in the mp4 module, which can result in denial of service, memory disclosure, or arbitrary code execution when processing malformed mp4 files [2]. - Various legacy vulnerabilities: Depending on the specific build, it may also be subject to older issues such as CVE-2018-16843, CVE-2018-16844, and CVE-2018-16845 [1][5][6]. 2. Vulnerability Sources: Because 1.14.2 is end-of-life, general vulnerability databases (such as Snyk or Repology) will flag it as vulnerable to a wide array of CVEs discovered in the years since its release [7][8][4]. These vulnerabilities often stem not just from the NGINX core, but also from outdated dependencies included in older container images or packages [8]. 3. Security Recommendation: The official recommendation for any NGINX instance running version 1.14.2 is to upgrade to a supported, current stable version [1][2]. Using outdated web server software exposes systems to known, exploitable vulnerabilities that have been patched in modern releases [2][3]. You can monitor the official NGINX security advisories page for information on recent threats and fixed versions [1]. For detailed, environment-specific vulnerability reports, you should use a modern vulnerability scanner (like Trivy, Clair, or Snyk) against your specific deployment, as NGINX's security posture is often dependent on the specific modules enabled (e.g., ngx_http_mp4_module) and the underlying operating system libraries [2][8].
Citations:
- 1: http://nginx.org/en/security_advisories.html
- 2: https://www.debian.org/lts/security/dla-3203-1
- 3: https://www.cybersecurity-help.cz/vdb/soft/f5_networks/nginx/1.14.2/
- 4: https://repology.org/project/nginx/cves?version=1.14.2
- 5: https://osv.dev/vulnerability/SUSE-SU-2019:0334-1
- 6: https://www.suse.com/support/update/announcement/2019/suse-su-20190334-1/
- 7: https://repology.org/project/nginx/cves?version=1.14.2.1
- 8: https://snyk.io/test/docker/nginx:1.14.2
Update outdated nginx image version or document why this specific version is required.
The image nginx:1.14.2 (released December 2018) is end-of-life and affected by multiple known CVEs including CVE-2018-16843, CVE-2018-16844, CVE-2018-16845, CVE-2021-3618, and CVE-2022-41741/41742. While this is a test fixture and may use a pinned version intentionally for reproducibility, consider either upgrading to a current stable version (e.g., nginx:1.28 as of June 2026) or documenting the reason this specific version is required for the test scenario.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/resources/nginx-user-profile-deployment.yaml` at line 20, The nginx
image version nginx:1.14.2 in the nginx-user-profile-deployment.yaml file is
outdated and affected by known security vulnerabilities. Either update the image
to a current stable version such as nginx:1.28, or if this specific version is
intentionally pinned for the test scenario, add a comment above the image line
documenting the reason why this particular version is required for test
reproducibility.
|
Component tests: 21/21 passing ✅ Validated as the base of the exec-args stack: #805 rebased on top of this PR, with the storage side from kubescape/storage#328, on a coherent node-agent + storage image pair. Full matrix green: |
|
Benchmark (stack context for #805): with #805 (exec-arg → storage move) rebased on top of this PR and kubescape/storage#328 deployed, node-agent memory drops ~20% vs this PR alone:
This PR is the before-baseline of that comparison; storage held constant at #328. Quality gate passed. |
matthyx
left a comment
There was a problem hiding this comment.
Re-checked at the current HEAD (c5dd143c). The earlier merge-conflict blocker is resolved, the branch now merges cleanly with main, and the focused checks I had been using for blocker verification are passing.
Overview
ap.was_path_opened_with_suffix/prefix: in pass-through mode, onlyscan
Values(concrete paths). WildcardPatternsare delegatedto
CompareDynamicrather than rawstrings.HasPrefix/HasSuffix—a wildcard pattern can't safely answer a suffix/prefix question
without dynamic matching.
ap.was_executed_with_args: returns truewhen the profile contains an entry whose
Pathmatches AND whoseArgsvector matches (literal-equality,⋯one-positionwildcard, or
*zero-or-more trailing tokens).Summary by CodeRabbit
was_executed_with_argsby enforcing path/argv constraints when projected exec data is present, while preserving back-compat behavior when it’s absent.Test_27_ApplicationProfileOpens.