You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Read Quoting Around a Backslash-Newline and Bare xargs Runs in the Write Guard #3344
Found by the local review of the change closing #2991, #2995, #3074, #3075, and #3090 (branch feature/guard-tokenizer-directory-values). Each was confirmed with a classify probe on constructed commands. They are filed rather than narrowed in that lane, since narrowing a deny while allow gaps are open has repeatedly opened a new allow.
Over-Denials the Change Introduces
The backslash-newline deny now covers every command naming git or gh, and an escaped backslash before a line break is denied too. Neither reads quoting or heredoc data, so a backslash-newline that splits no word is denied. Develop allows each of these:
gh pr comment 5 --body 'a\ followed on the next line by b', where a single-quoted backslash-newline is literal
a gh pr create --body "$(cat <<'EOF' ... EOF)" whose quoted heredoc holds a Markdown hard line break, a line ending in \
git commit -F- <<'EOF' with a heredoc line ending in \
Near Variants Still Allowed
Develop allows each of these too:
printf 'push origin develop' | xargs git. _rewritten_git_words skips a git word with no subcommand before the xargs check.
printf 'merge 5 --admin' | xargs gh pr and printf 'pr merge 5 --admin' | xargs gh. _xargs_merge needs a visible pr and merge, where _gh_may_merge would read them as possible.
Possible Direction
Read a backslash-newline only outside single quotes and heredoc data, as _context_lex already tracks both. Run the xargs check on a git word before the no-subcommand skip, and read a gh word xargs runs through _gh_may_merge.
Over-denial (introduced). Where two comments each hold an apostrophe, _shell_tokens returns the union of shlex's tokens and the comment-aware ones. _quote_kept_tokens cannot align with that union, so a quoted "$X" reads as splittable. # what's new followed by git -C "$WT" log --oneline -3 and # that's all on later lines is denied, where develop allows it. Develop already denies the single-apostrophe form for the same reason.
Near variant (develop shares it). GNU env accepts an unambiguous prefix of a long option, so env --split='git commit -n -m x' and env --sp='gh pr merge 5 --admin' run their strings, while only --split-string is read. A value option cut short, such as --ch for --chdir, is miscounted the same way.
Over-read (introduced). An eval payload is marked expanded per text, not per eval, so eval "$(ssh-agent -s)"; eval 'git -C "$W" status' is denied where develop allows it. The nested eval 'eval "git -C \"$W\" status"' is allowed on both.
\$ in a double-quoted body (develop shares it). shlex keeps \$ inside double quotes, while the outer shell turns it into $ before the inner shell reads the body. So sh -c "git -C \$W status" and watch -n 5 "git -C \$W status" are allowed, where the single-quoted sh -c 'git -C $W status' is denied. _BACKTICK_ESCAPE already performs this unescape for backtick bodies.
GNU parallel (develop shares it). It appends words from its input as xargs does, so printf -- --admin | parallel gh pr merge 5 and printf develop | parallel git push origin are allowed. _xargs_runs could name it too.
Rule 7 behind an escaped backslash (develop shares it). The fold still joins echo \\ and the next line, so a wait loop there is not read. Low realism.
More from the fourth local pass on this lane, none a deny-to-allow flip:
Over-denial (introduced)._body_expanded reads any outer-expanding word of a watch as expanding its command, its own option values included, and ignores -x, which runs no shell. So watch -x git -C "$W" status and watch -n "$N" 'git -C "$W" status' are denied where develop allows them.
Over-denial (introduced). The split-word deny now covers every git or gh command, and _SPLIT_WORD matches an operator glued to a line continuation, which splits no word. git add x &&\ followed by git commit -m y on the next line, and git log --oneline |\ followed by head -5, are denied where develop allows them.
Allow gap (develop shares it). A backslash-newline inside the program word hides the name the gate reads: gi\ followed by t push origin develop, and g\ followed by h pr merge 5 --admin. Reading the text with each backslash-newline removed, as the shell joins it, would close it.
Allow gap (develop shares it). The pathname-pattern deny covers only -C, --git-dir, and --work-tree. A cd /example/prim* && git commit -m x reads the pattern as a literal directory for rule 6.
Design._COMMENT_WITH_QUOTE restates as a literal class the word-opening rule _strip_comments builds from _PUNCTUATION_CHARS. They agree today.
Three more from the sixth local pass on this lane, none a deny-to-allow flip:
README (introduced). Requirement 4 says a gh pr merge that xargs runs is denied, and elsewhere that a run-time word where pr's subcommand goes fails closed only beside --admin or where it may split. The guard now also denies printf 5 | xargs gh pr "$S", a gh that may merge under xargs, so the README should say "runs or may run" as the deny message does.
xargs replacing into a wrapper body (develop shares it).printf 5 | xargs -I{} sh -c 'gh pr merge {}' and printf 5 | xargs -I{} sh -c 'git push {}' are allowed. The inner shell splits the replaced line, so input 5 --admin merges with --admin. The merge, push, and commit xargs readings look for xargs only in the git or gh word's own text. _xargs_replace_string already reads this shape for the config-change scan.
gxargs (develop shares it). Homebrew's findutils installs GNU xargs as gxargs on macOS, and _xargs_runs matches only the base name xargs.
Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.
Activity
ptr727 commentedon Oct 22, 2026
Two more from the second local pass on this lane:
_shell_tokensreturns the union of shlex's tokens and the comment-aware ones._quote_kept_tokenscannot align with that union, so a quoted"$X"reads as splittable.# what's newfollowed bygit -C "$WT" log --oneline -3and# that's allon later lines is denied, where develop allows it. Develop already denies the single-apostrophe form for the same reason.env --split='git commit -n -m x'andenv --sp='gh pr merge 5 --admin'run their strings, while only--split-stringis read. A value option cut short, such as--chfor--chdir, is miscounted the same way.ptr727 commentedon Oct 22, 2026
Four more from the third local pass on this lane:
eval "$(ssh-agent -s)"; eval 'git -C "$W" status'is denied where develop allows it. The nestedeval 'eval "git -C \"$W\" status"'is allowed on both.\$in a double-quoted body (develop shares it). shlex keeps\$inside double quotes, while the outer shell turns it into$before the inner shell reads the body. Sosh -c "git -C \$W status"andwatch -n 5 "git -C \$W status"are allowed, where the single-quotedsh -c 'git -C $W status'is denied._BACKTICK_ESCAPEalready performs this unescape for backtick bodies.parallel(develop shares it). It appends words from its input asxargsdoes, soprintf -- --admin | parallel gh pr merge 5andprintf develop | parallel git push originare allowed._xargs_runscould name it too.echo \\and the next line, so a wait loop there is not read. Low realism.ptr727 commentedon Oct 22, 2026
More from the fourth local pass on this lane, none a deny-to-allow flip:
_body_expandedreads any outer-expanding word of awatchas expanding its command, its own option values included, and ignores-x, which runs no shell. Sowatch -x git -C "$W" statusandwatch -n "$N" 'git -C "$W" status'are denied where develop allows them._SPLIT_WORDmatches an operator glued to a line continuation, which splits no word.git add x &&\followed bygit commit -m yon the next line, andgit log --oneline |\followed byhead -5, are denied where develop allows them.gi\followed byt push origin develop, andg\followed byh pr merge 5 --admin. Reading the text with each backslash-newline removed, as the shell joins it, would close it.-C,--git-dir, and--work-tree. Acd /example/prim* && git commit -m xreads the pattern as a literal directory for rule 6._COMMENT_WITH_QUOTErestates as a literal class the word-opening rule_strip_commentsbuilds from_PUNCTUATION_CHARS. They agree today.ptr727 commentedon Oct 22, 2026
Three more from the sixth local pass on this lane, none a deny-to-allow flip:
gh pr mergethatxargsruns is denied, and elsewhere that a run-time word wherepr's subcommand goes fails closed only beside--adminor where it may split. The guard now also deniesprintf 5 | xargs gh pr "$S", a gh that may merge underxargs, so the README should say "runs or may run" as the deny message does.printf 5 | xargs -I{} sh -c 'gh pr merge {}'andprintf 5 | xargs -I{} sh -c 'git push {}'are allowed. The inner shell splits the replaced line, so input5 --adminmerges with--admin. The merge, push, and commitxargsreadings look forxargsonly in the git or gh word's own text._xargs_replace_stringalready reads this shape for the config-change scan.gxargs(develop shares it). Homebrew's findutils installs GNU xargs asgxargson macOS, and_xargs_runsmatches only the base namexargs.Read Tokenizer, Directory-Value, and Launched-String Gaps in the Writ…
Read a Backslash-Newline by Its Quoting in the Write Guard (#3357)
Promote the Write Guard Line-Continuation and Escaped-Pair Reads, Win…
ptr727 commentedon Oct 23, 2026
Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.