Skip to content

Fix security issues - #389

Merged
Vladimir Morozov (vmoroz) merged 1 commit into
microsoft:mainfrom
vmoroz:PR/fix-security-issues
Oct 20, 2026
Merged

Vladimir Morozov (vmoroz) merged 1 commit into
microsoft:mainfrom
vmoroz:PR/fix-security-issues

Conversation

@vmoroz

@vmoroz Vladimir Morozov (vmoroz) commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix two issues that an automated security scan reported in developer tools.
Neither tool is part of the shipped engine.

  • hcdp debugger accepts only the DevTools frontend: the WebSocket server in
    tools/hcdp listened on all interfaces and accepted any browser Origin. While
    a debug session was running, any open web page could connect, read the
    debugged script and run code in its runtime. The server now listens on
    127.0.0.1 only and, during the handshake, rejects every browser Origin
    except the DevTools frontend it opens. Native CDP clients that send no Origin
    still work.
  • Tracing scripts elevate only trusted tools: Start-Tracing.ps1 and
    Stop-Tracing.ps1 run wpr.exe and wpa.exe as administrator after finding
    them on PATH, so an executable planted earlier on PATH could be elevated. A
    small shared helper now takes wpr.exe from the Windows system directory
    (falling back to the Windows Performance Toolkit folder) and wpa.exe from
    the WPT folder only, and passes the full path. PATH and the current
    directory are ignored.
  • Behavior change: WPT installed in a non-standard folder is no longer found
    through PATH. The error message lists the supported folders.
  • Tests: a Node test for the hcdp connection checks, and a PowerShell test
    that runs the real tracing scripts with decoy wpr.exe/wpa.exe on PATH and
    in the current directory. Start-Process is mocked, so nothing is launched
    or elevated.

Test Plan

Run on Windows from the repository root:

  • Push-Location tools\hcdp; node --test; Pop-Location (after npm ci):
    passed, 5/5. Real ws handshakes: the frontend Origin and a missing Origin
    are accepted; 9 bad Origins, including null and lookalike hosts, get 401
    and no connection is created.
  • pwsh -NoProfile -File utils\tracing\win\tests\Test-Tracing.ps1: passed on
    PowerShell 7.6.
  • powershell.exe -NoProfile -ExecutionPolicy Bypass -File utils\tracing\win\tests\Test-Tracing.ps1:
    passed on Windows PowerShell 5.1, both 64-bit and 32-bit (SysWOW64).

Not run: a manual DevTools session in Chrome/Edge and a real elevated WPR/WPA
trace. No C++ code changed, so there is no product build.

Microsoft Reviewers: Open in CodeFlow

@vmoroz
Vladimir Morozov (vmoroz) requested a review from a team as a code owner October 20, 2026 03:37
Copilot AI balanced review requested due to automatic review settings October 20, 2026 03:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Elevated launches and debugger access controls need human review with Windows and browser integration validation.

No open issues 🎉

What changed in this PR

Hardens Windows tracing tool launches and access to the Hermes CDP debugger.

Changes:

  • Resolves tracing executables from fixed trusted locations instead of PATH.
  • Restricts debugger connections to loopback and approved browser origins.
  • Adds security checks and documentation.
File Description
utils/​tracing/​win/​TracingTools.ps1 Adds trusted executable lookup and diagnostics.
utils/​tracing/​win/​tests/​Test-Tracing.ps1 Tests trusted paths and mocked launches.
utils/​tracing/​win/​Stop-Tracing.ps1 Uses trusted recorder and analyzer paths.
utils/​tracing/​win/​Start-Tracing.ps1 Uses the trusted recorder path.
tools/​hcdp/​README.md Documents connection restrictions and testing.
tools/​hcdp/​origin.test.js Tests loopback binding and origin checks.
tools/​hcdp/​origin.js Defines allowed origins and server options.
tools/​hcdp/​hcdp.js Applies restricted server options.

Review effort: Balanced

@vmoroz
Vladimir Morozov (vmoroz) merged commit bc69aca into microsoft:main Oct 20, 2026
14 checks passed
@vmoroz
Vladimir Morozov (vmoroz) deleted the PR/fix-security-issues branch October 20, 2026 04:17
@github-actions

Copy link
Copy Markdown

Benchmark Results

Total benchmarks: 204

Inputs: baseline/baseline.json, bench_result.json

v8 (6176ms, 4993ms) -19.2%
v8 hermes (CI) hermes (CI)
v8-crypto 622.6ms 471.2ms
v8-deltablue 739.4ms 606.2ms
v8-raytrace 127.8ms 94.8ms
v8-regexp 593ms 479.6ms
v8-richards 937ms 716.8ms
v8-splay 225.2ms 191.4ms
v8-crypto (static) 452ms 347.8ms
v8-deltablue (static) 661.6ms 546.8ms
v8-raytrace (static) 91.8ms 80.2ms
v8-regexp (static) 749.2ms 617ms
v8-richards (static) 781.4ms 633.8ms
v8-splay (static) 195ms 207.4ms
test-suites (317886ms, 259453ms) -18.4%
test-suites hermes (CI) hermes (CI)
box2d 2949.8ms 1925.8ms
earley-boyer 2564.8ms 1999.4ms
navier-stokes 5743.8ms 3498.8ms
pdfjs 1038.2ms 744.2ms
gbemu 2296ms 1725.6ms
code-load 4472.8ms 3697.2ms
typescript 3381.8ms 2365ms
simpleSum 8855.4ms 4969.4ms
propAccess 2691.2ms 1724ms
allocObj 252ms 173.2ms
allocObjLit 6371.8ms 4916.4ms
allocNewObj 20053ms 15538.2ms
allocArray 249ms 171.4ms
allocNewArray 34956.8ms 27926.4ms
arrayRead 115.6ms 69.4ms
arrayReadByIndex 550ms 362.6ms
largeArrayRead 827.2ms 412.2ms
arrayWrite 261.8ms 194.2ms
largeArrayWrite 2218ms 1677.6ms
interp-dispatch 2880ms 1763.2ms
wb-perf 8327ms 8687.8ms
arrayReverse 40.6ms 31.6ms
arrayMap 1472.6ms 1436.4ms
arrayIndexOf 143.2ms 111.8ms
arrayLastIndexOf 148.6ms 126.2ms
arrayEvery 2308.8ms 2198.6ms
arraySome 2174.4ms 2159.2ms
arrayFill 2401.2ms 1915.6ms
arrayFilter 1866.4ms 1606.6ms
arrayFind 3207ms 2739ms
arrayFindIndex 3322ms 2809.4ms
arrayPop 1031.4ms 831ms
arrayReduce 1994.2ms 1915ms
arrayReduceRight 2075.8ms 1900.8ms
arrayShift 2065.8ms 1772.6ms
arrayUnshift 2109.4ms 1851.8ms
arrayIncludes 1216.6ms 909.4ms
arrayFrom 1102.8ms 872ms
arrayCopyWithin 1487ms 1240.4ms
stringFromCharCode 92.6ms 71.6ms
arraySlice 786.2ms 640.8ms
arraySplice 26.8ms 23.6ms
arrayOf 1048.8ms 779.8ms
stringCharAt 1346.6ms 1115.8ms
stringMatch 3192.4ms 2256ms
stringSearch 3508.2ms 2241.6ms
stringStartsWith 701ms 463.2ms
stringEndsWith 650.4ms 422ms
stringIncludes 1520.6ms 1460.4ms
stringIndexOf 1555.6ms 1813ms
stringLastIndexOf 1821.4ms 1379ms
stringSplit 822ms 615.2ms
stringSlice 490ms 392.6ms
stringPadStart 2910.8ms 2345ms
stringPadEnd 2910ms 2462ms
regExpMatch 1506.2ms 1180.4ms
regExpSearch 1227ms 1095ms
regExpToString 1204ms 849.6ms
stringReplace 1394.8ms 1431.6ms
regExpReplace 3309.2ms 693ms
regExpFlags 956.8ms 783.8ms
regExpSplit 1307.8ms 1004.4ms
numberArrayReadWrite 2477.8ms 1877.8ms
protoCache 3594.6ms 1875.6ms
box2d (static) 1792.6ms 1422ms
earley-boyer (static) 1875.6ms 1553.6ms
navier-stokes (static) 3410.2ms 2980ms
pdfjs (static) 812.8ms 663.2ms
gbemu (static) 1797ms 1394.2ms
code-load (static) 4199.2ms 3491.4ms
typescript (static) 2685.6ms 2202.4ms
simpleSum (static) 936.2ms 846ms
propAccess (static) 2298ms 1893.2ms
allocObj (static) 0.2ms 0.2ms
allocObjLit (static) 4154.4ms 3533.8ms
allocNewObj (static) 15749.2ms 14637ms
allocArray (static) 0.6ms 0.8ms
allocNewArray (static) 28494.2ms 26180ms
arrayRead (static) 74.2ms 63.6ms
arrayReadByIndex (static) 453.2ms 402.4ms
largeArrayRead (static) 552.2ms 439.2ms
arrayWrite (static) 178.4ms 143ms
largeArrayWrite (static) 1568.6ms 1317ms
interp-dispatch (static) 1918.8ms 1594.8ms
wb-perf (static) 8991.2ms 7533ms
arrayReverse (static) 37ms 32.2ms
arrayMap (static) 1064.8ms 842.2ms
arrayIndexOf (static) 128.2ms 99.6ms
arrayLastIndexOf (static) 138.8ms 100ms
arrayEvery (static) 1397.6ms 1200.2ms
arraySome (static) 1406.6ms 1197.4ms
arrayFill (static) 1969.2ms 1635ms
arrayFilter (static) 1061ms 2102.2ms
arrayFind (static) 2242.2ms 2224.6ms
arrayFindIndex (static) 2235.8ms 2024.8ms
arrayPop (static) 878ms 736.6ms
arrayReduce (static) 1311.8ms 1182.8ms
arrayReduceRight (static) 1322.6ms 1180ms
arrayShift (static) 1512ms 1265.6ms
arrayUnshift (static) 1568.2ms 1311.4ms
arrayIncludes (static) 963.4ms 804.2ms
arrayFrom (static) 1030.6ms 778.8ms
arrayCopyWithin (static) 1109.6ms 925.6ms
stringFromCharCode (static) 77ms 65.6ms
arraySlice (static) 571.6ms 481.4ms
arraySplice (static) 26ms 25.2ms
arrayOf (static) 868.8ms 659ms
stringCharAt (static) 1100.6ms 912.6ms
stringMatch (static) 2227.6ms 1839ms
stringSearch (static) 2219.2ms 1841.8ms
stringStartsWith (static) 494.2ms 411.8ms
stringEndsWith (static) 457.8ms 367.8ms
stringIncludes (static) 1437.4ms 1502.2ms
stringIndexOf (static) 1440.8ms 1263.4ms
stringLastIndexOf (static) 1956.6ms 1720.2ms
stringSplit (static) 651.2ms 527.8ms
stringSlice (static) 445.6ms 827.6ms
stringPadStart (static) 2294.4ms 1898.8ms
stringPadEnd (static) 2499.2ms 1857.2ms
regExpMatch (static) 1483.2ms 1047.8ms
regExpSearch (static) 1296.2ms 1062ms
regExpToString (static) 1326.6ms 994.8ms
stringReplace (static) 1455.6ms 1383.2ms
regExpReplace (static) 851.8ms 618ms
regExpFlags (static) 870.6ms 646.8ms
regExpSplit (static) 1200ms 831ms
numberArrayReadWrite (static) 2132.8ms 1641ms
protoCache (static) 3595.8ms 2851ms
micros (60876ms, 49234ms) -19.1%
micros hermes (CI) hermes (CI)
getNodeById.js 5273ms 4199ms
setInsert.js 2864.8ms 2545.4ms
stringify-number.js 1823.4ms 1527.4ms
typed-array-sort.js 22381ms 17763.4ms
getNodeById.js (static) 3941ms 3171ms
setInsert.js (static) 2517.6ms 2217.4ms
stringify-number.js (static) 1663.6ms 1219.2ms
typed-array-sort.js (static) 20411.4ms 16591ms
jit-benches (8563ms, 5471ms) -36.1%
jit-benches hermes (CI) hermes (CI)
idisp.js 2810.2ms 1787.8ms
idispn.js 3395.8ms 1797.4ms
idisp.js (static) 1906ms 1584.4ms
idispn.js (static) 450.8ms 301ms
many-subclasses (73437ms, 61430ms) -16.3%
many-subclasses hermes (CI) hermes (CI)
many.js 19104.8ms 15609.4ms
many-sh-1.js 7322.8ms 6394.6ms
many-sh-2.js 7329ms 6346.2ms
many-sh-3.js 7083.6ms 5919.6ms
many-sh-4.js 7235ms 5950.4ms
many.js (static) 15996ms 13571ms
many-sh-1.js (static) 2285.2ms 1825.2ms
many-sh-2.js (static) 2387ms 1991.4ms
many-sh-3.js (static) 2347.2ms 1910ms
many-sh-4.js (static) 2346ms 1912.2ms
map-objects (3627ms, 2849ms) -21.4%
map-objects hermes (CI) hermes (CI)
map-objects-untyped.js 1023.6ms 781.6ms
map-objects-typed.js 957.6ms 729.2ms
map-objects-untyped.js (static) 917.2ms 713.8ms
map-objects-typed.js (static) 728.8ms 624.8ms
map-strings (4335ms, 3200ms) -26.2%
map-strings hermes (CI) hermes (CI)
map-strings-untyped.js 1196.8ms 882.8ms
map-strings-typed.js 1139.2ms 832.4ms
map-strings-untyped.js (static) 1092.2ms 820.2ms
map-strings-typed.js (static) 906.8ms 665ms
nbody (3448ms, 2397ms) -30.5%
nbody hermes (CI) hermes (CI)
original/nbody.js 839.6ms 567ms
fully-typed/nbody.js 710ms 463.6ms
fully-typed/nbody.ts 865.2ms 559.8ms
original/nbody.js (static) 449.2ms 351.4ms
fully-typed/nbody.js (static) 135ms 105.6ms
fully-typed/nbody.ts (static) 449.2ms 349.4ms
string-switch (6503ms, 4524ms) -30.4%
string-switch (string-switch/plain) hermes (CI) hermes (CI)
bench.js 1316ms 1071.2ms
bench.js (static) 5187ms 3453.2ms
raytracer (5608ms, 4413ms) -21.3%
raytracer (raytracer/original) hermes (CI) hermes (CI)
bench-raytracer.js 1550.4ms 1212.2ms
raytracer.ts 1667.6ms 1277ms
bench-raytracer.js (static) 1198.4ms 954ms
raytracer.ts (static) 1191.8ms 970ms
MiniReact (30332ms, 22839ms) -24.7%
MiniReact hermes (CI) hermes (CI)
no-objects/out/simple-stripped.js 2239.2ms 1608.6ms
no-objects/out/simple-lowered.js 2270.8ms 1622ms
no-objects/out/music-stripped.js 42.6ms 34.4ms
no-objects/out/music-lowered.js 47.2ms 37.4ms
no-deps/stripped/MiniReact.js 5004ms 3904ms
no-deps/MiniReact.js 5256.2ms 3806.2ms
no-objects/out/simple.js 2260.4ms 1562.4ms
no-objects/out/music.js 45.6ms 36ms
no-objects/out/simple-stripped.js (static) 1725.2ms 1312.4ms
no-objects/out/simple-lowered.js (static) 1725.4ms 1326.8ms
no-objects/out/music-stripped.js (static) 18.8ms 16.8ms
no-objects/out/music-lowered.js (static) 19.4ms 15.8ms
no-deps/stripped/MiniReact.js (static) 4024.8ms 3124.2ms
no-deps/MiniReact.js (static) 3938.2ms 3105.6ms
no-objects/out/simple.js (static) 1695.2ms 1310.6ms
no-objects/out/music.js (static) 19ms 16ms
widgets (12934ms, 10150ms) -21.5%
widgets hermes (CI) hermes (CI)
simple-classes/widgets.js 1758.2ms 1294.2ms
original/es5/widgets.js 2798.8ms 2247.2ms
single-file/es5/widgets.js 2775.2ms 2237ms
simple-classes/widgets.js (static) 1012ms 799.2ms
original/es5/widgets.js (static) 2283.2ms 1783.2ms
single-file/es5/widgets.js (static) 2306.2ms 1789ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants