fix(claude): deny destructive commands in both shell tools
Claude offers Bash and PowerShell tools on Windows, but each package denied git reset --hard, git clean, and recursive deletes only for its own shell. A live test ran git reset --hard through Bash under the PowerShell package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cceb9e4839
commit
9fc6dc8038
2 files changed
+4
-7
No files matched your search
@@ -204,11 +204,11 @@ for client in codex claude; do
|
||||
fi
|
||||
path="$output/$client-$shell/$file"
|
||||
content=$(<"$path")
|
||||
# Claude can offer both shell tools on Windows, so every package denies the destructive commands in both.
|
||||
deny_rules='["PowerShell(git reset --hard*)","PowerShell(git clean*)","PowerShell(Remove-Item *-Recurse*)","Bash(git reset --hard*)","Bash(git clean*)","Bash(rm -rf*)"]'
|
||||
if [ "$shell" = powershell ]; then
|
||||
deny_rules='["PowerShell(git reset --hard*)","PowerShell(git clean*)","PowerShell(Remove-Item *-Recurse*)"]'
|
||||
allow_rules='["Agent","PowerShell(mcporter call context7.*)"]'
|
||||
else
|
||||
deny_rules='["Bash(git reset --hard*)","Bash(git clean*)","Bash(rm -rf*)"]'
|
||||
allow_rules='["Agent","Bash(mcporter call context7.*)"]'
|
||||
fi
|
||||
content=${content//__HOOK_COMMAND__/$command}
|
||||
|
||||
Reference in new issue
Block a user