Skip to content

fix(filesystem): fix UNC path subdirectory access denied - #3633

Closed
ghost wants to merge 1 commit into
mainfrom
unknown repository
Closed

fix(filesystem): fix UNC path subdirectory access denied#3633
ghost wants to merge 1 commit into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Mar 18, 2026

Copy link
Copy Markdown

Problem

UNC paths like \\192.168.4.96\Mega work at the root level but accessing any subdirectory (e.g. \\192.168.4.96\Mega\Drops) returns "Access denied - path outside allowed directories".

Root Cause

isPathWithinAllowedDirectories in path-validation.ts uses path.resolve(path.normalize(dir)) directly, which can mangle UNC paths by stripping or altering the leading \\ prefix. The rest of the codebase uses normalizePath() which explicitly preserves UNC prefixes (see path-utils.ts lines 66-92).

This means the allowed directory is normalized differently in the validation check than in the actual file operations, causing the startsWith() prefix check to fail.

Fix

Use normalizePath() for both the input path and allowed directory normalization in isPathWithinAllowedDirectories, ensuring consistent UNC path handling.

Fixes #3527

…pport

isPathWithinAllowedDirectories used path.resolve(path.normalize())
directly, which can mangle UNC paths (\\server\share) by stripping
the leading double backslash. The rest of the codebase uses
normalizePath() which preserves UNC prefixes.

Now uses normalizePath() for both the input path and allowed
directory normalization, ensuring consistent handling of UNC paths
in the subdirectory prefix check.

Fixes #3527
@ghost ghost closed this by deleting the head repository Mar 26, 2026
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UNC/network share paths (\\server\share\subdir) fail access check despite being under allowed directory

1 participant