laoyyu a1a6866ebc
fix(sandbox): end the host-path tail at a comma like the other list separators (#8244)
* fix(sandbox): end the host-path tail at a comma like the other list separators

The reverse-masking tail stops at whitespace and at " ; & | < > ( ) :",
but not at ",". A ,-joined list of host paths in command output therefore
lets the first match's tail swallow every later entry, and those paths
reach the model unmasked -- the same failure mode fixed for :-joined
lists ($PATH, $PYTHONPATH) earlier. The forward patterns have the mirror
defect: a ,-joined list of virtual paths resolves only the first entry.

"," also joins paths in real output (pytest/mypy/sed-style lists), and a
"," inside one path only shortens the match, so no path can be corrupted
by terminating the tail there.

* docs(sandbox): extend the tail-terminator rationale to the comma

Review nits: the _PATH_TAIL rationale comment now explains why `,` ends
the tail alongside `:` (a comma-joined argument listing would otherwise
hide later entries inside the first match's tail), and the snapshot
test's prose no longer calls the `:` stop the only tail change -- the
docstring and the literal's comment both name the `,` delta.

---------

Co-authored-by: laoyyu <laoyyu@users.noreply.github.com>
2026-11-15 20:58:03 +08:00
..