Skip to content

fix(filesystem): case-insensitive Windows allowed-path matching (#470) - #4683

Open
adityachaudhary99 wants to merge 1 commit into
modelcontextprotocol:mainfrom
adityachaudhary99:fix/filesystem-win-allowed-paths-470
Open

fix(filesystem): case-insensitive Windows allowed-path matching (#470)#4683
adityachaudhary99 wants to merge 1 commit into
modelcontextprotocol:mainfrom
adityachaudhary99:fix/filesystem-win-allowed-paths-470

Conversation

@adityachaudhary99

Copy link
Copy Markdown

Closes #470

On Windows, containment checks between allowed roots and requested paths were case-sensitive, so an allowed root like c:\source rejected requests to C:\source\file.md (drive-letter and component-case mismatches).

  • Canonicalize each allowed directory once at startup (path.resolve + realpathSync.native)
  • Case-fold both sides during prefix comparison on win32 only; POSIX behavior byte-exact
  • Extracted the decision into a pure isPathWithin() helper with segment-boundary semantics
  • New unit tests: drive-letter case mismatch, inner-component mismatch, traversal escapes still denied, POSIX parity

Tested locally on Windows 11: filesystem suite 92/92 green.

Copilot AI balanced review requested due to automatic review settings August 22, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Filesystem server access denied for allowed paths on Windows

2 participants