Skip to content

fix(tools): quote cwd path in sandbox_allows_cwd_by_default test#2282

Merged
bug-ops merged 1 commit intomainfrom
2279-sandbox-spaces-false-positive
Mar 27, 2026
Merged

fix(tools): quote cwd path in sandbox_allows_cwd_by_default test#2282
bug-ops merged 1 commit intomainfrom
2279-sandbox-spaces-false-positive

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 27, 2026

Summary

  • Fixes sandbox_allows_cwd_by_default test failure on macOS systems where the home directory path contains spaces (e.g. Documents - rabax's MacBook Pro)
  • Root cause: the test built a shell command string with an unquoted CWD path, which extract_paths() tokenized by splitting on whitespace — producing path fragments that failed the sandbox starts_with check
  • Fix: wrap the path in double quotes ("cat \"{path}/file.txt\"") to match real shell usage, where paths with spaces must be quoted

Test plan

  • cargo nextest run -p zeph-tools -E 'test(sandbox_allows_cwd_by_default)' passes
  • Full cargo nextest run -p zeph-tools --lib --bins — 852/852 passed

Closes #2279

@github-actions github-actions bot added rust Rust code changes bug Something isn't working size/XS Extra small PR (1-10 lines) labels Mar 27, 2026
@bug-ops bug-ops force-pushed the 2279-sandbox-spaces-false-positive branch from d212796 to 5d4e08f Compare March 27, 2026 21:47
@bug-ops bug-ops enabled auto-merge (squash) March 27, 2026 21:47
Paths with spaces (e.g. macOS user directories) were passed unquoted to
the shell command string, causing extract_paths() to split the path on
whitespace and produce fragments that fail the sandbox prefix check.

Quote the path in the test to match real shell usage, making the test
portable on macOS and any system where the working directory contains
spaces. Fixes #2279.
@bug-ops bug-ops force-pushed the 2279-sandbox-spaces-false-positive branch from 5d4e08f to 0582a64 Compare March 27, 2026 21:53
@bug-ops bug-ops merged commit 63c2c01 into main Mar 27, 2026
25 checks passed
@bug-ops bug-ops deleted the 2279-sandbox-spaces-false-positive branch March 27, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rust Rust code changes size/XS Extra small PR (1-10 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(tools): sandbox validate_sandbox false-positive for cwd paths with spaces on macOS

1 participant