Skip to content

[BUG] Respect allowed-tools when using combined / piped tool commands #1271

@adamavenir

Description

@adamavenir

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:
Image

You can see I have nothing denied:
Image

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.

Image Image Image

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:

  1. 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.
  2. Perhaps there should be a setting to explicitly enable honoring allowed-tools rules 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.)
  3. 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions