[BUG] PowerShell allow rule with trailing wildcard does not pre-approve matching commands
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?
PowerShell(dotnet.exe build *) in the allow list doesn't pre-approve dotnet.exe build --help. I still get a permission prompt.
The exact-match form works fine. PowerShell(dotnet.exe --version) correctly suppresses the prompt for dotnet.exe --version, so the loader is reading the rules. Just the trailing-wildcard prefix doesn't match.
The docs say PowerShell rules use the same shape as Bash and trailing * matches "a space or end-of-string", so this should work.
What Should Happen?
PowerShell(dotnet.exe build *) should pre-approve any dotnet.exe build ... command without a prompt.
Error Messages/Logs
Steps to Reproduce
- Put this in
~/.claude/settings.json:
{
"permissions": {
"allow": [
"PowerShell(dotnet.exe build *)",
"PowerShell(dotnet.exe --version)"
]
}
}
- Restart Claude Code.
- Run
dotnet.exe build --helpvia the PowerShell tool. Prompts.
- Run
dotnet.exe --version. Doesn't prompt.
- Pick option 2 on the prompt from step 3. Claude writes
PowerShell(dotnet.exe build --help)(exact match) tosettings.local.json. That exact command stops prompting, butdotnet.exe build --version-suffix foostill prompts.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.143 (Claude Code)
Platform
AWS Bedrock
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Also tried (none match):
PowerShell(dotnet build *)without.exePowerShell(dotnet.exe build:*)colon form
Bare-cmdlet rules like PowerShell(Get-ChildItem *) work as documented. Seems specific to native exes with a positional subcommand.
Related: #52606 (docs gap on PowerShell wildcard behavior).
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗