Skip to content

The Guard's eval Prefix Walk Misses a Redirected Runner and a Spaced Subscript #2446

Closed as not planned

Description

@ptr727

Problem

The guard's eval reading (#2080) walks back from an eval over the prefixes bash allows before it. Two prefixes it does not recognize leave the eval unread, although bash runs it.

  • A redirection between command or builtin and its options. The walk reads options only as a run of dash words directly after the runner.
  • An array subscript holding unquoted spaces. The tokenizer splits a[1 + 1]=x into several words, so no one word reads as an assignment. Bash reads it as one word, reports "not a valid identifier", and still runs the command after it. The bash -c path already denies the same prefix.

Reproduce (constructed)

Each of these is allowed, and bash runs the loop:

command 2>f -p eval 'until false; do sleep 1; done'
builtin 2>f -- eval 'until false; do sleep 1; done'
a[1 + 1]=x eval 'until false; do sleep 1; done'
a[ 0 ]=1 eval 'until false; do sleep 1; done'

Done looks like

Each command above is denied and pinned by a self-test row. Separately, _eval_payload moves a word that str.isdigit accepts into the redirection list without the ASCII check _runs_eval makes, and without knowing whether it touched the redirection. No verdict is known to change from that, but the two readers should agree on what an fd is.

Found by a local strict review pass on the #2080 branch. Develop allows each command too, since it reads no eval argument at all.

Activity

  1. added
    bugSomething isn't working
    agentsAgents instructions
    on Oct 6, 2026
  2. ptr727 commented on Oct 6, 2026

    @ptr727
    OwnerAuthor

    _runs_eval has the same adjacency gap as _eval_payload. Its fd skip accepts a digit word before a redirection whether or not the two touch, so 2 >f eval 'until false; do sleep 1; done' is denied. Bash runs a command named 2 there, which fails with 127, and no eval runs. This is a false deny, in the safe direction. Both sites need the source adjacency the tokens drop.

    Raised again by Copilot on #2452.

  3. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Declined per #2517, approved by the maintainer, under GOVERNANCE.md "Trust Boundaries and Hardening Effort": A redirected runner or a spaced subscript ahead of eval is not an agent shape.

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

    agentsAgents instructionsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions