mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

scanner: bound source staging enumeration and run it under the scan timeout

Open Dumbris opened this issue 1 month ago • 0 comments

Follow-up from the TPA red-team PR #1596 (Sol 6.1 round 21, transcript kept locally).

  1. Unbounded directory enumeration — internal/security/scanner/source_staging.go:112: d.ReadDir(-1) allocates every entry before the 100,000-entry cap is checked (lines ~124-126), so an upstream-controlled directory with millions of entries can exhaust daemon memory before staging fails closed. Fix: read in bounded batches and enforce the remaining entry budget during enumeration; extend the cap test to assert bounded allocation.
  2. Staging outside the scan timeout — internal/security/scanner/engine.go:823: source staging runs before DockerRunner.RunScanner starts its timeout (docker.go:~220-225) and production scans pass context.Background() (engine.go:~368-370); copyRegularFromRoot (source_staging.go:~173-193) copies without a context. A slow or huge source tree can stall a scan indefinitely. Fix: create the scan deadline before staging and make the copy context-aware.

Both are availability (not bypass) issues: staging still fails closed and tampering still discards results.

Dumbris avatar Oct 12 '26 17:10 Dumbris