Validate extension message origin This change validates `MessageEvent.origin` and `MessageEvent.source` on `postMessage` events between DevTools and extensions. Before this change, incoming `message` events were parsed without checking their sender, allowing untrusted origins or unrelated windows to spoof extension or host events. * Validate that `event.origin` matches the expected HTTP(S) origin of `extensionUrl` and verify `event.source` strictly equals `extensionIFrame.contentWindow` in `ExtensionIFrameController._handleMessage`, dropping and logging unexpected messages. * Add `isAllowedDevToolsOrigin` to `devtools_extensions` to reject empty (`null`), non-HTTP(S), and malformed origins, allowing only the extension's own `window.origin` or loopback HTTP(S) hosts. * Validate `event.origin` with `isAllowedDevToolsOrigin` and verify `event.source` strictly equals the expected window (`window.parent` when embedded, or `window` in the simulated environment) in `ExtensionManager._handleMessage` and `SimulatedDevToolsController._handleMessage`. * Guard against `null` message payloads in `tryParseExtensionEvent` instead of force-unwrapping `data.dartify()`. * Add browser unit tests covering origin and source validation for `ExtensionIFrameController`, `ExtensionManager`, and `isAllowedDevToolsOrigin`, and update `packages/devtools_extensions/CHANGELOG.md`. Fixes https://github.com/flutter/dash-devexp-internal/issues/86
Dart & Flutter DevTools is a suite of performance tools for Dart and Flutter.
For documentation on installing and trying out DevTools, please see our docs.
Contributions welcome! See our contributing page for an overview of how to build and contribute to the project.
By using Dart DevTools, you agree to the Google Terms of Service. To understand how we use data collected from this service, see the Google Privacy Policy.