Skip to content

Ensure devtoolsOptionsUri points to a served extension - #10088

Merged
johnpryan merged 2 commits into
masterfrom
confine-devtools-options-uri
Nov 12, 2026
Merged

johnpryan merged 2 commits into
masterfrom
confine-devtools-options-uri

Conversation

@johnpryan

Copy link
Copy Markdown
Contributor

This makes sure that devtoolsOptionsUri points to a served extension and prevents recursive directory creation.

This ensures that handleExtensionEnabledState checks that devtools_options.yaml matches the actual path of an extension that is currently served by ExtensionsManager, resolving symbolic links on the parent directory and rejecting devtools_options.yaml if it is a symbolic link.

This also ensures that DevToolsOptions._lookupOptionsFile does not recursively create directories or follow symbolic links if the parent directory does not exist or devtools_options.yaml is a symbolic link, preventing api/extensionEnabledState from creating directories or writing files outside served extension package roots.

This makes progress towards:

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

@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 security and robustness when handling devtoolsOptionsUri in the extension enablement API. It restricts options lookup to currently served extensions, rejects symlinked devtools_options.yaml files, and prevents recursive directory creation when the parent directory does not exist. A review comment suggests optimizing the validation logic in _devtools_extensions.dart to avoid unnecessary allocations and synchronous I/O operations by performing a fast-path string comparison first.

recursive directory creation.

This ensures that `handleExtensionEnabledState` checks that
`devtools_options.yaml` matches the actual path of an extension that
is currently served by `ExtensionsManager`, resolving symbolic links on
the parent directory and rejecting `devtools_options.yaml` if it is a
symbolic link.

This also ensures that `DevToolsOptions._lookupOptionsFile` does not
recursively create directories or follow symbolic links if the parent
directory does not exist or `devtools_options.yaml` is a symbolic link,
preventing `api/extensionEnabledState` from creating directories or
writing files outside served extension package roots.
@johnpryan
johnpryan force-pushed the confine-devtools-options-uri branch from 8cd4d88 to ce294d6 Compare November 12, 2026 17:30
* Iterate over extensionsManager.devtoolsExtensions.
* Return `true` immediately to avoid extra calls to
  `_resolveOptionsFilePath`.
@johnpryan
johnpryan merged commit 5aecc4f into master Nov 12, 2026
54 checks passed
@johnpryan
johnpryan deleted the confine-devtools-options-uri branch November 12, 2026 19:51
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.

2 participants