You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refuse Brace-Expanded Blanket Adds in the Write Guard and Pin Its Glob-Character Exception #4514
PR #4511 (for #4462 and #4501, merged as ee90b1d8) added README requirement 11 to host-setup/agent-safety/claude/gh-write-guard.py, the blanket git add and commit -a refusal in any checkout with an origin. Its final local review left two gaps. The maintainer chose to file them rather than hold the merge (2026-11-27).
No selftest pins the glob-character exception. A path holding a glob character passes only where it names an existing file that no other file matches as a glob. Two review passes disagreed on whether git needs that strictness, and the strict form was kept untested.
Declined at the same review, so not owed here: the mkdir-then-add race (#4462's answer), and git commit --mess "fix docs/" read as a directory pathspec, a low-impact false refusal of an abbreviated option.
Constraint
gh-write-guard.py is at 2498 of the 2500 lines tests/test_guard_size.py allows, after #4511 compacted the selftest tables. A fix first makes room by further compaction, or by the sibling-module split the maintainer allowed on #4462 if compaction frees too little. That split changes install.py. The ceiling is not raised.
Done looks like
A brace-expanded blanket form is refused under both requirements 6 and 11, with selftest cases.
A selftest case pins the glob-character exception either way it is decided.
The file is under host-setup/agent-safety/, so a fix runs attended and its merge waits on the maintainer reading the diff.
Added from Copilot's round on promotion #4515 (2026-11-27):gh-write-guard.py around line 1272. A path naming a file literally called :secret, or one wrapped in backticks, reads as literal, so the not lit guard lets it through. It is a variant of item 2's glob and run-time-word handling. Done also looks like a selftest case refusing it, or a recorded reason it is safe.
Added from CodeRabbit's round on promotion #4515 (2026-11-27), deferred here at the maintainer's choice:
Nested glob (gh-write-guard.py around line 1269). The singleton-glob exception uses Python's nonrecursive glob, but git's pathspec matches nested paths too. A file literally named src/*.py, beside src/nested/extra.py, passes while git would stage both. This is part of item 2.
--dry-run --no-dry-run (around line 1290). It is exempted as a dry run, but the last flag wins, so it stages. The fix is small.
The selftest's unquoted temp --git-dir (around line 2098). A temp path holding a space fails the selftest.
Declined at the same round: a path that does not exist yet being accepted inside a compound command (mkdir generated && ... && git add generated). It is the same class as the mkdir-then-add race declined on #4462, a compound command that changes the tree after the check, which is not the accident the guard exists for.
Activity
ptr727 commentedon Nov 27, 2026
Added from Copilot's round on promotion #4515 (2026-11-27):
gh-write-guard.pyaround line 1272. A path naming a file literally called:secret, or one wrapped in backticks, reads asliteral, so thenot litguard lets it through. It is a variant of item 2's glob and run-time-word handling. Done also looks like a selftest case refusing it, or a recorded reason it is safe.ptr727 commentedon Nov 27, 2026
Added from CodeRabbit's round on promotion #4515 (2026-11-27), deferred here at the maintainer's choice:
gh-write-guard.pyaround line 1269). The singleton-glob exception uses Python's nonrecursive glob, but git's pathspec matches nested paths too. A file literally namedsrc/*.py, besidesrc/nested/extra.py, passes while git would stage both. This is part of item 2.--dry-run --no-dry-run(around line 1290). It is exempted as a dry run, but the last flag wins, so it stages. The fix is small.--git-dir(around line 2098). A temp path holding a space fails the selftest.Declined at the same round: a path that does not exist yet being accepted inside a compound command (
mkdir generated && ... && git add generated). It is the same class as the mkdir-then-add race declined on #4462, a compound command that changes the tree after the check, which is not the accident the guard exists for.Deny Environment Hook-Path Overrides and Brace-Expanded Blanket Adds …
Expand Stepped and Signed Brace Ranges in the Write Guard (#4596)