Re-runs only the ScriptWorker step on windev (master da948e5f, SDK 2.0.1, 16 vCPUs): install as the OtOpcUaHost service,
repo Install-ScriptWorkerIsolation.ps1 applied/re-applied/uninstalled twice under pwsh 7 and Windows PowerShell 5.1,
restricted worker, pipe refuses the admin, runner Healthy, strict-peer/API-key matrix on, then cleanup. The harness drops
-PatchedIsolation, gains -PrepareFrom candidate and -ApplyHost, and suffixes the isolation evidence with -Label.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
6.4 KiB
lmxopcua#800 / #883: ScriptWorker isolation re-run on windev (2026-11-12)
Result: the repository's Install-ScriptWorkerIsolation.ps1 (fixed for #883) passes on both Windows PowerShell 5.1 and
PowerShell 7 against a real OtOpcUaHost service. This re-runs only the step that failed in
../2026-11-12-windev/RESULTS.md (step 3, ScriptWorker). Steps 1, 2, 4 and 5 are in that record.
What was run
- Node: windev (
DESKTOP-6JL3KKO), now 16 vCPUs, elevated SSH session, PowerShell 7.6.10 and Windows PowerShell 5.1.19041. Timings are not comparable to the first run. - Candidate: master
da948e5f(SDK 2:Opc.Ua.Core2.0.1.2), self-contained win-x64, built on macOS.OtOpcUa.Host.exe934a749f446c724579806cbbf36d7a12690a0a5bb9f97b5e39b9502a43c9087a;script-worker\ZB.MOM.WW.OtOpcUa.ScriptWorker.exec2a2a56d3d91916daba72bd4d69e3ded5cad309121ae9ca00d4e8a3fe9aaae12. Manifests:manifest-candidate-*.txt, matched file-for-file on the box (probe, seeder and baseline CLI matched the first run's manifests). The install scripts are the repo tree's. - Install:
Install-Services.ps1 -Roles driver -ServiceAccount 'NT SERVICE\OtOpcUaHost'from the candidate tree (Prepare -PrepareFrom candidate), task-only ports 18800 / 14841 / 18801, anonymous and auto-accept off, Sign + SignAndEncrypt. - Starts: c0 (creates PKI/LocalDb), c1 (seeded, no isolation), c3, c4, c5 (isolation on,
Scripting__Runner=OutOfProcess). The application certificate wasA5A8238BB21874C381EA46294F2D21AF072EF1C0at every start.
Installer cycles (isolation-install-sN.json, isolation-uninstall-sN.json)
| Label | Script version | Apply host | Re-apply | Second re-apply | Uninstall | Second uninstall |
|---|---|---|---|---|---|---|
| s1 | #883 patch only | pwsh 7 | 5.1: 7/7 unchanged | pwsh: 7/7 unchanged | pwsh: 6 changed | 5.1: 6/6 unchanged |
| s2 | #883 patch only | 5.1 | pwsh: AnchorService changed | 5.1: 7/7 unchanged | 5.1: 6 changed | pwsh: 6/6 unchanged |
| s3 | final | 5.1 | pwsh: 7/7 unchanged | 5.1: 7/7 unchanged | 5.1: 6 changed | pwsh: 6/6 unchanged |
| s4 | final | pwsh 7 | 5.1: 7/7 unchanged | pwsh: 7/7 unchanged | pwsh: 6 changed | 5.1: 6/6 unchanged |
-WhatIf on both hosts exited 0 and changed nothing in every cycle.
Second defect found by s2 (fixed in the same commit). The #883 patch made both hosts work, but an apply from Windows PowerShell
5.1 was not idempotent: AnchorService reported changed on every re-run. Windows PowerShell 5.1 passes the literal quotes in
binPath= "C:\...\ZB.MOM.WW.OtOpcUa.ScriptWorker.exe" to sc.exe with legacy quoting, which stored the path unquoted (a path with
spaces, such as C:\Program Files\OtOpcUa, is worse). The step compares the quoted form, so it rewrote the service each time. The
installer now runs sc.exe create|config through Invoke-OtOpcUaSc, which builds the command line explicitly and behaves the same on
both hosts. s3/s4 are with the fix, and Test-ScriptWorkerIsolation.Windows.ps1 asserts the stored path (windows-test-results.txt).
State after apply (s1, #794 step 4)
OtOpcUaScriptWorker: START_TYPE 4 DISABLED, SERVICE_START_NAMENT SERVICE\OtOpcUaScriptWorker, SIDS-1-5-80-1846135827-3903057317-1998105452-3938448374-3023753135(matches #794).<PeCacheDir>: protected, SYSTEM, Administrators andNT SERVICE\OtOpcUaHostfull control, no Users;<PeCacheDir>\peaddsNT SERVICE\OtOpcUaScriptWorker:(OI)(CI)(M).- Install root:
NT SERVICE\OtOpcUaScriptWorker:(OI)(CI)(DENY)(S,RD);script-worker\:(OI)(CI)(RX). - Firewall
OtOpcUa-ScriptWorker-BlockOutbound: Outbound / Block / Any profile, program the worker exe. - Host service environment gained exactly
Scripting__Worker__IdentityandScripting__Worker__PeCacheDir(plus the gate'sScripting__Runner=OutOfProcess); every other entry was kept. After uninstall the environment and the install-root ACL are back to their pre-install state.
Runtime under the real service (isolation-verify-c3/c4/c5.json)
| Start | Isolation applied by | Ready | ServiceLevel | Worker | Pipe, elevated admin | script-runner |
Stop | Strict-peer/API-key matrix + CLIs |
|---|---|---|---|---|---|---|---|---|
| c3 | pwsh 7 (s1) | 15 s | 255 | 1 child of the host, owner NT SERVICE\OtOpcUaHost, restricted=True, 1 privilege |
denied (UnauthorizedAccessException) |
Healthy, PE cache on, 1 pe\ entry |
1.8 s, exit 0, no worker left | 14 cases + 3 CLI reads pass |
| c4 | 5.1 (s2) | 15 s | 255 | same | denied | same | 1.8 s | same |
| c5 | 5.1 (s3, final script) | 15 s | 255 | same | denied | same | 1.8 s | same |
- The window-station grant works under a real service session (coreclr loaded; no
ERROR_DLL_INIT_FAILED). - The out-of-process virtual tag read 800 Good in the probe at every isolation start.
- 0 occurrences of any task secret in the rolling logs, the selflog or the Application event log (
stop-*.json); the evidence folder was scanned against every task secret before it was copied off (0 hits). compare-c0-c1-c3-c4-c5.json: the certificate is identical at every start; c3, c4 and c5 have identical PKI digests and node environment digests (c0 -> c1 differ by the trust copies and the rejected-client entries; c3 onwards adds the isolation ACE and entries).- Not exercised: dropped-packet firewall logging (#794 step 5, QA only).
Standalone Windows test
scripts/install/tests/Test-ScriptWorkerIsolation.Windows.ps1 (new for #883): apply, re-apply, uninstall twice against scratch names and a
stand-in host service. It failed on 5.1 before the second fix and passes 24/24 on 5.1 and on pwsh 7 (windows-test-results.txt).
Cleanup
- The
OtOpcUaHostservice (sc.exe delete), the anchor, the firewall rule,C:\OtOpcUa800and the uploaded scripts are removed;%LOCALAPPDATA%\OtOpcUaClientis restored; firewall rule count 876; MxAccessGw Running with:5130/health/ready200; OtOpcUaWonderwareHistorian untouched (Running).Uninstall-Services.ps1was not used. - Residual: the virtual-account profile
C:\Windows\ServiceProfiles\OtOpcUaHost(S-1-5-80-3928861625-3486739760-3962757976-1980707066-3667558059) was already loaded when this run started (after the reboot) and is still loaded now that the service is gone:Remove-CimInstanceretried for about 2 minutes fails with "being used by another process" andreg unloadis refused. It cannot be removed without a reboot of windev.