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
fix(agents): the push gate misses gh pr new and the REST/GraphQL forms of PR operations #790
.claude/hooks/agent-bash-gate.sh checks PR operations by matching the gh pr … subcommands and a few gh api shapes. Six ordinary forms of the same operations pass it unchecked. The gate's stated goal is guarding against accidents, not deliberate workarounds, and these are forms an agent can reach for naturally (an alias, or the REST/GraphQL API after a gh pr command was refused).
Forms the gate lets through
Measured on a branch based on main (6c80008), each returning exit 0 from the gate. Repro from the repo root:
gate() { jq -nc --arg c "$1"'{tool_input:{command:$c}}'| CLAUDE_PROJECT_DIR=$PWD .claude/hooks/agent-bash-gate.sh;echo"rc=$?"; }
What it does
Command
What the gate should have required
Creates a PR via the new alias
gate 'gh pr new --title "Bad title."'
--draft and a valid title, as for gh pr create
Approves a PR through REST
gate 'gh api repos/o/r/pulls/12/reviews -f event=APPROVE'
the same block as gh pr review --approve (also event=REQUEST_CHANGES with -X POST)
Creates a non-draft PR through REST
gate 'gh api repos/o/r/pulls -f head=feat -f base=main -f title=x'
gate 'gh api repos/o/r/pulls/12/requested_reviewers -f reviewers[]=someone'
the same block as gh pr edit --add-reviewer (the check expects -X POST, --method, or a literal -f reviewers=, but -f already implies POST and the array form is reviewers[]=)
Merges through REST
gate 'gh api -X PUT repos/o/r/pulls/12/merge'
whatever governs gh pr merge (today only a Bash(gh pr merge:*) permission rule, which the API form doesn't match)
Controls, which the gate does block (exit 2): gh pr create without --draft, gh pr ready, gh pr review --approve, gh pr edit --add-reviewer, and gh api -X POST …/requested_reviewers.
Related
#755 (the current gate), #787 (the gate failing open when its script is missing), #740
Activity