strix/tests/tools
seanturner83 659f643b9d
review: reject path traversal + bound per-item timeout to tool deadline
Two Greptile findings on #791:

- P1 security: batch_view_files prefixed `workspace/` but didn't guard `..`, so
  `workspace/../../etc/passwd` was cat'd verbatim as `/workspace/../../etc/passwd`
  and read container files outside the target. Added `_safe_workspace_path()`:
  normalizes the path and rejects anything that resolves outside `/workspace`
  (per-item error, never handed to cat); the safe entries in the batch still read.

- P1: a full valid batch could exceed the enclosing @function_tool deadline and
  be cancelled before returning isolated results. Worst case is
  ceil(_MAX_ITEMS/_MAX_CONCURRENCY)=7 waves of the per-item timeout; the old 60s
  per item => ~420s > the 180s/300s tool deadlines. Lowered per-item timeouts
  (view 20s, exec 40s) so 7 waves stay under the tool deadline, and named all
  four constants so the invariant is explicit (+ a test asserting it holds).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 22:12:37 +01:00
..
__init__.py feat(tools): batch_view_files / batch_terminal_execute — sandbox-side concurrency 2026-07-16 21:59:24 +01:00
test_batch_tools.py review: reject path traversal + bound per-item timeout to tool deadline 2026-07-16 22:12:37 +01:00