Skip to content

[BUG] global/local settings.json allow permissions are not respected by Claude Code #13340

@AbdelrahmanHafez

Description

@AbdelrahmanHafez

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Piped bash commands prompt for permission even when ALL individual components are already allowed in settings.json.

I have many bash commands allowed in my global settings.json:

"Bash(ls:*)",
"Bash(awk:*)",
"Bash(wc:*)",
"Bash(echo:*)"

Each command works fine individually:

  • ls /some/path - works without prompting
  • awk --version - works without prompting

But piped commands prompt for permission even when ALL components are allowed:

  • ls /some/path | awk '{print $1}' - prompts for permission
  • echo "test" | wc -l - prompts for permission

This is because the permission system uses prefix matching on the entire command string. Bash(awk:*) only matches commands that START with awk, not commands where awk appears after a pipe.

What Should Happen?

If I run cmd1 | cmd2 | cmd3 and each of cmd1, cmd2, cmd3 individually matches an allowed pattern, the full piped command should be allowed without prompting. Same for &&, ||, and ;.

Steps to Reproduce

  1. Add bash command permissions to global or local settings.json:
    {
      "permissions": {
        "allow": [
          "Bash(ls:*)",
          "Bash(awk:*)",
          "Bash(wc:*)",
          "Bash(echo:*)"
        ]
      }
    }
  2. Ask Claude Code to run a simple allowed command like ls /tmp - it runs without prompting
  3. Ask Claude Code to run a piped command like ls /tmp | wc -l - it prompts for permission despite both ls and wc being individually allowed

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.0.61 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

I created a PreToolUse hook for a workaround, you can run npx claude-code-plus to get this behavior installed on your machine: claude-code-plus.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions