Repository navigation
Restrict normalizeVmServiceUri to allowed schemes and loopback hosts - #10091
Merged
Merged
Conversation
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
requested review from
a team,
bkonyi and
kenzieschmoll
as code owners
November 16, 2026 22:15
Contributor
There was a problem hiding this comment.
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.
srawlins
approved these changes
Nov 16, 2026
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.
Previously,
normalizeVmServiceUriaccepted 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 (::1or[::1]) or an IPv4 loopback address in the127.0.0.0/8range.This also pulls
parseMessagePortUriout into it's own helper library,message_port_connection.dartto 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