timer correction#61
Merged
Merged
Conversation
Signed-off-by: Raziel Cohen <rcohen@armosec.io>
|
Summary:
|
added 2 commits
May 1, 2023 17:08
Signed-off-by: Raziel Cohen <rcohen@armosec.io>
Signed-off-by: Raziel Cohen <rcohen@armosec.io>
|
Summary:
|
dwertent
approved these changes
May 1, 2023
entlein
pushed a commit
to k8sstormcenter/node-agent
that referenced
this pull request
May 14, 2026
…tract End-to-end unit test for the Test_32 dependency chain: projectUserProfiles → mergeApplicationProfile → Apply → projectField(Execs). Asserts that user-overlay AP Execs land in projected.Execs.Values keyed by path (both full-path "/bin/sh" and bare-name "sh" variants) AND in projected.ExecsByPath for the was_executed_with_args matcher. This passes locally — which proves the projection logic isn't the cause of Test_32's R0001-precondition failure in CT. The gap must be elsewhere: stale function_cache, reconciler timing, or cache-key invalidation not tracking entry updates. Test kubescape#61 tracks the live- agent diagnosis.
entlein
pushed a commit
to k8sstormcenter/node-agent
that referenced
this pull request
May 14, 2026
…cape#61) Diagnostic warning to capture exactly what's in the projected container profile's Execs.Values at the moment a was_executed lookup returns false. Compared against the agent's merge log (which claims the user-overlay's Execs were appended), this will pinpoint whether the projection actually contains the merged paths at decision time. Remove this diagnostic after the merge-vs-evaluator gap is closed. The user-overlay SyncChecksum fix (f80f349) did NOT silence R0001 on user-overlay-allowed paths in CT — so the bug is elsewhere (not cache invalidation). This diagnostic narrows it.
entlein
pushed a commit
to k8sstormcenter/node-agent
that referenced
this pull request
May 14, 2026
…faithful) Inspektor Gadget's eBPF exec tracer follows the symlink and reports event.exepath as the kernel-resolved target. On busybox-based images every utility (sh, echo, nslookup, cat, ...) is a symlink to /bin/busybox — so exepath always resolves to /bin/busybox regardless of which symlink was actually invoked. User-authored ApplicationProfile entries naturally list the symlink form (/bin/sh, /usr/bin/nslookup) — that's how operators think about binaries. With the prior "exepath wins unconditionally" precedence, parse.get_exec_path(... '/bin/busybox') returned /bin/busybox while profile.Path was /bin/sh. ap.was_executed missed → R0001 fired forever on every busybox symlink. Same for the recording-side resolveExecPath which recorded /bin/busybox into auto-learned profiles, divorced from how users wrote their profiles. Diagnostic captured the smoking gun (task kubescape#61, run 25871298210): DIAG ap.was_executed lookup MISS queriedPath=/bin/busybox execsValuesKeys=[sleep, /bin/sh, sh, /bin/echo, echo, /usr/bin/curl, curl, /bin/sleep] -- merge worked, profile has /bin/sh, but query asks for /bin/busybox Fix — new symlink-faithful precedence on BOTH layers: 1. argv[0] when it's an absolute path → symlink-as-invoked wins 2. exepath when argv[0] is bare/empty → preserves argv[0]-spoofing protection (bare argv[0]="sshd" while exec'ing /usr/bin/curl resolves to the real exepath) 3. argv[0] when bare and exepath empty (fexecve / AT_EMPTY_PATH) 4. comm as last resort Tier 2 keeps the existing argv[0]-spoofing test green. The new "absolute argv[0] wins" rule is safe because the kernel only exposes an absolute argv[0] when execve was called with that path (the kernel follows the symlink itself; argv[0] reflects what the caller passed). Pinned by unit tests on BOTH sides: - parse/parsing_test.go::TestGetExecPath_SymmetryWithRecordingSide + busybox symlink (/bin/sh, /usr/bin/nslookup) + bare argv[0] keeps spoof protection - containerprofilemanager/v1/event_reporting_test.go:: TestResolveExecPath + busybox symlink (/bin/sh, /usr/bin/nslookup) + existing argv[0]-spoofing case stays green Resolves task kubescape#60 (event.exepath empty for kubectl-exec'd processes — actually it wasn't empty, it was just resolved to the symlink target) and task kubescape#61 (user-overlay merge → rule-evaluator wiring gap — actually it wasn't the wiring, it was the path-key mismatch). Removes the diagnostic warn log from exec.go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview