Skip to content

The Guard's Stdin Redirect Scan Credits a Redirect Inside a Trailing Comment #2152

Closed

Description

@ptr727

_redirects_stdin in host-setup/agent-safety/claude/gh-write-guard.py credits a redirect written inside a trailing comment as the loop's input bound.

Allowed on develop, and the loop reads the pipe forever:

yes | while read l; do sleep 30; done # < f

The #< f spelling behaves the same way. Bash reads everything after # as a comment, so nothing binds descriptor 0 and the loop drains yes. The scan skips the # token as an ordinary word, reaches < and f, and counts them. A comment on its own line (done then a newline, then # < f) is denied already, because the newline ends the scan.

The scan should end at a comment the way it ends at a separator or a reserved word. #2032 is the sibling defect, where the scan ran past a reserved word.

Found by a local strict review pass on feature/auto-2032 (#2032). The code predates that branch.

Activity

  1. added
    bug
    agents
    pre-existing
    on Sep 30, 2026
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