-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Description
Environment
- Platform (select one): Anthropic API
- Claude CLI version: 1.0.2
- Operating System: macOS 15.4.1
- Terminal: all
Bug Description
allowed-tools doesn't seem to be respected by commands combined by | && ;.
Steps to Reproduce
Here's a snippet of one section of my allowed-tools settings:

You can see I have nothing denied:

But none of these allowed tool permissions are honored if the command is combined (even if combining two allowed commands), nor will they allow me to accept the combination.
The end result is repeatedly approving benign tool usage that has already been allowed—chiefly "run tests and grep"
Expected Behavior
I absolutely understand and respect the security consideration of only honoring allowed-tools for commands without | && ; , but let me suggest:
- If a user has approved the initial command and the command used after the pipe, it should be allowed by default. It's completely surprising behavior otherwise. Similarly, if a user manually sets a pattern of
*it is reasonable to expect that means literally anything—and if that*ends at one of|&&;that should be clear when manually creating patterns. - Perhaps there should be a setting to explicitly enable honoring
allowed-toolsrules for combined/piped commands—if you see reasons that the specific combination is a unique attack vector. (Which is totally plausible; I haven't thought about it.) - In the absence of any of the above, we should specifically have patterns for combined commands.
Actual Behavior
Requires approval again for commands I have technically already approved.
Additional Context
This functionality is especially necessary in Claude 4 (and as Claude Code has seemed to have gained some better internal prompts for handling massive test runs by parsing them with greps), as Claude tends to run a lot more commands filtered by pipes.