Skip to content

Commit 3381528

Browse files
dguidoclaude
andcommitted
Simplify: keep hook regex, drop redundant deny rule permutations
The rewritten hook regex already handles all case/ordering variants of rm flags via case-insensitive chained grep checks. Remove the 16 enumerated permutations from deny rules. Drop overly broad * | sh and * | zsh rules that would block legitimate pipes. Revert unnecessary case-insensitive flag on git push hook (git is always lowercase). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 58b6f73 commit 3381528

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

settings.json

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,13 @@
1313
"deny": [
1414
"Bash(rm -rf *)",
1515
"Bash(rm -fr *)",
16-
"Bash(rm -Rf *)",
17-
"Bash(rm -rF *)",
18-
"Bash(rm -RF *)",
19-
"Bash(rm -fR *)",
20-
"Bash(rm -Fr *)",
21-
"Bash(rm -FR *)",
22-
"Bash(rm -r -f *)",
23-
"Bash(rm -r -F *)",
24-
"Bash(rm -R -f *)",
25-
"Bash(rm -R -F *)",
26-
"Bash(rm -f -r *)",
27-
"Bash(rm -f -R *)",
28-
"Bash(rm -F -r *)",
29-
"Bash(rm -F -R *)",
30-
"Bash(rm --recursive *)",
31-
"Bash(rm --recursive --force *)",
32-
"Bash(rm --force --recursive *)",
3316
"Bash(sudo *)",
3417
"Bash(mkfs *)",
3518
"Bash(dd *)",
3619
"Bash(curl *|bash*)",
3720
"Bash(curl *| bash*)",
3821
"Bash(wget *|bash*)",
3922
"Bash(wget *| bash*)",
40-
"Bash(* | sh)",
41-
"Bash(* | zsh)",
4223
"Bash(bash <(curl *))",
4324
"Bash(git push --force*)",
4425
"Bash(git push *--force*)",
@@ -79,7 +60,7 @@
7960
},
8061
{
8162
"type": "command",
82-
"command": "CMD=$(jq -r '.tool_input.command'); if echo \"$CMD\" | grep -qiE 'git[[:space:]]+push.*(main|master)'; then echo 'BLOCKED: Use feature branches, not direct push to main' >&2; exit 2; fi"
63+
"command": "CMD=$(jq -r '.tool_input.command'); if echo \"$CMD\" | grep -qE 'git[[:space:]]+push.*(main|master)'; then echo 'BLOCKED: Use feature branches, not direct push to main' >&2; exit 2; fi"
8364
}
8465
]
8566
}

0 commit comments

Comments
 (0)