claude-code - 💡(How to fix) Fix Compound bash commands (cd && git show) not matching allow list patterns [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46977Fetched 2026-04-13 05:44:46
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Compound bash commands using && are not being auto-approved even though each individual command matches an allow list pattern.

Root Cause

Compound bash commands using && are not being auto-approved even though each individual command matches an allow list pattern.

Code Example

"additionalDirectories": ["/Users/.../Workspace/Veekday"]

---

cd /Users/.../Workspace/Veekday/por-su-standard-package && git show 6ed72bb --stat 2>&1 | head -30
RAW_BUFFERClick to expand / collapse

Description

Compound bash commands using && are not being auto-approved even though each individual command matches an allow list pattern.

Steps to Reproduce

  1. Have these patterns in settings.json allow list:

    • Bash(cd *)
    • Bash(git show *)
  2. Also have the target directory in additionalDirectories:

    "additionalDirectories": ["/Users/.../Workspace/Veekday"]
  3. A subagent runs a compound command like:

    cd /Users/.../Workspace/Veekday/por-su-standard-package && git show 6ed72bb --stat 2>&1 | head -30
  4. Expected: Auto-approved (both cd * and git show * are allowed)

  5. Actual: Prompts for manual approval

Environment

  • Claude Code (CLI, VSCode extension)
  • macOS
  • The command is typically run by a subagent during code review tasks

Notes

Both parts of the compound command individually match allow list patterns. It seems like the pattern matcher evaluates the full command string as a single unit rather than recognizing &&-chained commands where each part is independently allowed.

extent analysis

TL;DR

The issue can be resolved by modifying the allow list patterns to account for compound bash commands using && or by splitting the compound command into individual commands that match the existing allow list patterns.

Guidance

  • Review the settings.json allow list patterns to determine if they can be modified to support compound bash commands using &&.
  • Consider splitting the compound command into individual commands, such as running cd and git show separately, to see if they are auto-approved individually.
  • Verify that the additionalDirectories setting is correctly configured and that the target directory is included.
  • Test the pattern matcher with a simpler compound command to determine if it is specific to the cd and git show commands or a general issue with &&-chained commands.

Example

No specific code snippet is provided, but an example of a modified allow list pattern could be Bash(cd * && git *), although this may not be a valid or supported pattern.

Notes

The solution may depend on the specific implementation of the pattern matcher in Claude Code, which is not fully described in the issue. Additionally, modifying the allow list patterns or splitting the compound command may have security implications that should be carefully considered.

Recommendation

Apply a workaround, such as splitting the compound command into individual commands, as this is a more straightforward and potentially safer solution than modifying the allow list patterns.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING