Restrict the worker named pipe to the current user (R21-O8 / GWC-05) #187
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The worker pipe is created with no ACL and no
CurrentUserOnly(SessionWorkerClientFactory.CreatePipe); only the unguessable name andmaxNumberOfServerInstances: 1limit access.Source:
archreview/2026-10-21/remediation/00-tracking.mdrow R21-O8 (cycle-1 GWC-05)Next step (from the tracker): Add
PipeOptions.CurrentUserOnly(or aPipeSecurityfor the worker account); confirm the worker runs as the same user on windev; add a launch test. Confirmed 2026-11-06: noCurrentUserOnlyanywhere undersrc/.Current-state evidence: the row is still
Open/Deferredin the latest (2026-10-21) tracker, and a code check on localmain@8c0a51d(2026-11-06) found it still present unless noted below.Fixed on
mainin34a7453+777fef9. The fix is on the gateway side: the gateway hosts the pipe server (SessionWorkerClientFactory.CreatePipe), and the net48 worker is only aNamedPipeClientStreamclient, so the worker code doesn't change.NamedPipeServerStreamAcl.Createand aPipeSecurityfrom the newWorkerPipeSecurity.CreateForCurrentUser(). The DACL is protected (no inherited entries), the owner is the gateway user, and its only entry is FullControl for the gateway process user. The worker runs as that same user becauseWorkerProcessLaunchersets no alternate credentials; on windev the service runs as LocalSystem.PipeOptions.CurrentUserOnly. On Unix, .NET enforces this by checking the peer's credentials at accept time.777fef9): the first version also had a deny ACE forNT AUTHORITY\NETWORK. That SID marks a network logon, not a remote caller. The SSH session token on windev carries it, so the deny entry locked the gateway's own same-machine workers out (UnauthorizedAccessExceptionon connect, 15 fake-worker tests failed).Tests (
WorkerPipeSecurityTests):Create_GrantsOnlyTheUser(Windows): the ACL is protected, the owner is correct, and the only entry is an allow for the user.CreatePipe_OnWindows_AppliesCurrentUserOnlyAcl(Windows): reads the ACL back from the created kernel pipe object. Exactly one entry (current user), and no Everyone or Anonymous allow.CreatePipe_AcceptsClientRunningAsTheSameUser(all platforms; on windev it runs from a network-logon SSH session).UnixPipeOptions_AreAsynchronousAndCurrentUserOnly.Evidence at
777fef9:C:\build\mxgw-issues-187gateway suite: 1349/1349 passed, all 4WorkerPipeSecurityTestspassed.WorkerLiveMxAccessSmokeTests.GatewaySession_WithLiveWorker_RegistersAdvisesStreamsDataAndClosespassed. It launches the real x86 net48 worker throughSessionWorkerClientFactory, so the real worker connects through the restricted pipe end to end. I ran only this read-only test; no Galaxy writes.windev-worker-ci.ps1 -Mode test: SUCCESS at777fef9.The MxAccessGw NSSM service on windev was not touched.
Not tested: a negative test from a different local account. windev has no spare account to run one, so the "other users denied" side is proven from the ACL contents, not from a rejected connect.