Closed
Labels
enhancementNew feature or requestNew feature or requestserver-filesystemReference implementation for the Filesystem MCP server - src/filesystemReference implementation for the Filesystem MCP server - src/filesystemv2
Milestone
Description
Problem
Follow-up to #5375, which refuses NTFS alternate-data-stream paths (file.txt:stream) on Windows. A comment on that issue named two neighbouring classes of Windows path that the filesystem server's path validation (isPathWithinAllowedDirectories in src/filesystem/path-validation.ts) still accepts, and that were out of #5375's scope:
- Reserved device names:
C:\allowed\CON,C:\allowed\NUL,C:\allowed\COM1.txt,AUX,PRN,LPT1… Win32 maps these to devices rather than files in the directory, in any directory and with any extension (on older Windows releases), so a path that passes the containment check names something that is not inside the allowed directory at all. - Trailing dots and spaces: Win32 strips them from a final path component, so
C:\allowed\file.txt.andC:\allowed\file.txtname the same file asC:\allowed\file.txt. Two spellings of one file can defeat a check that compares names (an exclude pattern, say), and a file created through the\\?\prefix with a trailing dot cannot be opened the ordinary way afterwards.
Expected behavior
A decision, as on #5375. If the server should refuse them: on Windows, reject a path any of whose components is a reserved device name (with or without an extension), or ends in a dot or a space, with a clear error, tests (win32.test.ts-style simulation so they run on macOS and Linux CI) and a note in the filesystem README next to the alternate-data-stream note. POSIX hosts stay unaffected.
Context
- Suggested by the commenter on filesystem: decide whether to refuse NTFS alternate-data-stream paths (file:stream) on Windows #5375.
- The alternate-data-stream refusal is the PR for filesystem: decide whether to refuse NTFS alternate-data-stream paths (file:stream) on Windows #5375; the same place (
path-validation.ts) is the natural home for these checks.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestserver-filesystemReference implementation for the Filesystem MCP server - src/filesystemReference implementation for the Filesystem MCP server - src/filesystemv2
Activity
cliffhall commentedon Nov 5, 2026
Decision: refuse them, consistent with #5375. On Windows only, a path any of whose components is a reserved device name (
CON,PRN,AUX,NUL,COM1-COM9,LPT1-LPT9, plus the superscriptCOM¹-³/LPT¹-³; any case; with or without an extension) or ends in a dot or a space is refused with a specific "Access denied - …" error..and..components, the drive prefix and the\\.\prefix are not treated as trailing-dot names. POSIX hosts are unaffected.Implemented in #5458 (stacked on #5450).
feat(filesystem): refuse Windows device names and trailing dots/spaces