Skip to content

Read a Backtick-Opened or Run-Time Git Command Word in the Write Guard #2976

Closed

Description

@ptr727

Context

Found while closing #2959 and #2961. Each shape below is allowed by develop's guard and by the #2959/#2961 fix, since both read a git command only from a word the tokenizer gives as git. Each was found by a classify probe on constructed commands, with the branch rules given as a test seam.

Git Words the Guard Never Sees as Git

  • A backtick-opened git word. In x=`git push origin develop` and echo `git push origin develop` the tokenizer gives x=`git and `git, which _is_git_exe does not read as git, so no push is read. The $(...) form is read, since ( is an operator there.
  • A run-time command word. In G=git; $G push origin develop the command word is $G, so no push is read, and the same holds for "$GIT" push and `which git` push.

Possible Direction

Fail closed rather than model the expansion: read a word opening a backtick substitution with git after it as a git word, and deny a command whose command word holds a $ or a backtick where its next word is push or commit, with the explicit-refspec, own-command workaround the other unreadable denies name.

Activity

  1. ptr727 commented on Oct 14, 2026

    @ptr727
    OwnerAuthor

    A third shape in the same class, from Copilot on #2979: a git word inside a double-quoted command substitution, as in echo "$(git push origin develop)". The tokenizer keeps the quoted substitution as one word, so no git token forms and no push is read, on develop's guard and on #2979's. Reading the body of a quoted $(...) as a command, as a wrapper body is read, would close it.

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

    scriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions