Skip to content

Read Git's Environment Variable Names Without Case on Windows in the Write Guard #3086

Closed

Description

@ptr727

Problem

host-setup/agent-safety/claude/gh-write-guard.py reads git's environment variables by exact name: _CONFIG_FILE_ENV_VARS, _COMMAND_ENV_VARS, GIT_CONFIG_COUNT, GIT_CONFIG_PARAMETERS, and the GIT_CONFIG_KEY_<n>/GIT_CONFIG_VALUE_<n> pattern. Windows environment names are case-insensitive. So under Git Bash, a lowercase spelling may still reach Windows git.exe, and none of these checks would recognize it.

Constructed case, on Windows only:

git_config_count=1 git_config_key_0=alias.p git_config_value_0=push git p origin develop

The guard already reads git in any case for the same reason, because a case-insensitive filesystem resolves GIT to git.

Unverified

Whether Git Bash passes a lowercase name through so that git.exe reads it as GIT_CONFIG_COUNT has not been run on Windows. The first step is a native check: run the command above with a harmless alias, such as one expanding to status, and see whether git runs it.

Fix

Where the guard runs on Windows, compare environment names in one case, in each check above. Add case-variant self-test rows under the Windows regime.

Raised by Copilot on the develop -> main promotion #3064, against the environment readings #3058 added.

Activity

  1. added
    bug
    script
    on Oct 15, 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