Repository navigation
Conversation
This change validates the detected directory in VmServiceHandler before caching it or updating DTD, requiring that it: is a local file:// URI with no authority, query, fragment, or dot-segment traversal (. / ..), does not point or resolve (via symlinks) to the filesystem root or the user's home directory (HOME / USERPROFILE), and exists on disk and contains either pubspec.yaml or .dart_tool/package_config.json. It also extracts shared isValidLocalFileUri and isValidLocalFileUriString helpers in file_utils.dart (reused by ExtensionsManager and the extensions API handler) and adds unit and server API tests covering valid roots, invalid URI forms, filesystem/home root rejection, missing package markers, and end-to-end /api/notifyForVmServiceConnection handling. Makes progress towards: * flutter/dash-devexp-internal#88 * flutter/dash-devexp-internal#93
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces package root validation in VmServiceHandler before caching or updating Dart Tooling Daemon (DTD) workspace roots, utilizing new local file URI validation helpers to prevent path traversal and reject invalid roots (such as the filesystem root or user home directory). The review feedback highlights a critical logical issue where validating the package root during disconnect flows can prevent proper cleanup of DTD workspace roots if the directory or its package markers were deleted during the session. It is recommended to skip validation when connected is false to ensure stale roots are successfully removed.
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.
This change validates the detected directory in VmServiceHandler before caching it or updating DTD, requiring that it:
It also extracts shared isValidLocalFileUri and isValidLocalFileUriString helpers in file_utils.dart (reused by ExtensionsManager and the extensions API handler) and adds unit and server API tests covering valid roots, invalid URI forms, filesystem/home root rejection, missing package markers, and end-to-end /api/notifyForVmServiceConnection handling.
Makes progress towards: