Repository navigation
Conversation
…sionsForRoot()` return `DevToolsExtensionConfig` objects with valid `extensionAssetsPath` URIs. * On Windows, Dart's Uri.toFilePath() translates a non-empty host (e.g., `file://attacker.example/share/proj`) into a Universal Naming Convention (UNC) path (`\\attacker.example\share\proj`), causing the OS to initiate a network connection. This is checked in the `assertUriFormat` helper function. * Disallow relative paths in `config['buildLocation']` In `ExtensionsManager._addExtensionsForRoot`. This prevents `path.join()` from wiping out preceding path components and pointing `extensionAssetsPath` at a parent directory. * Prevent extensions from using symlinks to gain arbitrary filesystem access. `path.isWithin()` doesn't inspect the disk, so we check that `pageRoot` and `location` are resolved using `Directory.resolveSymbolicLink` before calling `path.isWithin`.
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances security and path validation in ExtensionsManager by rejecting file:// URIs with non-empty hosts (UNC paths), absolute, missing, or non-directory buildLocation paths, and symbolic links resolving outside the extension build or package root. It also adds validation for the package root URI in the server API handler and includes comprehensive unit tests. The feedback suggests optimizing the symlink validation loop in _validateAndResolveExtensionLocation to only inspect entries that are actually symbolic links, thereby avoiding redundant synchronous I/O operations on regular files and directories, and allowing the removal of the _resolveTargetPath helper.
This branch has not been deployed
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.
Ensure that extensions that are found in
ExtensionsManager._addExtensionsForRoot()returnDevToolsExtensionConfigobjects with validextensionAssetsPathURIs.file://attacker.example/share/proj) into a Universal Naming Convention (UNC) path (\\attacker.example\share\proj), causing the OS to initiate a network connection. This is checked in theassertUriFormathelper function.config['buildLocation']InExtensionsManager._addExtensionsForRoot. This preventspath.join()from wiping out preceding path components and pointingextensionAssetsPathat a parent directory.path.isWithin()doesn't inspect the disk, so we check thatpageRootandlocationare resolved usingDirectory.resolveSymbolicLinkbefore callingpath.isWithin.This makes progress towards: