Repository navigation
Ban network paths wholesale - #64832
Merged
Jake Bailey (jakebailey) merged 10 commits intoOct 15, 2026
Merged
Conversation
Opening a UNC or device path on Windows can make the OS connect to an arbitrary SMB host and send the user's NTLM credentials. A malicious tsconfig or import can supply such a path, so we need a single, platform-independent way to recognize these paths in order to refuse them. Device paths and NT object paths (\??\) are included even when they name local volumes, since their UNC and GLOBALROOT forms also reach the network redirector, and tspath otherwise treats \??\ as a POSIX rooted path.
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved correctness and network-access issues remain, and the security-sensitive Windows behavior requires human validation.
2 open findings
What changed in this PR
This PR adds network-path rejection across the native compiler’s filesystem, configuration parsing, and file watchers to prevent unintended network authentication.
Changes:
- Adds a shared network-path detector and filesystem guards.
- Reports unsupported paths in configuration and source references.
- Adds regression tests and diagnostic baselines.
| File | Description |
|---|---|
| tsc/testdata/tests/cases/compiler/networkPathReferences.ts | Tests network-path references. |
| tsc/testdata/baselines/reference/config/tsconfigParsing/reports errors for network paths with jsonSourceFile api.js | Records source-aware configuration diagnostics. |
| tsc/testdata/baselines/reference/config/tsconfigParsing/reports errors for network paths with json api.js | Records JSON configuration diagnostics. |
| tsc/testdata/baselines/reference/compiler/networkPathReferences.js | Records emitted JavaScript. |
| tsc/testdata/baselines/reference/compiler/networkPathReferences.errors.txt | Records reference-path errors. |
| tsc/internal/vfs/osvfs/os.go | Guards filesystem operations. |
| tsc/internal/vfs/osvfs/os_test.go | Tests filesystem rejection. |
| tsc/internal/tsoptions/tsconfigparsing.go | Validates configuration paths. |
| tsc/internal/tsoptions/tsconfigparsing_test.go | Tests configuration diagnostics. |
| tsc/internal/project/watch.go | Filters network watcher paths. |
| tsc/internal/project/watch_test.go | Tests watcher filtering. |
| tsc/internal/nativepath/network.go | Defines network-path detection. |
| tsc/internal/nativepath/network_test.go | Tests path-prefix classification. |
| tsc/internal/fswatch/watcher.go | Rejects network watch requests. |
| tsc/internal/fswatch/watcher_test.go | Tests watch-request rejection. |
| tsc/internal/diagnostics/diagnostics_generated.go | Registers the generated diagnostic. |
| tsc/internal/diagnostics/diagnosticMessages.json | Defines the network-path diagnostic. |
| tsc/internal/diagnostics/diagnosticMessages.generated.json | Updates generated diagnostic text. |
| tsc/internal/compiler/fileloader.go | Rejects network source references. |
Files not reviewed (1)
- tsc/internal/diagnostics/diagnostics_generated.go: Generated file
🧠 Review effort: Balanced
The OS file system is the one place every compiler and language service file access funnels through, so refusing network paths here stops credential leaks regardless of which config option, import, or editor request produced the path. Reads behave as if the path does not exist, and writes fail. Realpath also keeps the original path when a local path resolves to a network location, such as a mapped network drive, so that following accesses continue to use the path the user chose rather than becoming inaccessible.
File watchers open the watched directory directly rather than going through the OS file system, so they need their own check to avoid connecting to a network host. Callers already only watch directories that exist according to the file system, so this is a backstop.
Watch requests sent to the editor are performed by the client, outside of our file system checks. Without filtering, a project referencing a network location would make the editor itself connect to that host.
Network paths are now never accessed, so a tsconfig referring to one would otherwise fail with confusing "file not found" errors or be silently ignored. Report a dedicated error for network paths in extends, file system path options, files, include, exclude, and project references so it is clear why they are not used.
Like tsconfig paths, a reference path pointing at a network location is never read; report why instead of claiming the file was not found.
Command-line options can come from response files, which may be checked into a repository. Report network paths in path-valued options there too, so they produce a clear error instead of reaching code that writes to the file system directly, like the profiler.
Module resolution refuses to read network paths, so a network `paths` substitution only produced an unhelpful resolution failure. Report it where it is written in the config instead.
Jake Bailey (jakebailey)
force-pushed
the
ban-network-paths
branch
from
October 15, 2026 18:33
caf5bff to
f078c2b
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
API and language-server profiling entry points still allow network filesystem access without the new guard.
1 open finding
2 resolved since last review
Files not reviewed (1)
- tsc/internal/diagnostics/diagnostics_generated.go: Generated file
🧠 Review effort: Balanced
LSP and API clients can request CPU, heap, and allocation profiles with an arbitrary directory, which previously went straight to the OS and could trigger SMB authentication on Windows.
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-platform credential-protection changes require human review and Windows-specific validation.
0 open findings
1 resolved since last review
Files not reviewed (1)
- tsc/internal/diagnostics/diagnostics_generated.go: Generated file
🧠 Review effort: Balanced
The existing test only covered the array form of extends, so add coverage for a plain string value and for one that only becomes a network path after normalization.
Jake Bailey (jakebailey)
requested review from
Ryan Cavanaugh (RyanCavanaugh) and
Andrew Branch (andrewbranch)
October 15, 2026 19:21
Ryan Cavanaugh (RyanCavanaugh)
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Simply trying to touch a network path may automatically send credentials over the network to a server. Just ban them entirely, across the board.
There are nice errors where possible, otherwise the funcs that hit the OS just reject them entirely.
Checking is cheap; max looking at the first 4 bytes of a path.