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:
Julian lechnerandClaude Opus 5.5 committed 2026-10-01 13:59:10 +02:00
1 parent cceb9e4839
commit 9fc6dc8038
2 files changed
+4 -7

No files matched your search

+2 -5
View File
@@ -202,11 +202,8 @@ foreach ($shell in @('powershell','bash')) {
$script = if ($shell -eq 'powershell') { 'flashbang.ps1' } else { 'flashbang.sh' }
$statusLineScript = if ($shell -eq 'powershell') { 'statusline.ps1' } else { 'statusline.sh' }
$content = Get-Content -LiteralPath $path -Raw
$denyRules = if ($shell -eq 'powershell') {
@('PowerShell(git reset --hard*)','PowerShell(git clean*)','PowerShell(Remove-Item *-Recurse*)')
} else {
@('Bash(git reset --hard*)','Bash(git clean*)','Bash(rm -rf*)')
}
# Claude can offer both shell tools on Windows, so every package denies the destructive commands in both.
$denyRules = @('PowerShell(git reset --hard*)','PowerShell(git clean*)','PowerShell(Remove-Item *-Recurse*)','Bash(git reset --hard*)','Bash(git clean*)','Bash(rm -rf*)')
$denyRulesJson = ConvertTo-Json -InputObject $denyRules -Compress
$shellTool = if ($shell -eq 'powershell') { 'PowerShell' } else { 'Bash' }
$allowRulesJson = ConvertTo-Json -InputObject @('Agent', "$shellTool(mcporter call context7.*)") -Compress