claude-code - 💡(How to fix) Fix [Bug] Unsafe directory traversal attempt during /init - attempted parent directory access [4 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#45544Fetched 2026-04-09 08:02:55
View on GitHub
Comments
4
Participants
2
Timeline
7
Reactions
0
Timeline (top)
commented ×4labeled ×3

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description upon /init Claude tried to break out of the D:/code-projects/ACCESS-API/ directory by executing Bash(ls -la "D:/code-projects") the behavior to try and access the parent directory is unsafe, the user had to manually deny the request

Environment Info

  • Platform: win32
  • Terminal: windows-terminal
  • Version: 2.1.94
  • Feedback ID: c6346a97-9dc7-49eb-acba-8eba803e7791

Errors

[]

extent analysis

TL;DR

The issue may be resolved by properly handling directory traversal attempts in the /init endpoint.

Guidance

  • Review the /init endpoint code to ensure it correctly handles directory traversal attempts, such as ../ or absolute paths.
  • Consider implementing input validation and sanitization to prevent unauthorized access to parent directories.
  • Verify that the Bash(ls -la "D:/code-projects") command is necessary and cannot be replaced with a safer alternative.
  • Investigate if there are any existing security measures or configurations in the windows-terminal or win32 platform that can help mitigate this issue.

Notes

The provided error log is empty, which may indicate that the issue is not directly related to an error, but rather a security concern or unexpected behavior.

Recommendation

Apply workaround: Implement input validation and sanitization to prevent unauthorized access to parent directories, as upgrading to a fixed version is not clearly implied in the issue.

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