Repository navigation
[wasm][coreclr] Default fetch integrity checks off in .NET 12 - #137531
Conversation
Fingerprinted assets (boot config cache "force-cache", or "reload" on retry) have content-addressed URLs, so the stale-cache protection that integrity provided is already guaranteed. Fetch SRI blocks streaming compilation and hashes every byte on the main thread, costing ~25% of CoreCLR WebAssembly cold startup on desktop. When disableIntegrityCheck is unset, skip integrity for fingerprinted assets. An explicit false keeps integrity for all hashed assets; true still disables it everywhere. Applies to the CoreCLR loader (including prefetch) and Mono. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3d3a8d4f-c935-49c3-987c-2998d7c8abf7
Limit the fingerprinted-asset integrity default to the CoreCLR loader and expect the previous behavior from Mono in the new build test. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3d3a8d4f-c935-49c3-987c-2998d7c8abf7
Co-authored-by: Copilot <[email protected]> Copilot-Session: 3d3a8d4f-c935-49c3-987c-2998d7c8abf7
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
An invalid cached Wasm body can bypass integrity validation and fail outside the retry path, preventing cache-reload recovery and causing repeated startup failures.
2 open issues
What changed in this PR
This PR changes the CoreCLR WebAssembly loader to skip fetch integrity checks by default for fingerprinted assets, aiming to enable streaming compilation and reduce startup overhead. Mono behavior remains unchanged.
Changes:
- Applies fingerprint-aware integrity checks to startup and prefetch requests while preserving explicit configuration overrides.
- Documents the unset,
false, andtrueconfiguration states. - Adds browser tests that inspect fetch integrity options across fingerprinting configurations.
| File | Description |
|---|---|
src/native/libs/Common/JavaScript/types/public-api.ts |
Documents integrity-check configuration behavior. |
src/native/libs/Common/JavaScript/loader/dotnet.d.ts |
Updates the corresponding declaration comments. |
src/native/libs/Common/JavaScript/loader/assets.ts |
Shares integrity-selection logic and carries cache metadata through prefetch. |
src/mono/wasm/Wasm.Build.Tests/ModuleConfigTests.cs |
Adds four integrity/fingerprinting test cases with Mono-specific expectations. |
src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js |
Adds a scenario that records integrity options on asset requests. |
Review effort: Balanced
|
Interesting observation. Maybe we can just make the |
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
Revert the original PR implementation before replacing it with an MSBuild-controlled boot configuration default. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Add WasmEnableIntegrityCheck to control the generated boot configuration. Disable fetch integrity by default for CoreCLR apps targeting .NET 12 or later, while preserving JavaScript overrides and earlier runtime defaults. Retain endpoint hashes, preload and import-map integrity, and cache validators. Cover configuration, browser fetch and prefetch behavior, and incremental build and publish changes in Wasm.Build.Tests. Co-authored-by: Copilot <[email protected]>
|
@pavelsavara Thank you for taking over this PR. The changes that you've made LGTM, but since this is my PR I can't approve anything. |
|
LGTM. What about the case when user would disable fingerprinting ( |
|
I started tracking breaking changes #137891 |


Disable loader fetch integrity checks by default for CoreCLR browser apps targeting .NET 12 or later. Fetch SRI requires the complete response before it can be consumed, preventing streaming Wasm compilation.
Changes
WasmEnableIntegrityCheckand write its inverse asdisableIntegrityCheckin the generated boot configuration for build and publish.<WasmEnableIntegrityCheck>true</WasmEnableIntegrityCheck>to opt in to fetch integrity checking. An explicitfalsedisables it.disableIntegrityCheck: falseenables checking, andtruedisables it.dotnet.download(true)prefetching. Keep the existing fetch and retry implementations unchanged.This replaces the original fingerprint-dependent loader implementation with a boot-configuration default.
Validation
.\build.cmd -bl -os browser -subset clr+libs+host+packs -c Debug /p:RuntimeFlavor=CoreCLR /p:EnableHotReloadInRuntimeConfigDevFile=false.git diff --check: passed.Blazor.AssetCachingTests, or fresh startup benchmarks.Compatibility
This is a behavioral change requiring breaking-change documentation. The build property controls fetch integrity only; it does not disable SRI in generated HTML or import maps.
Download retry behavior is unchanged. With fetch integrity disabled, a nonempty corrupted HTTP-200 cached response can fail later during compilation or initialization without a cache-reload retry. Applications requiring hash-based detection can opt in using
WasmEnableIntegrityCheck=true.Resolves #137529
Note
This description was generated with GitHub Copilot.