[BUG] Bash permission pattern breaks when command contains parentheses

Resolved 💬 7 comments Opened Mar 10, 2026 by koby08 Closed Apr 9, 2026

Preflight Checklist

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

What's Wrong?

Any ( or ) character in a Bash command causes the permission allow-list matching to fail, even when the command should match a Bash(... **) pattern.

What Should Happen?

Parentheses in command strings should be treated as literal characters during permission matching. For example, with "Bash(cat **)" in the allow list, cat 'hello()' should be auto-allowed just like cat 'hello' is.

Error Messages/Logs

Steps to Reproduce

  1. Add "Bash(cat **)" to the permissions.allow list in .claude/settings.json:
  {
    "permissions": {
      "allow": [
        "Bash(cat **)"
      ]
    }
  }
  1. Test various commands:

| Command | Expected | Actual |
|------------------|--------------|--------------|
| cat 'hello' | Auto-allowed | Auto-allowed |
| cat 'bla () bla' | Auto-allowed | Auto-allowed |
| cat 'hello()' | Auto-allowed | Prompts |
| cat 'bla(x)' | Auto-allowed | Prompts |
| cat 'bla)' | Auto-allowed | Prompts |
| cat 'bla(' | Auto-allowed | Prompts |
| cat '(bla' | Auto-allowed | Prompts |
| cat ')bla' | Auto-allowed | Prompts |
| cat 'bla(bla' | Auto-allowed | Prompts |
| cat 'hello() ' | Auto-allowed | Auto-allowed |

  1. Any ( or ) in the command breaks matching — except when surrounded by spaces (e.g. bla () bla).
  2. Workaround: Append a trailing space to commands that contain parentheses:

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.72 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

_No response_

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗