Skip to content

Read a Drive-Letter Push Target as Local Only on Windows in the Write Guard #3317

Closed

Description

@ptr727

Problem

The write guard reads a push target that starts with a drive letter and a colon, such as C:x/y, as a local path on every platform. That is how Git for Windows reads it. Git on Linux and macOS checks the drive prefix only on Windows. So on those hosts g:example/beta is an ssh URL to the host alias g, naming the repository example/beta.

The guard reads such a push's target repository as undetermined. For main, master, and develop that denies, which is safe. For any other branch, undetermined rules allow the push. So the target repository's own ruleset is not read there, for example a release/* rule on a non-origin remote reached through a one-letter ssh host alias.

Found by the local review on the pull request closing #3048. Per that lane's rule, a change to a denial the lane added is filed rather than narrowed in the same pull request. Gating the match would narrow the protected-default denial on Linux while it widens the non-default read.

Reproduction (constructed repository, Linux)

  1. A checkout whose origin's release/1 has no rule, with a remote repository example/beta whose release/1 requires a pull request.
  2. Classify git push g:example/beta release/1 there.

The guard allows it. Git pushes over ssh to host g, writing release/1 in example/beta.

Possible Direction

Gate the drive-letter match on Windows, as _MSYS_DRIVE_PATHS already gates the drive spelling. Then a one-letter ssh host on Linux resolves to the repository it names.

🤖 Generated with Claude Code

Activity

  1. added
    bug
    script
    on Oct 21, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed as out of the write guard's scope under the maintainer's decision (ptr727, 2026-10-23) on #3391, item 1. The guard bounds a good-faith agent's mistake rather than an adversary, so a parse gap reached only by a command shape no agent plausibly types in a coding session is closed rather than fixed, and the guard's own growth is a cost each later review pays again. The scope statement lands in the guard's docstring and README under #3391. Reopen only with a command a session actually produced.

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

    bugscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions