From c0e8b02dbce6171f4b97c224a84d0e649978ee59 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 18 Nov 2026 17:09:00 +0100 Subject: [PATCH 1/2] Validate npm Undici 6.29.1 through the VMR workload Consume the verified packages for dotnet/node#448 and fail validation when the provisioned Node binary, npm dependency, or installed VMR manifest differs. This commit is validation only and must not merge. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- NuGet.config | 44 ++++++++++++ eng/Version.Details.props | 18 ++--- eng/Version.Details.xml | 36 +++++----- eng/Versions.props | 5 +- eng/testing/NodeValidation.cjs | 98 +++++++++++++++++++++++++++ eng/testing/NodeValidation.json | 37 ++++++++++ eng/testing/workloads-browser.targets | 20 ++++++ src/mono/mono.proj | 13 ++++ 8 files changed, 242 insertions(+), 29 deletions(-) create mode 100644 eng/testing/NodeValidation.cjs create mode 100644 eng/testing/NodeValidation.json diff --git a/NuGet.config b/NuGet.config index 826c56f5d3f38e..701917214dbaf0 100644 --- a/NuGet.config +++ b/NuGet.config @@ -24,7 +24,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 0bcd388eaadf66..ed137afa1d4682 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -35,7 +35,7 @@ This file should be imported by eng/Versions.props 10.0.0-beta.26561.107 5.0.0-2.26561.107 10.0.16 - 10.0.116-servicing.26561.107 + 10.0.116-servicing.26568.104 10.0.16 10.0.16 7.0.3-rc.6207 @@ -82,14 +82,14 @@ This file should be imported by eng/Versions.props 19.1.0-alpha.1.25461.1 19.1.0-alpha.1.25461.1 - 10.0.0-alpha.1.26554.2 - 10.0.0-alpha.1.26554.2 - 10.0.0-alpha.1.26554.2 - 10.0.0-alpha.1.26554.2 - 10.0.0-alpha.1.26554.2 - 10.0.0-alpha.1.26554.2 - 10.0.0-alpha.1.26554.2 - 10.0.0-alpha.1.26554.2 + 10.0.0-alpha.1.26566.2 + 10.0.0-alpha.1.26566.2 + 10.0.0-alpha.1.26566.2 + 10.0.0-alpha.1.26566.2 + 10.0.0-alpha.1.26566.2 + 10.0.0-alpha.1.26566.2 + 10.0.0-alpha.1.26566.2 + 10.0.0-alpha.1.26566.2 1.0.0-prerelease.26080.1 1.0.0-prerelease.26080.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 45c11523ab8b66..054b2c57268f58 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -49,9 +49,9 @@ https://github.com/dotnet/dotnet 51df620979b7bcc466e0dfdc96115434aa5a9558 - + https://github.com/dotnet/dotnet - 51df620979b7bcc466e0dfdc96115434aa5a9558 + 01ceffb8ecf00e58755cb5f05a1a6d844beab1b9 @@ -385,37 +385,37 @@ https://github.com/dotnet/dotnet 51df620979b7bcc466e0dfdc96115434aa5a9558 - + https://github.com/dotnet/node - 9007f5e92457a68ee2a3a67c4a33bd480e7edb29 + 740e4b9484992cf0b6917dfc902939e8652b4041 - + https://github.com/dotnet/node - 9007f5e92457a68ee2a3a67c4a33bd480e7edb29 + 740e4b9484992cf0b6917dfc902939e8652b4041 - + https://github.com/dotnet/node - 9007f5e92457a68ee2a3a67c4a33bd480e7edb29 + 740e4b9484992cf0b6917dfc902939e8652b4041 - + https://github.com/dotnet/node - 9007f5e92457a68ee2a3a67c4a33bd480e7edb29 + 740e4b9484992cf0b6917dfc902939e8652b4041 - + https://github.com/dotnet/node - 9007f5e92457a68ee2a3a67c4a33bd480e7edb29 + 740e4b9484992cf0b6917dfc902939e8652b4041 - + https://github.com/dotnet/node - 9007f5e92457a68ee2a3a67c4a33bd480e7edb29 + 740e4b9484992cf0b6917dfc902939e8652b4041 - + https://github.com/dotnet/node - 9007f5e92457a68ee2a3a67c4a33bd480e7edb29 + 740e4b9484992cf0b6917dfc902939e8652b4041 - + https://github.com/dotnet/node - 9007f5e92457a68ee2a3a67c4a33bd480e7edb29 + 740e4b9484992cf0b6917dfc902939e8652b4041 https://github.com/dotnet/runtime-assets diff --git a/eng/Versions.props b/eng/Versions.props index b5af1c18e38f14..23ff3566d20fc1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -27,6 +27,7 @@ $(_DotnetSdkVersion) $(_GlobalJsonSdkVersion) + $(_GlobalJsonSdkVersion) $([System.String]::Copy('$(SdkVersionForWorkloadTesting)').Split('.')[0]) $(SdkMajorVersion).0.100 $([System.Text.RegularExpressions.Regex]::Match($(SdkVersionForWorkloadTesting), '-(?!rtm|servicing)(.+)\.[^.]+\.[^.]+$').Groups[1].Value) @@ -166,9 +167,9 @@ 9.0.0-alpha.1.24167.3 - $(MicrosoftDotNetApiCompatTaskPackageVersion) + 10.0.116 - $(MicrosoftNETCoreAppRefPackageVersion) + 10.0.16 $(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion) 3.1.56 diff --git a/eng/testing/NodeValidation.cjs b/eng/testing/NodeValidation.cjs new file mode 100644 index 00000000000000..e2711d84ea4550 --- /dev/null +++ b/eng/testing/NodeValidation.cjs @@ -0,0 +1,98 @@ +'use strict'; + +const assert = require('node:assert/strict'); +const crypto = require('node:crypto'); +const fs = require('node:fs'); +const path = require('node:path'); + +const [metadataPath, mode, rootArgument, band] = process.argv.slice(2); +assert.ok(metadataPath && rootArgument, 'Expected metadata, mode, and provisioned root.'); +assert.ok(mode === 'transport' || mode === 'workload', `Unknown validation mode ${mode}.`); +const expected = JSON.parse(fs.readFileSync(metadataPath, 'utf8')); +const root = fs.realpathSync(rootArgument); +const os = { darwin: 'osx', win32: 'win', linux: 'linux' }[process.platform]; +assert.ok(os, `Unsupported host ${process.platform}.`); +const musl = os === 'linux' && !process.report.getReport().header.glibcVersionRuntime; +const rid = `${os}${musl ? '-musl' : ''}-${process.arch}`; +const binaryHash = sha256(fs.readFileSync(process.execPath)); +assert.ok(expected.binaries[rid], `No verified transport binary for ${rid}.`); +assert.equal(binaryHash, expected.binaries[rid], 'The executable is not the verified Node binary.'); +assert.equal(process.versions.node, expected.node); +assert.equal(process.versions.undici, expected.embeddedUndici); + +function sha256(bytes) { + return crypto.createHash('sha256').update(bytes).digest('hex'); +} + +function sameFile(actual, wanted) { + assert.equal(fs.realpathSync(actual), fs.realpathSync(wanted)); +} + +function manifestFiles(directory) { + return fs.readdirSync(directory, { withFileTypes: true }).flatMap((entry) => { + const fullPath = path.join(directory, entry.name); + if (entry.isDirectory()) return manifestFiles(fullPath); + return entry.name === 'WorkloadManifest.json' ? [fullPath] : []; + }); +} + +const receipt = { + mode, + rid, + executable: process.execPath, + binarySha256: binaryHash, + node: process.versions.node, + embeddedUndici: process.versions.undici, + nodeCommit: expected.nodeCommit, + nodePackageVersion: expected.nodePackageVersion, +}; + +if (mode === 'transport') { + sameFile(process.execPath, path.join(root, 'bin', os === 'win' ? 'node.exe' : 'node')); + const npmRoot = path.join(root, os === 'win' ? 'bin' : 'lib', 'node_modules', 'npm'); + const npm = JSON.parse(fs.readFileSync(path.join(npmRoot, 'package.json'), 'utf8')); + const undiciRoot = path.join(npmRoot, 'node_modules', 'undici'); + const undici = JSON.parse(fs.readFileSync(path.join(undiciRoot, 'package.json'), 'utf8')); + assert.equal(npm.version, expected.npm); + assert.equal(undici.version, expected.npmUndici); + const fetchSource = fs.readFileSync(path.join(undiciRoot, 'lib', 'web', 'fetch', 'index.js'), 'utf8'); + assert.equal(sha256(fetchSource.replaceAll('\r\n', '\n')), expected.npmUndiciFetchSha256, + 'The provisioned npm fetch implementation differs from the verified fix.'); + receipt.npm = npm.version; + receipt.npmUndici = undici.version; +} else { + assert.ok(band, 'The installed workload SDK band must be provided.'); + assert.ok(expected.workload, 'No verified VMR workload identity is supplied.'); + const workload = expected.workload; + const packageId = workload.nodePackages[rid]; + assert.ok(packageId, `No verified workload Node pack for ${rid}.`); + const tools = path.join(root, 'packs', packageId, workload.nodePackVersion, 'tools'); + sameFile(process.execPath, path.join(tools, 'bin', os === 'win' ? 'node.exe' : 'node')); + assert.equal(fs.existsSync(path.join(tools, 'lib', 'node_modules', 'npm')), false); + assert.equal(fs.existsSync(path.join(tools, 'bin', 'node_modules', 'npm')), false); + const manifestBand = path.join(root, 'sdk-manifests', band); + const directories = fs.readdirSync(manifestBand) + .filter((name) => name.toLowerCase() === 'microsoft.net.workload.emscripten.current'); + assert.equal(directories.length, 1, 'Expected one current Emscripten manifest directory.'); + const manifests = manifestFiles(path.join(manifestBand, directories[0])); + assert.equal(manifests.length, 1, 'Expected one installed current Emscripten manifest.'); + const manifestBytes = fs.readFileSync(manifests[0]); + assert.equal(sha256(manifestBytes), workload.manifestJsonSha256, + 'The installed Emscripten manifest is not the verified VMR manifest.'); + const manifest = JSON.parse(manifestBytes.toString('utf8').replace(/^\uFEFF/, '')); + const declarations = Object.entries(manifest.packs).filter(([id, pack]) => + id === packageId || Object.values(pack['alias-to'] || {}).includes(packageId)); + assert.equal(declarations.length, 1, 'The manifest does not unambiguously select this Node pack.'); + assert.equal(declarations[0][1].version, workload.nodePackVersion); + receipt.vmrCommit = workload.vmrCommit; + receipt.vmrBuild = workload.vmrBuild; + receipt.manifestPackage = workload.manifestPackage; + receipt.manifestVersion = workload.manifestVersion; + receipt.installedManifest = manifests[0]; + receipt.manifestJsonSha256 = sha256(manifestBytes); + receipt.nodePack = packageId; + receipt.nodePackVersion = workload.nodePackVersion; + receipt.npmBundled = false; +} + +console.log(`NODE_VALIDATION ${JSON.stringify(receipt)}`); diff --git a/eng/testing/NodeValidation.json b/eng/testing/NodeValidation.json new file mode 100644 index 00000000000000..483cdecb6f1e56 --- /dev/null +++ b/eng/testing/NodeValidation.json @@ -0,0 +1,37 @@ +{ + "node": "24.22.1", + "embeddedUndici": "7.30.1", + "npm": "11.19.1", + "npmUndici": "6.29.1", + "npmUndiciFetchSha256": "3e0b6aa3b09d5265f5cdebe5196376a809178776aed52eeba73788341df57a48", + "nodeCommit": "740e4b9484992cf0b6917dfc902939e8652b4041", + "nodePackageVersion": "10.0.0-alpha.1.26566.2", + "binaries": { + "linux-arm64": "a7b091d680999c8906bcef43fc4b8691d1cf80d7cfbb36c440c1a830deb04b8a", + "linux-musl-arm64": "2b84cba567949dfe8c9dbe4cae88662f72a3a6bf922910f68816140ae671331d", + "linux-musl-x64": "a11f1f256613600049abcdf18448ce9ea10950d985e51ea9a7b75694c1f59310", + "linux-x64": "6c59e797f09bb9a11e7cd6589e528f7cb4a5d216312de1a8831343ca20c92b3a", + "osx-arm64": "c408123d99c9c606059fc0b28b6d099b467e3bea584ac167b9890e2c73684354", + "osx-x64": "e00c3d8c0b15258ff3d89446754663f741c2aadd7d6ad37acc58743c705f0714", + "win-arm64": "39e28259405081dacd71f78534d4fb767fda04c11f0ad2d30de994f8e9b83c7c", + "win-x64": "f33aca1a61419fa1685c5b97cc1b1420711cd22c8b9c845f6ea4fda39289db57" + }, + "workload": { + "vmrCommit": "01ceffb8ecf00e58755cb5f05a1a6d844beab1b9", + "vmrBuild": 3139456, + "nodePackages": { + "linux-arm64": "Microsoft.NET.Runtime.Emscripten.3.1.56.Node.linux-arm64", + "linux-musl-arm64": "Microsoft.NET.Runtime.Emscripten.3.1.56.Node.linux-musl-arm64", + "linux-musl-x64": "Microsoft.NET.Runtime.Emscripten.3.1.56.Node.linux-musl-x64", + "linux-x64": "Microsoft.NET.Runtime.Emscripten.3.1.56.Node.linux-x64", + "osx-arm64": "Microsoft.NET.Runtime.Emscripten.3.1.56.Node.osx-arm64", + "osx-x64": "Microsoft.NET.Runtime.Emscripten.3.1.56.Node.osx-x64", + "win-arm64": "Microsoft.NET.Runtime.Emscripten.3.1.56.Node.win-arm64", + "win-x64": "Microsoft.NET.Runtime.Emscripten.3.1.56.Node.win-x64" + }, + "nodePackVersion": "10.0.16", + "manifestPackage": "Microsoft.NET.Workload.Emscripten.Current.Manifest-10.0.100", + "manifestVersion": "10.0.116", + "manifestJsonSha256": "ea88229ba7156c465257b7f47ffcb98ed8fa6a20054f399745ab4b378ad97c84" + } +} diff --git a/eng/testing/workloads-browser.targets b/eng/testing/workloads-browser.targets index ad279f9f506223..6ff275f2894e6e 100644 --- a/eng/testing/workloads-browser.targets +++ b/eng/testing/workloads-browser.targets @@ -98,4 +98,24 @@ *******************" /> + + + * + + + + <_NodeValidationSuffix Condition="$([MSBuild]::IsOSPlatform('Windows'))">.exe + + + <_NodeValidationSdk Include="@(_SdkWithWorkloadToInstall)" Condition="'%(_SdkWithWorkloadToInstall.Identity)' == 'latest'"> + %(_SdkWithWorkloadToInstall.InstallPath)/packs/Microsoft.NET.Runtime.Emscripten.3.1.56.Node.$(NETCoreSdkPortableRuntimeIdentifier)/10.0.16/tools/bin/node$(_NodeValidationSuffix) + + + + + + diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 4d14e7f8d955b6..3c6e1c84d0dcf8 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -1228,4 +1228,17 @@ JS_ENGINES = [NODE_JS] + + + + <_NodeValidationRoot>$([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)'))node/ + <_NodeValidationExecutable>$(_NodeValidationRoot)bin/node + <_NodeValidationExecutable Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(_NodeValidationExecutable).exe + + + + \ No newline at end of file From 9af7efbab33c91195cf09e966fa61cbd0481a094 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 18 Nov 2026 18:19:55 +0100 Subject: [PATCH 2/2] Fix local package mapping for Node workload validation Remove the mapping clear directive so the workload installer can prepend its local package source without NuGet discarding it. Keep the verified Node and VMR package mappings unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- NuGet.config | 1 - 1 file changed, 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 701917214dbaf0..e74a573349a9f1 100644 --- a/NuGet.config +++ b/NuGet.config @@ -28,7 +28,6 @@ -