codescout icon indicating copy to clipboard operation
codescout copied to clipboard

Source-file gate refuses a quoted filename that contains -tail-

Open mareurs opened this issue 2 months ago • 1 comments

Repro: run_command('P="docs/issues/x-tail-y.md src/tools/mod.rs"; echo assigned') is refused as "shell access to source files is blocked". The same line without -tail- in the filename (P="docs/research/x.md src/tools/mod.rs"; echo assigned) runs. Re-confirmed on 2026-09-24.

Cause (likely): the reader-command scan in check_source_file_access (src/util/path_security.rs) looks inside quoted values, so tail between two - in a filename reads as the tail command. mask_heredoc_bodies in the same file solves the same problem for heredocs, so it's a good model to follow.

Tests first:

  1. the command above must be allowed;
  2. tail src/tools/mod.rs must still be refused.

Test 2 is what keeps the security gate honest: a fix that simply stops detecting tail would pass test 1 and fail test 2.

Full context in the bug file: docs/issues/2026-09-24-source-gate-reads-tail-inside-a-quoted-hyphenated-filename.md.

Base your branch on a fresh origin/experiments.

mareurs avatar Sep 24 '26 19:09 mareurs

Taking this one.

vmaneata avatar Sep 25 '26 07:09 vmaneata