Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ extension _ExtensionsApiHandler on Never {
final devtoolsOptionsFileUriString =
queryParams[ExtensionsApi.devtoolsOptionsUriPropertyName]!;
final devtoolsOptionsFileUri = Uri.parse(devtoolsOptionsFileUriString);

// Validate that the URI is a local file URI pointing to a
// 'devtools_options.yaml' file. Accepting arbitrary URIs from the query
// string would allow an untrusted caller to create or overwrite any file
// writable by the DevTools server process.
if (devtoolsOptionsFileUri.scheme != 'file' ||
!devtoolsOptionsFileUri.path.endsWith('/devtools_options.yaml')) {
return api.badRequest(
'Invalid devtoolsOptionsUri: must be a file: URI ending in '
"'devtools_options.yaml'.",
);
}

final extensionName = queryParams[ExtensionsApi.extensionNamePropertyName]!;

final activate = queryParams[ExtensionsApi.enabledStatePropertyName];
Expand Down