Skip to content

Restrict normalizeVmServiceUri to allowed schemes and loopback hosts - #10091

Merged
johnpryan merged 3 commits into
masterfrom
normalize-vm-service-uri
Nov 16, 2026
Merged

johnpryan merged 3 commits into
masterfrom
normalize-vm-service-uri

Conversation

@johnpryan

Copy link
Copy Markdown
Contributor

Previously, normalizeVmServiceUri accepted any VM Service URI in the query parameter(?uri=...), which could lead to DevTools to connect to an arbitrary remote server.

This restricts the transport types that can be used to connect, and verifies that the URI's host is either localhost, an IPv6 loopback address (::1 or [::1]) or an IPv4 loopback address in the 127.0.0.0/8 range.

This also pulls parseMessagePortUri out into it's own helper library, message_port_connection.dart to continue to allow DartPad to connect when running in a browser (messageport:https://dartpad.dev).

This makes progress towards:

https://github.com/flutter/dash-devexp-internal/issues/86
https://github.com/flutter/dash-devexp-internal/issues/93

hosts (Issues #86, #93)

Previously, `normalizeVmServiceUri` accepted _any_ VM Service URI in
the query parameter(`?uri=...`), which could lead to DevTools to
connect to an arbitrary remote server.

This restricts the transport types that can be used to connect, and verifies that the URI's host is either `localhost`, an IPv6 loopback address (`::1` or `[::1]`) or an IPv4 loopback address in the `127.0.0.0/8` range.

This also pulls `parseMessagePortUri` out into it's own helper, `message_port_connection.dart` to continue to allow `messageport:https://dartpad.dev`.

This makes progress towards:

flutter/dash-devexp-internal#86
flutter/dash-devexp-internal#93
@johnpryan
johnpryan requested review from a team, bkonyi and kenzieschmoll as code owners November 16, 2026 22:15
@johnpryan
johnpryan requested review from srawlins and removed request for a team November 16, 2026 22:15

@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 restricts normalizeVmServiceUri to allowed VM service schemes and loopback hosts, while introducing parseMessagePortUri to handle messageport URIs separately. The framework initialization and connection input validation are updated to support both URI types, and comprehensive tests are added. The reviewer noted that the check for [::1] in isLoopbackHost is redundant because Dart's Uri.host automatically strips square brackets from IPv6 addresses.

@johnpryan johnpryan changed the title Step 3.1: Restrict normalizeVmServiceUri to allowed schemes and loopback hosts Restrict normalizeVmServiceUri to allowed schemes and loopback hosts Nov 16, 2026
@johnpryan
johnpryan merged commit 27be972 into master Nov 16, 2026
54 checks passed
@johnpryan
johnpryan deleted the normalize-vm-service-uri branch November 16, 2026 23:40
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