Skip to content

Grant One More Review Round for the Guard's Context Scan Branch #2023

Closed

Description

@ptr727

May handoff #1957 spend one more local review round on feature/auto-1910, now that its third pass found one more case where the guard allows a command develop denies?

Context

Branch feature/auto-1910 is pushed at 751d058 with no pull request yet. It carries the answer on #1960 (option 1). _shell_tokens now returns develop's fallback reading followed by the context scan's. The wait rule is judged on the heredoc strip made by each reading. _closes_as_arithmetic is linear. The selftest is green, and a mutation of each mechanism fails a selftest case.

This push's review budget is spent. Pass 1 found 3 introduced findings: a heredoc-opener veto that hid a loop, a shared cache that heredoc bodies evicted into quadratic time, and a false docstring claim. All three are fixed, each with a selftest case. Pass 2 found 1 introduced docstring claim, now fixed. Pass 3 found 1 more introduced finding, which is still open:

  • The two readings are joined by a "\n" token. When develop's reading ends in a dangling redirect operator, _redirects_stdin takes that "\n" as the operator's target. It then reads the scan's first statement, so a < f there counts as the loop's input bound. A constructed command, < f cat "$(echo "'")" ; (true)#' then a newline, then yes | while read l ; do sleep 30 ; done #' >, is denied by develop and allowed by the branch, and bash runs the loop.

The fix is one guard in _redirects_stdin: refuse a shell-operator token as a redirect target, as _collect_arglist already does, and add a selftest case for this command. Pass 2 traced every other consumer of the joined tokens and found none that can turn a deny into an allow.

Options

  1. Recommended: grant one more round. The worker adds the guard and the selftest case, runs a fourth pass, and drives the pull request if that pass finds nothing introduced. If it does find something, the lane parks again. The finding is local to one consumer, and it has a known one-line fix.
  2. Join the readings so no consumer can read the join as a value. Each rule would judge each reading on its own, as the wait rule already does for heredoc strips, rather than judging one joined token list. That is a wider change, which rules out this class of finding rather than this one instance, and it needs its own review rounds.
  3. Stop here. Close the branch unmerged, and Read a Multi-Line Quote Whole in the Guard's Token Fallback #1910 stays open. A Substitution Nested in an Opaque Word Hides a Command From the Guard's Token Fallback #1958 and Shlex Parsing Successfully but Wrongly Hides a Command From the Guard's Context Scan #1959 track the related pre-existing gaps either way.

Effect on the parked work

Option 1 adds one commit to the branch. Option 2 adds a larger one. Option 3 deletes the branch.

Blocks: handoff #1957, and the pull request from feature/auto-1910 that would carry #1910's scan.

Activity

  1. added
    agents
    decision
    on Sep 29, 2026
  2. ptr727 commented on Sep 29, 2026

    @ptr727
    OwnerAuthor

    Answered by the maintainer: option 1, grant one more round. Add the guard in _redirects_stdin refusing a shell-operator token as a redirect target, add the selftest case, run a fourth pass, and drive the pull request if it finds nothing introduced.

  3. removed
    decision
    on Sep 29, 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

    agents

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions