Permission Pattern Matching Fails for PHP Commands with Complex Arguments
Bug Description
Bug: Permission patterns in .claude/settings.json cannot match PHP commands with complex
arguments containing quotes and special characters
Issue Description
The permission system in .claude/settings.json fails to properly match PHP commands that
contain complex arguments with quotes, escapes, and special characters, even when using
wildcard patterns that should theoretically match all PHP commands.
Steps to Reproduce
- Add any of these patterns to the "allow" list in .claude/settings.json:
- "Bash(php:*)"
- "Bash(php *)"
- "Bash(php*)"
- "Bash(php)"
- "Bash(php artisan:*)"
- Try to execute a PHP command with quotes in the arguments:
php artisan tinker --execute="DB::table('users')->count()"
php artisan tinker --execute='User::where("email", "test@example.com")->first()'
php -r "echo 'test';"
- Claude Code will still prompt for permission despite the wildcard patterns that should
match these commands
Expected Behavior
Patterns like "Bash(php:)" or "Bash(php)" should match ANY command starting with "php",
including those with complex arguments containing quotes, escapes, and special
characters.
Actual Behavior
The permission system fails to match these commands and continues to prompt for user
approval, making it impossible to whitelist all PHP commands, especially php artisan
tinker commands that frequently use quotes for database queries and code execution.
Impact
This makes it difficult to automate PHP development tasks, particularly when agents need
to run database queries or execute PHP code through tinker. Users must manually approve
each command, disrupting workflow automation.
Workaround
Currently, the only workarounds are:
- Run Claude Code in bypassPermissions mode (but this disables ALL permission controls)
- Manually approve each command when prompted
- Avoid using complex PHP commands with quotes
Suggested Fix
The permission pattern matching system should properly handle commands where the
arguments contain special characters, quotes, and escapes. The wildcard pattern should
match based on the command prefix only, ignoring the complexity of the arguments that
follow.
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 1.0.72
- Feedback ID: 9111a33f-e805-4877-95f6-04b4c1d2b0e4
Errors
[{"error":"Error: Agent file /Users/basit/Work/donator.org/donator/.claude/agents/agent-backend.md has invalid model 'claude-opus-4-1-20250805'. Valid options: sonnet, opus, haiku, inherit\n at OY8 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2214:192)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2213:333\n at Array.map (<anonymous>)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2213:269\n at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2213:112\n at async VuB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3056:4)\n at async Object.prompt (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3128:1219)\n at async DRB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1733:191)\n at async Promise.all (index 0)\n at async Promise.all (index 0)","timestamp":"2025-08-10T14:39:59.085Z"},{"error":"Error: Agent file /Users/basit/Work/donator.org/donator/.claude/agents/agent-devops.md has invalid model 'claude-opus-4-1-20250805'. Valid options: sonnet, opus, haiku, inherit\n at OY8 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2214:192)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2213:333\n at Array.map (<anonymous>)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2213:269\n at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2213:112\n at async VuB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3056:4)\n at async Object.prompt (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3128:1219)\n at async DRB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1733:191)\n at async Promise.all (index 0)\n at async Promise.all (index 0)","timestamp":"2025-08-10T14:39:59.089Z"},{"error":"Error: Agent file /Users/basit/Work/donator.org/donator/.claude/agents/agent-frontend.md has invalid model 'claude-opus-4-1-20250805'. Valid options: sonnet, opus, haiku, inherit\n at OY8 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2214:192)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2213:333\n at Array.map (<anonymous>)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2213:269\n at async file:///opt/homebrew/lib/node_
Note: Error logs were truncated.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗