File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44#
55# Exports: TOOL_NAME, COMMAND
66# Exits 0 (allow) immediately if the tool is not bash or if there is no command.
7+ #
8+ # IMPORTANT: Do NOT use `set -e` here. These hooks must fail-open — if anything
9+ # goes wrong (bad input, missing jq, unexpected payload shape), we exit 0 (allow)
10+ # rather than erroring out and blocking all tool calls.
711
8- set -e
12+ # Trap: any unexpected error → allow (fail-open, not fail-closed)
13+ trap ' exit 0' ERR
914
1015_INPUT=$( cat 2> /dev/null || true)
1116
17+ # If input is empty or not valid JSON, allow
18+ if [ -z " $_INPUT " ] || ! echo " $_INPUT " | jq empty 2> /dev/null; then
19+ exit 0
20+ fi
21+
1222# Defensive: handle missing or malformed JSON gracefully
1323TOOL_NAME=$( echo " $_INPUT " | jq -r ' .toolName // empty' 2> /dev/null || true)
1424if [ " $TOOL_NAME " != " bash" ]; then
You can’t perform that action at this time.
0 commit comments