Skip to content

Read the Config-Change Scan's Remaining Run-Time, Eval, and Xargs Forms in the Write Guard #3307

Closed

Description

@ptr727

Context

Found by the local review passes on #3306, which added _config_may_change to close #3046. Develop allows every case below, so none is a regression against develop. Each is a form the new scan does not yet read.

Forms the Config-Change Scan Before a Push Does Not Read

host-setup/agent-safety/claude/gh-write-guard.py marks a push's remote mirror key and its checkout's origin unresolved after a command that may rewrite them. These still read as rewriting nothing.

  • A run-time command word behind a launcher or a loop keyword. _runs_run_time_word counts only the command _command_prefix names. So while "$CMD"; do :; done; git push --tags origin, flock /example/l "$CMD"; git push --tags origin, watch "$CMD"; ..., and coproc "$CMD"; ... are allowed. while and until are missing from _COMMAND_POSITION_WORDS, which _prefix_walk relies on.
  • An eval or source inside a wrapper body or a substitution. _names_config_change does not read the payload. So bash -c 'eval "$CMD"'; git push --tags origin and echo "$(eval 'git config remote.origin.mirror true')"; git push --tags origin are allowed. _eval_payload_texts already returns what an executed eval runs.
  • A -c wrapper whose body xargs supplies. _shell_reads_unread_script returns False whenever -c is present, so echo '...' | xargs -0 bash -c; git push --tags origin is allowed.

The Deny Message Names the Wrong Cause

When the scan marks the push's repository unresolved, the push to a protected-default branch is denied. The deny says "the repository this push runs in could not be determined" and suggests -C. For example, "$PY" scripts/validate.py && git push origin develop in a repository whose develop takes direct pushes. The real cause is an earlier command that may rewrite the remote config, and the remedy is to run the push as its own command.

Possible Direction

Read a run-time command word wherever _runs_as_command says it runs, while keeping an argument such as mkdir -p "$D" out of it. Read eval payloads in _names_config_change. Read a bodiless -c as unread input. Give the config-change case its own deny reason.

Activity

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

    @ptr727
    OwnerAuthor

    Two more config-change shapes from the local review of #3342, each allowed by develop and by that change:

    • echo remote.origin.mirror true | xargs git config; git push --tags origin. Words xargs appends turn a read-only-looking git config into a write. Read Words xargs Appends to a gh Write in the Write Guard #3336 covers the gh-write analogue.
    • echo git | xargs -I{} {} config remote.origin.mirror true; git push --tags origin. The replace string sits where the command goes, a run-time command word the scan does not read.
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