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
A Heredoc Body Kept as the Safe Direction Vouches for a Wait-Loop Bound #2063
_heredoc_openers in gh-write-guard.py keeps a heredoc's body as commands in three cases, each commented as the safe direction:
a tag _HEREDOC_TAG rejects, such as <<1;
the bare - tag of << -;
a shell name anywhere in the heredoc's pipeline, including one that is only an argument, as in echo bash <<EOF.
That is the safe direction for a rule that denies on what a body holds. For the wait-loop rule it is not, because a comparison in a kept body vouches for a loop whose condition carries no bound, the same harm #2059 fixed for a line holding ((.
Reproduce (constructed)
Each of these is allowed on develop and loops under timeout 3 bash until the timeout kills it:
while [ -e / ] <<1[ x -lt 5 ]1do sleep 1;done
while [ -e / ] <<-[ x -lt 5 ]-do sleep 1;done
whileecho bash >/dev/null <<EOF[ x -lt 5 ]EOFdo sleep 1;done
Done looks like
Each command above is denied, and a self-test row pins it. The comments calling each keep the safe direction, and the root README's "Two heredoc limits" paragraph, then say which rule each keep is safe for.
Found by the local strict review of the #2059 fix (handoff #2061). It is older than that fix.
Another route to the same harm, found by the local strict review of the #2059 fix and reproduced on develop at 4c9087d: an apostrophe in a trailing comment makes _context_lex raise on the opener line, and the _operator_tokens fallback then keeps an unspaced <<EOF as one word, so no reading strips the body. Allowed, although bash opens the heredoc and the loop's condition is only [ -e /x ]:
while [ -e /x ] <<EOF # don't[ x -lt 5 ]EOFdo sleep 1;done
Declined per #2517, approved by the maintainer, under GOVERNANCE.md "Trust Boundaries and Hardening Effort": The guard backstops an agent's own mistakes, and this is a command shape built to defeat it rather than one an agent session writes, so a miss does not realistically occur. See #2517 for the per-issue reason.
Activity
ptr727 commentedon Sep 30, 2026
Another route to the same harm, found by the local strict review of the #2059 fix and reproduced on develop at 4c9087d: an apostrophe in a trailing comment makes
_context_lexraise on the opener line, and the_operator_tokensfallback then keeps an unspaced<<EOFas one word, so no reading strips the body. Allowed, although bash opens the heredoc and the loop's condition is only[ -e /x ]:The spaced
<< EOFform denies correctly.Read a Heredoc on a Line Holding (( Every Way a Shell Might in the Wa…
ptr727 commentedon Oct 8, 2026
Declined per #2517, approved by the maintainer, under GOVERNANCE.md "Trust Boundaries and Hardening Effort": The guard backstops an agent's own mistakes, and this is a command shape built to defeat it rather than one an agent session writes, so a miss does not realistically occur. See #2517 for the per-issue reason.