mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-27 12:40:32 +00:00
fix: Bash permission rules should only match Bash tool calls
Previously, a Bash(...) permission rule would incorrectly match against any tool. The code checked if the rule was a Bash rule, but didn't verify that the tool being invoked was actually the Bash tool. This caused Bash rules like `Bash(./inbox:*)` to inadvertently allow Edit/Write operations on files matching the pattern, since the rule's argument would be interpreted as a glob pattern against file paths. The fix adds a check to ensure Bash rules only apply when the tool being called is mcp__acp__Bash. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -156,7 +156,7 @@ function matchesRule(rule: ParsedRule, toolName: string, toolInput: unknown, cwd
|
||||
// - "Claude will make a best-effort attempt to apply Read rules to all built-in tools
|
||||
// that read files like Grep, Glob, and LS."
|
||||
const ruleAppliesToTool =
|
||||
rule.toolName === "Bash" ||
|
||||
(rule.toolName === "Bash" && toolName === acpToolNames.bash) ||
|
||||
(rule.toolName === "Edit" && FILE_EDITING_TOOLS.includes(toolName)) ||
|
||||
(rule.toolName === "Read" && FILE_READING_TOOLS.includes(toolName));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user