claude-code - 💡(How to fix) Fix UNC path check false-positive blocks WSL paths even with bypassPermissions [2 comments, 3 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#49119Fetched 2026-04-17 08:50:20
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2

Root Cause

In cli.js, function om() detects UNC paths with this regex:

if (/\\\\[^\s\\/]+(?:@(?:\d+|ssl))?(?:[\\/]|$|\s)/i.test(q)) return true

This matches \\wsl.localhost\... the same as \\remote-server\.... The result is returned with classifierApprovable: false, which means bypass permissions cannot override it.

WSL paths are localwsl.localhost and wsl$ are Windows-native virtual filesystem mounts, not network resources. They should be whitelisted.

Code Example

Claude requested permissions to write to \\wsl.localhost\Ubuntu-24.04\home\mav\..., 
which contains a suspicious Windows path pattern that requires manual approval.

---

if (/\\\\[^\s\\/]+(?:@(?:\d+|ssl))?(?:[\\/]|$|\s)/i.test(q)) return true

---

function om(q) {
  if (N1() !== "windows") return false;
  // WSL paths are local, not network
  if (/^\\\\(wsl\.localhost|wsl\$)\\/i.test(q)) return false;
  if (/^\/\/(wsl\.localhost|wsl\$)\//i.test(q)) return false;
  // ... rest of checks
}
RAW_BUFFERClick to expand / collapse

Problem

On Windows with WSL2, all file operations targeting WSL paths (\\wsl.localhost\Ubuntu-24.04\... or \\wsl$\Ubuntu-24.04\...) trigger a "suspicious Windows path pattern" prompt that cannot be bypassed — even with permissionMode: "bypassPermissions", skipDangerousModePermissionPrompt: true, and explicit allow rules for every UNC path variant.

The message:

Claude requested permissions to write to \\wsl.localhost\Ubuntu-24.04\home\mav\..., 
which contains a suspicious Windows path pattern that requires manual approval.

Root Cause

In cli.js, function om() detects UNC paths with this regex:

if (/\\\\[^\s\\/]+(?:@(?:\d+|ssl))?(?:[\\/]|$|\s)/i.test(q)) return true

This matches \\wsl.localhost\... the same as \\remote-server\.... The result is returned with classifierApprovable: false, which means bypass permissions cannot override it.

WSL paths are localwsl.localhost and wsl$ are Windows-native virtual filesystem mounts, not network resources. They should be whitelisted.

Impact

Any developer on Windows using WSL2 (which is the standard Docker/Linux dev setup on Windows) gets permission prompts on every file edit. This makes Claude Code significantly harder to use for the large population of Windows+WSL2 developers.

Suggested Fix

Whitelist \\wsl.localhost\ and \\wsl$\ prefixes in the UNC path check, since they are guaranteed-local filesystem mounts:

function om(q) {
  if (N1() !== "windows") return false;
  // WSL paths are local, not network
  if (/^\\\\(wsl\.localhost|wsl\$)\\/i.test(q)) return false;
  if (/^\/\/(wsl\.localhost|wsl\$)\//i.test(q)) return false;
  // ... rest of checks
}

Environment

  • Windows 11 + WSL2 (Ubuntu 24.04)
  • Claude Code v2.1.94
  • Settings: permissionMode: "bypassPermissions", explicit allow rules for all UNC path variants in permissions.allow

extent analysis

TL;DR

Whitelisting \\wsl.localhost\ and \\wsl$\ prefixes in the UNC path check is likely to fix the issue.

Guidance

  • Update the om() function in cli.js to include the suggested whitelist for WSL paths, as shown in the provided code snippet.
  • Verify that the whitelist correctly identifies WSL paths by testing with various \\wsl.localhost\ and \\wsl$\ path variants.
  • Ensure that the permissionMode is set to "bypassPermissions" and explicit allow rules are configured for all UNC path variants in permissions.allow.
  • Test the changes with a sample file operation targeting a WSL path to confirm that the "suspicious Windows path pattern" prompt is no longer triggered.

Example

function om(q) {
  if (N1() !== "windows") return false;
  // WSL paths are local, not network
  if (/^\\\\(wsl\.localhost|wsl\$)\\/i.test(q)) return false;
  if (/^\/\/(wsl\.localhost|wsl\$)\//i.test(q)) return false;
  // ... rest of checks
}

Notes

The suggested fix assumes that the om() function is the sole cause of the issue. If other factors are contributing to the problem, additional modifications may be necessary.

Recommendation

Apply the suggested whitelist workaround to the om() function, as it directly addresses the root cause of the issue and should resolve the "suspicious Windows path pattern" prompt for WSL paths.

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

claude-code - 💡(How to fix) Fix UNC path check false-positive blocks WSL paths even with bypassPermissions [2 comments, 3 participants]