allowing wildcards in exec args#805
Conversation
Signed-off-by: entlein <einentlein@gmail.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@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. |
🧩 Analysis chain
🏁 Script executed: Length of output: 3046 🏁 Script executed: Length of output: 12669
✅ Atomicity: Confirmed CleanPR
No file overlap with any sibling PR in the tier map:
🔗 Cross-PR Coupling FlagsExpected (clean tier dependency):
Rebase risk (not
Cross-repo Tier 2 sibling:
🐛 Code-Level Issues Found1. Stale docstring in
|
| // 3. argv[0] when bare and exepath empty (fexecve / AT_EMPTY_PATH). | ||
| // 4. comm as last resort. | ||
| func resolveExecPath(exepath, comm string, args []string) string { | ||
| if len(args) > 0 && len(args[0]) > 0 && args[0][0] == '/' { |
There was a problem hiding this comment.
argv[0] is still fully user-controlled here, even when it is absolute. The Linux execve(2) contract only says argv[0] should contain the executed filename by convention; it is not kernel-verified. A quick repro is exec -a /bin/sh sleep 2, which yields cmdline=/bin/sh 2 while /proc/<pid>/exe still points to /usr/bin/sleep.
So this new tier-1 rule lets a process masquerade as /bin/sh (or any other approved absolute path) while the real executable is something else, which reopens the spoofing hole the old exepath-first behavior was protecting against.
| if len(values) != 3 { | ||
| return types.NewErr("expected 3 arguments, got %d", len(values)) | ||
| } | ||
| return l.getExecPathWithExePath(values[0], values[1], values[2]) |
There was a problem hiding this comment.
Adding the 3-arg overload alone doesn't actually fix the fork-shell mismatch in this repo: the bundled rule expressions still call parse.get_exec_path(event.args, event.comm) (see tests/chart/templates/node-agent/default-rules.yaml at lines 21, 201, 336, 361, and 434), so they never hit this new event.exepath fallback.
That means cases like sh -c ... still evaluate to bare sh on the rule side while the recording side now stores /bin/sh, so the regression remains until the rule definitions are migrated too.
Overview
Adds a 3-arg
parse.get_exec_path(args, comm, exepath)CEL overloadand recording-side
resolveExecPathso rules that need to distinguisha symlinked exec from its underlying binary (busybox utilities,
buildroot-style image where every /bin/* is a symlink to /bin/busybox)
get the absolute argv[0] path when available, falling back to exepath
then the bare comm.
Additional Information
has a sister PR in storage
Checklist before requesting a review
put an [x] in the box to get it checked
Benchmark: all incoming PRs have been benchmarked