Skip to content

A Heredoc Opener Inside a Script Fed to a Shell Strips Past the Script's End #2125

Closed

Description

@ptr727

Problem

gh-write-guard.py keeps a heredoc body fed to a shell, since it is the script that shell runs. Where that body is the last one its line opens, it is read line by line as ordinary commands of the outer text rather than kept whole, so a heredoc opener inside the script strips past the script's own delimiter and swallows the real commands after it. The wait-loop rule then never judges them.

Reproduce (constructed)

Allowed on develop and on the #2112 branch, and piping the same text with echo ran in place of the loop into bash prints ran:

bash <<B
cat <<X
B
while [ ! -f /x ]; do sleep 1; done
X

The same holds with a data heredoc before it on the line, as in cat <<A >/dev/null; bash <<B. The #2112 fix keeps a fed body whole only where a data body follows it on the same line.

Done looks like

The command above is denied, and a self-test row pins it, without denying a script fed to a shell that writes a document through a heredoc of its own.

Found by the local strict review of the #2112 fix (handoff #2123). It is older than that fix.

Activity

  1. added
    bug
    agents
    pre-existing
    on Sep 30, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsbugpre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions