Skip to content

Read Commands an Outer Variable Adds to a Double-Quoted Wrapper Body in the Write Guard #3337

Closed

Description

@ptr727

Context

Found while working #3075, which reads a run-time word in a double-quoted wrapper body as one word splitting may split. Develop's guard shares it, and it was confirmed by reading _embedded_wrapper_commands and with a classify probe on a constructed command.

A Double-Quoted Wrapper Body Can Carry Whole Commands an Outer Variable Supplies

The outer shell expands a $ word inside a double-quoted -c body before the inner shell parses it. A value holding a separator therefore adds commands the guard never sees:

  • B="x; git push origin develop"; sh -c "echo $B" is allowed. The inner shell runs echo x; git push origin develop.

#3075 closes the narrower case where the expansion only adds words to a merge or a commit. This one adds whole commands, so it reaches every rule that reads wrapper bodies.

Decision Needed

Failing closed on every double-quoted wrapper body holding an outer-expanded $ word would also deny ordinary commands such as bash -c "cd $DIR && git status". The options are:

  • Recommended: fail closed only where the body runs git or gh. A body that names neither cannot reach a git or gh rule, and a body that does is where an injected command matters.
  • Fail closed on every such body, accepting the false denies.
  • Leave it, since an agent writing such a command by mistake is unlikely, and record it as an accepted gap in the README.

Activity

  1. added
    bug
    decision
    pre-existing
    script
    on Oct 22, 2026
  2. ptr727 commented on Oct 22, 2026

    @ptr727
    OwnerAuthor

    Decision (maintainer, 2026-10-22): fail closed only where the double-quoted wrapper body runs git or gh. A body that runs neither keeps its current verdict, so an ordinary body such as bash -c "cd $DIR && ls" is not denied for its outer expansion alone.

    The decision label is removed. This issue stays open as guard work under that ruling, and it queues with the remaining allow-gap lanes on the engineering handoff track.

  3. removed
    decision
    on Oct 22, 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

    bugpre-existingscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions