Repository navigation
Harden the WASM version checker network boundaries - #1060
Conversation
…and consistency.
There was a problem hiding this comment.
Pull request overview
This PR refactors Uno.Wasm.VersionChecker into a Repl-hosted CLI with a new Uno.Wasm.VersionChecker.Core library, and hardens outbound networking to reduce SSRF / pivot risk when inspecting attacker-controlled deployments.
Changes:
- Introduces
VersionCheckNetworkPolicy+VersionCheckHttpto constrain targets (public-only), disable redirects, and validate resolved IPs at connect time. - Replaces the legacy console flow (
UnoVersionExtractor) with a Repl command host and structured Repl views. - Expands unit test coverage around target parsing, config parsing, compression/BOM handling, and Repl rendering.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.Wasm.VersionChecker/VersionCheckerReplHost.cs | New Repl host wiring + command routes and error handling. |
| src/Uno.Wasm.VersionChecker/VersionCheckReplViews.cs | Structured view models for Repl rendering (inspection/summary/assemblies). |
| src/Uno.Wasm.VersionChecker/UnoVersionExtractor.cs | Removes legacy extractor implementation. |
| src/Uno.Wasm.VersionChecker/Uno.Wasm.VersionChecker.csproj | Switches to net10.0 single TFM, references Core, adds Repl package. |
| src/Uno.Wasm.VersionChecker/Program.cs | Replaces legacy Main with top-level Repl host runner. |
| src/Uno.Wasm.VersionChecker.UnitTests/VersionCheckerTestAssets.cs | Adds test helpers for real assembly bytes + WebCIL conversion input. |
| src/Uno.Wasm.VersionChecker.UnitTests/Uno.Wasm.VersionChecker.UnitTests.csproj | Enables nullable, adds AwesomeAssertions (+ analyzers) and Newtonsoft.Json. |
| src/Uno.Wasm.VersionChecker.UnitTests/Given_VersionCheckTarget.cs | New parsing/normalization/private-target rejection tests. |
| src/Uno.Wasm.VersionChecker.UnitTests/Given_VersionCheckService.cs | New end-to-end inspection regression tests (compression/BOM/same-origin). |
| src/Uno.Wasm.VersionChecker.UnitTests/Given_ReplHost.cs | New Repl host execution + JSON/human output assertions. |
| src/Uno.Wasm.VersionChecker.UnitTests/Given_ParseUnoConfigFields.cs | Updates tests to Core parser and expands edge-case coverage. |
| src/Uno.Wasm.VersionChecker.UnitTests/Given_ExtractBootConfigFromScript.cs | Updates/extends boot-config extraction tests. |
| src/Uno.Wasm.VersionChecker.UnitTests/Given_ExtractAssembliesFromResources.cs | Updates tests to new resource extraction API. |
| src/Uno.Wasm.VersionChecker.UnitTests/Given_DotnetScriptCandidates.cs | Adds candidate ordering/deduplication tests. |
| src/Uno.Wasm.VersionChecker.Core/VersionCheckTarget.cs | Adds hardened target parsing (scheme restriction, userinfo stripping, public-only validation). |
| src/Uno.Wasm.VersionChecker.Core/VersionCheckService.cs | New core inspection pipeline with resource/config parsing and safe URL resolution. |
| src/Uno.Wasm.VersionChecker.Core/VersionCheckNetworkPolicy.cs | New same-origin enforcement + public-address checks. |
| src/Uno.Wasm.VersionChecker.Core/VersionCheckModels.cs | New core models for reports/config. |
| src/Uno.Wasm.VersionChecker.Core/VersionCheckHttp.cs | New default HttpClient (no redirects, decompression, connect-time IP allowlist). |
| src/Uno.Wasm.VersionChecker.Core/Uno.Wasm.VersionChecker.Core.csproj | Adds Core library targeting net10.0 with dependencies. |
| src/Uno.Wasm.VersionChecker.Core/Internals.cs | InternalsVisibleTo for unit tests. |
| src/Uno.Wasm.Bootstrap.sln | Adds Core project to solution. |
| doc/features-version-checker.md | Updates documentation for Repl-based UX and new example output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fd119b0 to
4a65d00
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
build/ci/stage-build-packages.yml:134
- This job publishes build artifacts twice with the same ArtifactName (
uno-wasm-bootstrap-drop) and the samePathtoPublish($(build.artifactstagingdirectory)). In Azure DevOps this can be redundant at best and can fail due to duplicate artifact names at worst. Remove one of thePublishBuildArtifacts@1tasks or give the second one a distinctArtifactName/path if you intend to publish separate artifacts.
- task: PublishBuildArtifacts@1
condition: always()
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: uno-wasm-bootstrap-drop
ArtifactType: Container
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1731aa0 to
76f0e48
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
This PR hardens the
Uno.Wasm.VersionCheckernetwork model and closes a few remaining correctness gaps in the new Repl-based architecture.It focuses on three areas:
uno-config.jsvaluesWhat changed
SocketsHttpHandler.ConnectCallbackto reduce DNS-rebinding and redirect/pivot risks.uno-config.js, includinguno_app_base,uno_remote_managedpath,dotnet_js_filename, and assembly paths.Uno.Wasm.VersionChecker.Coretonet10.0only.blazor.boot.json.dotnet.jsWhy
The tool now runs against remote, attacker-controlled deployments. Without stricter network boundaries, it could be used to:
This PR makes the version checker safer by default while keeping the current UX intact for valid public targets.
Validation
dotnet build src\\Uno.Wasm.VersionChecker\\Uno.Wasm.VersionChecker.csprojdotnet test src\\Uno.Wasm.VersionChecker.UnitTests\\Uno.Wasm.VersionChecker.UnitTests.csprojCurrent test result:
41tests passingNotes
AwesomeAssertionsandAwesomeAssertions.Analyzers.package-lock.jsonchanges in the repo are not part of this PR.