claude-code - 💡(How to fix) Fix [Bug] Bash AST parser warning bypasses sandbox auto-approve mode [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#45421Fetched 2026-04-09 08:05:50
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×6closed ×1commented ×1

Root Cause

Root cause (suspected): The bash command goes through an AST parser to isolate individual commands before being passed to the permissions module. The permissions module is where auto-approve takes effect. But the AST parser raises this warning at a layer above the permissions check, short-circuiting auto-approve.

Code Example

python -c "print('here')
  # That should have printed here
  "
RAW_BUFFERClick to expand / collapse

Bug Description Newline followed by # inside a quoted argument can hide arguments from path validation

Bug: Bash AST parser prompts user despite sandbox auto-approve mode

Reproduction:

  1. Enable sandbox auto-approve mode (via /permissions or /sandbox)
  2. Have Claude Code run a bash command containing a newline followed by # inside a quoted argument:
  python -c "print('here')
  # That should have printed here
  "
  1. User is prompted with: Newline followed by # inside a quoted argument can hide arguments from path validation

Expected: No prompt — auto-approve is on, so any command would be approved by the permissions module regardless.

Root cause (suspected): The bash command goes through an AST parser to isolate individual commands before being passed to the permissions module. The permissions module is where auto-approve takes effect. But the AST parser raises this warning at a layer above the permissions check, short-circuiting auto-approve.

The check makes sense when commands are not auto-approved — it flags potentially hidden arguments before the user manually reviews. But when auto-approve is active, it's just noise.

Environment Info

  • Platform: linux
  • Terminal: ghostty
  • Version: 2.1.96
  • Feedback ID: da87d51f-010f-4704-b03d-eb584d941ccc

extent analysis

TL;DR

Modify the Bash AST parser to bypass the path validation check when sandbox auto-approve mode is enabled.

Guidance

  • Identify the specific condition in the AST parser that triggers the warning and add a check for sandbox auto-approve mode to suppress it.
  • Verify that the permissions module correctly handles commands with newlines followed by # inside quoted arguments when auto-approve is enabled.
  • Consider adding a configuration option to control the behavior of the AST parser in auto-approve mode.
  • Review the code to ensure that the fix does not introduce any security vulnerabilities.

Example

No explicit code example is provided due to the lack of specific implementation details in the issue.

Notes

The fix may require modifications to the Bash AST parser and the permissions module. It is essential to thoroughly test the changes to ensure that they do not introduce any regressions or security issues.

Recommendation

Apply workaround: Modify the AST parser to bypass the path validation check when sandbox auto-approve mode is enabled, as this approach directly addresses the reported issue without requiring a version upgrade.

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