Commit 259011f
fix: guardrail hooks fail-open instead of fail-closed
Remove `set -e` from _common.sh and add `trap 'exit 0' ERR` so that
unexpected errors (empty input, malformed JSON, non-bash tool payloads)
result in allowing the tool call rather than blocking it.
Previously, when non-bash MCP tools (e.g. Zendesk, GitHub MCP) triggered
the preToolUse hooks, the script could error out before reaching the
'toolName != bash' check. The CLI interprets hook errors as denials,
which blocked ALL tool calls — including reads, shell commands, and MCP.
Also adds early JSON validation: if input is empty or invalid JSON, exit
immediately with allow.
Fixes #579
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 0ea0456 commit 259011f
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | | - | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
12 | 22 | | |
13 | 23 | | |
14 | 24 | | |
| |||
0 commit comments