Skip to content

fix(pcap): validate selected resource limiter before capture - #7947

Merged
morluto merged 2 commits into
mainfrom
codex/pcap-limiter-admission-7292
Oct 29, 2026
Merged

morluto merged 2 commits into
mainfrom
codex/pcap-limiter-admission-7292

Conversation

@morluto

@morluto morluto commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #7292. Selecting a directory or an executable that is not util-linux prlimit could be reported as a capinfos failure or unreadable capture output. Limiter admission now rejects these selections with the configured path and REA_TSHARK_PRLIMIT_COMMAND guidance before acquiring the capture.

Problem and expected behavior

A directory can pass executable-access checks, while a non-limiter such as /usr/bin/true exits successfully without launching capinfos. The configured limiter must be a regular executable and report the expected util-linux version banner. A differently named selected symlink remains valid; the comparison retains its literal basename, including whitespace.

Change and scope

The native-bound owner performs regular-file and version admission; the provider runs the version probe through its supervised command lifecycle and verifies selected-path identity. Cancellation, identity changes and incomplete cleanup retain their typed outcomes. Invalid UTF-8 probe output is attributed to the limiter, with captured output and diagnostics preserved.

Contract and boundary impact

  • Semantic owner and earliest changed stage: pcap native-bound admission, before capture snapshot acquisition.
  • Contribution scope fit and linked maintainer decision: existing local provider configuration; no new target capability or execution authority.
  • CLI and MCP/tool-catalog contract: invalid limiter choices return a limiter-specific capability refusal with configuration key and selected value.
  • Provider, bridge, target-format, or platform compatibility: Linux util-linux prlimit; Windows keeps the existing Job Object path.
  • Evidence, artifact, provenance, or reconstruction contract: no capture bytes are opened when limiter admission fails; probe output and cleanup failures remain visible.
  • Target selection, authority, upstream behavior, and cleanup details: caller-selected invocation spelling is preserved and rechecked; process supervision retains unproven cleanup.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.

Evidence and regression coverage

Producer tests cover directory and non-limiter refusals, renamed and whitespace-bearing symlink names, malformed probe output, cancellation, identity changes and incomplete cleanup. A Linux-only provider regression covers a real prlimit through renamed symlinks and failure before opening the capture; it was skipped on this macOS host. The version banner establishes that the selected executable identifies itself as util-linux prlimit; it does not prove that an untrusted executable enforces resource limits.

Validation performed

  • npm run test:local -- src/pcap/PcapNativeBound.test.ts — 6 passed.
  • npm run check:fast — passed.
  • npm run test:focused -- tests/boundary/pcap/pcapProvider.test.ts tests/boundary/process/artifactSelectedCommand.test.ts — 9 passed, 37 Linux-only tests skipped on macOS; run occurred before the final whitespace control was added.
  • git diff --check — passed.
  • Real Linux prlimit, the new Linux-only regressions and public CLI reproduction were not run. Docker daemon was unavailable.

Compatibility, safety, and release

The selected Linux limiter now has a version probe and must identify itself as util-linux prlimit. Existing selected paths and output are preserved. The limiter remains trusted; its banner does not establish resource enforcement.

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are addressed and no new blocking issue was found.

Summary

The PR rejects invalid Linux limiter selections before opening capture bytes. The latest changes address both previous findings:

  • Linux PCAP checks the selected limiter before opening capture bytes.

No new actionable issues were found. Review was source-based; no tests were run. Whether another PR supersedes this one could not be checked because GitHub access required authentication.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Selected Linux limiter] --> B[Require regular executable file]
  B --> C[Check version banner]
  C --> D[Check required flags in help]
  D --> E[Prepare resource limits]
  E --> F[Acquire capture snapshot]
  B -->|Rejected| G[Limiter-specific refusal]
  C -->|Rejected| G
  D -->|Rejected| G
Loading

Reviews (2) · Last reviewed commit: "fix(pcap): verify limiter capabilities a..." · Reviewed by Greptile

Comment thread src/pcap/PcapNativeBound.ts Resolved
Comment thread src/pcap/PcapProvider.ts Resolved
@morluto
morluto marked this pull request as ready for review October 28, 2026 23:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T23:38:28.415657Z 1b587de New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@morluto
morluto merged commit 78a1e19 into main Oct 29, 2026
42 checks passed
@morluto
morluto deleted the codex/pcap-limiter-admission-7292 branch October 29, 2026 01:23
@morluto morluto mentioned this pull request Nov 11, 2026
3 tasks done
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working provider: pcap Analysis provider / engine: pcap labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working provider: pcap Analysis provider / engine: pcap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Invalid pcap limiter selections are misreported as capinfos or unreadable-output failures

1 participant