You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cd1ff88
Browse filesBrowse the repository at this point in the historyBrowse files
On Windows, `list_directory`, `list_directory_with_sizes`, `directory_tree` and `search_files` now check the directory they list before and after reading it: its path must have no junction or symlink on it and must name the same directory both times, or the call is refused with "Access denied - a directory on the path changed during the operation". A directory swapped for a junction after the path was validated is no longer listed. A swap made and undone while the directory is being read is still not detected; the README's "Limit on Windows" entry says what holds. macOS and Linux are unchanged.
`search_files` no longer answers a search that matched nothing with a bare `No matches found`. The result still begins with those words, and now names the pattern and the directory searched, says the pattern is a case-sensitive glob over names relative to that directory (never file contents), and, for a pattern with no `**`, suggests the `**/` form that reaches subdirectories.
Copy file name to clipboardExpand all lines: .claude/skills/pr-flow/evals/evals.json
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,10 @@
23
23
"prompt": "My PR into v2/main just merged. What do I still need to do to close it out?",
24
24
"expect": "pr-flow"
25
25
},
26
+
{
27
+
"prompt": "My PR is green and GitHub says it has no conflicts, but another PR for the same server merged into v2/main ten minutes ago. What do I have to do before it can merge?",
28
+
"expect": "pr-flow"
29
+
},
26
30
{
27
31
"prompt": "What does this regex match? /^[a-z]+$/",
Copy file name to clipboardExpand all lines: src/filesystem/README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,7 +128,7 @@ The server's directory access control follows this flow:
128
128
- A path is checked and then used, so on macOS and Linux each write, each read of a file's content or metadata, and each directory listing (`list_directory`, `list_directory_with_sizes`, `directory_tree`, `search_files`) acts from inside the directory that was checked. If a directory on the path is replaced in between, the call is refused with "Access denied - a directory on the path changed during the operation" rather than following the replacement. A listing therefore needs to enter the directory it lists: a directory the server can read but not enter (read permission without execute) is refused with `EACCES`, as an unreadable one is
129
129
- On Windows, a path naming an NTFS alternate data stream (`file.txt:stream`, `file.txt::$DATA`) is refused with "Access denied - NTFS alternate data stream paths are not supported", even inside an allowed directory: a colon is accepted only as a drive letter's (`C:\`, `\\?\C:\`). A stream holds data that no directory listing or diff of the file shows. On macOS and Linux a colon is an ordinary file-name character and is not refused
130
130
- On Windows, a path any of whose components is a reserved device name (`CON`, `PRN`, `AUX`, `NUL`, `COM1`-`COM9`, `LPT1`-`LPT9`, in any case and with or without an extension, such as `NUL.txt`) is refused with "Access denied - Windows reserved device names ... are not supported", and one any of whose components ends in a dot or a space (`file.txt.`, `dir \file.txt`) with "Access denied - Windows path components ending in a dot or a space are not supported". Windows opens the device rather than a file in the directory, and strips trailing dots and spaces so the name refers to a different file. `.` and `..` are not affected. On macOS and Linux these are ordinary file names and are not refused
131
-
- **Limit on Windows: a parent directory swapped during an operation.** A path is checked and then used, and a directory on it could be replaced in between. On Linux and macOS the server anchors every write, and every read of a file's content or metadata, to the directory it validated, so a directory replaced with a symlink after the check cannot redirect the operation. **On Windows it cannot do that, and the operation is not protected**: a second local process that can already write inside an allowed directory can replace a parent directory with a junction (or a directory symlink) between the server's check and its open, and so redirect a read or a write outside the allowed directories. The server still checks the final component there (a write refuses a symlink or junction at the file's own name, and the file opened must be the one the directory holds at that name afterwards), which narrows the window without closing it
131
+
- **Limit on Windows: a parent directory swapped during an operation.** A path is checked and then used, and a directory on it could be replaced in between. On Linux and macOS the server anchors every write, every read of a file's content or metadata, and every directory listing, to the directory it validated, so a directory replaced with a symlink after the check cannot redirect the operation. **On Windows it cannot do that, and the operation is not protected**: a second local process that can already write inside an allowed directory can replace a parent directory with a junction (or a directory symlink) between the server's check and its open, and so redirect a read, a write or a directory listing outside the allowed directories. The server still checks the final component there (a write refuses a symlink or junction at the file's own name, and the file opened must be the one the directory holds at that name afterwards), which narrows the window without closing it. A directory listing (`list_directory`, `list_directory_with_sizes`, `directory_tree`, `search_files`) is checked on both sides of the read instead: before and after it, the listed path must have no junction or symlink on it and must name the same directory, or the call is refused with "Access denied - a directory on the path changed during the operation". That refuses a replacement still in place when the read starts or when it ends. One made and undone in between is not detected, and returns the entry names of the directory it pointed to, so this too narrows the window without closing it
132
132
- **What it takes**: a concurrent local process with write access inside an allowed directory, winning a race against the server. No tool of this server creates a junction or a symlink, so it cannot be set up through the server alone
133
133
- **Guidance**: on Windows, do not allow a directory that untrusted local processes or users can write to
134
134
- **Why it is not fixed**: closing the window needs opens relative to a directory handle, which Node does not expose, so it would take native code, and that is out of scope for a reference server ([#5260](https://github.com/modelcontextprotocol/servers/issues/5260)). It may be revisited when Node ships a stable built-in FFI under this package's `engines` floor
@@ -300,6 +300,10 @@ Files inside the allowed directories are also [resources](https://modelcontextpr
300
300
entirely.
301
301
- Glob-style pattern matching
302
302
- Returns full paths to matches
303
+
- When nothing matches, the result begins `No matches found` and goes on to
304
+
name the pattern and the directory searched and to say how the pattern is
305
+
read. For a pattern with no `**`, which only matches at one depth, it also
306
+
suggests the `**/` form that matches at any depth
303
307
- Bounded: see [Slow and very large trees](#slow-and-very-large-trees)
304
308
- A subdirectory that cannot be read (no permission, say) is skipped, and the
305
309
result says so: after the matches, a note that the search is incomplete
0 commit comments