[BUG] git commit via heredoc bypasses Bash permission check when not in allowedTools

Resolved 💬 3 comments Opened Apr 2, 2026 by haw-Condat Closed Apr 5, 2026

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)

  1. Ensure ~/.claude/settings.json has an explicit allowedTools list that does not include git commit or any pattern that would match it (e.g., no git * wildcard)
  2. Ensure --dangerously-skip-permissions is not used
  3. Ensure no .claude/settings.json exists in the project directory
  4. Ensure no PreToolUse hooks are configured that would auto-approve Bash commands
  5. Ask Claude Code to create a git commit
  6. Claude Code runs a Bash command like:

```bash
git commit -m "$(cat <<'EOF'
Commit message here.

Co-Authored-By: ...
EOF
)"
```

  1. Expected: Permission prompt is shown before execution
  2. Actual: Command executes immediately without prompting

View original on GitHub ↗

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