[BUG] git commit via heredoc bypasses Bash permission check when not in allowedTools
What's wrong?
When running git commit -m "$(cat <<'INNEREOF' ... INNEREOF)" (heredoc-style commit message), the command executes without prompting the user for confirmation, even though git commit is not in the allowedTools list in ~/.claude/settings.json. The permission checker appears to fail to match the multi-line heredoc/subshell command against Bash permission patterns, falling through to "allow" instead of "prompt".
What should happen?
The user should be shown a confirmation prompt before the command executes, since git commit is not in the allowed tools list. Any git commit invocation — regardless of how the message is passed (inline string, heredoc, subshell substitution) — should be subject to the same permission check.
Error Messages/Logs
No error messages — that's the problem. The command executed silently without any permission prompt.
Steps to reproduce
2.1.90 (Claude Code)
- Ensure
~/.claude/settings.jsonhas an explicitallowedToolslist that does not includegit commitor any pattern that would match it (e.g., nogit *wildcard) - Ensure
--dangerously-skip-permissionsis not used - Ensure no
.claude/settings.jsonexists in the project directory - Ensure no
PreToolUsehooks are configured that would auto-approve Bash commands - Ask Claude Code to create a git commit
- Claude Code runs a Bash command like:
```bash
git commit -m "$(cat <<'EOF'
Commit message here.
Co-Authored-By: ...
EOF
)"
```
- Expected: Permission prompt is shown before execution
- Actual: Command executes immediately without prompting
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗