Skip to content

Ensure that packageRootUri points to a known workspace - #10089

Closed
johnpryan wants to merge 2 commits into
masterfrom
confine-extension-package-root-uri
Closed

johnpryan wants to merge 2 commits into
masterfrom
confine-extension-package-root-uri

Conversation

@johnpryan

@johnpryan johnpryan commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

This makes sure that packageRootUri can't probe arbitrary directories on the filesystem by providing a file:// path outside of the user's project to the serveAvailableExtensions endpoint.

This makes the extension handler connect to DTD to check that:

  • URIs don't contain . and .. segments.
  • Symlinks point to a known DTD workspace
  • Monorepo package_config.json files are located in a known IDE workspace
  • serveAvailableExtensions throws a ServeAvailableExtensionsException if an invalid root file Uri is passed.

This is the final change needed to close these issues:

Fixes https://github.com/flutter/dash-devexp-internal/issues/89
Fixes https://github.com/flutter/dash-devexp-internal/issues/91

@johnpryan
johnpryan requested review from a team, bkonyi and kenzieschmoll as code owners November 16, 2026 19:19
@johnpryan
johnpryan requested review from srawlins and removed request for a team November 16, 2026 19:19

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the DevTools extension server by enforcing security constraints on package roots and options files, ensuring they reside within active IDE workspace roots. It introduces validation logic in ExtensionsManager and file_system.dart to verify file URIs and resolve paths, along with comprehensive unit tests to cover these security checks. I have identified a syntax error in the workspace root resolution logic that requires a fix using Dart's pattern matching.

…oots

Use shared helpers for verifying extension paths

use isLocalFileUrl to check for file:// prefixes
@johnpryan
johnpryan force-pushed the confine-extension-package-root-uri branch from ec9e5a0 to d7f93c7 Compare November 17, 2026 16:41
@johnpryan

Copy link
Copy Markdown
Contributor Author

Discussed offline with @kenzieschmoll , there's a better approach here where we could avoid sending packageRootUri to the DevTools server and send the VmServiceUri instead.

@johnpryan johnpryan closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant