fix(control): the bridge's pipe lets a sandboxed game's agent in (AppContainer, a farm user) #544
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!544
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/control-pipe-sandbox"
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?
Why
The Test Farm's Windows agent (Beanstalk) runs the game in a sandbox, either an AppContainer or a dedicated low-rights Windows user. Today the control bridge's pipe admits only the game's own user. So the agent can't reach a game in a low-rights user at all, and an AppContainer game's pipe can't make its next instances.
What changed
pipe_security()inhost/control.cnow builds the pipe's permissions (DACL) as before, plus two additions:GA). Each new pipe instance is checked against the existing one's DACL, and an AppContainer token needs its own SID granted.HOS_CONTROL_PEER_SID=<SID>grants that account read and write (GRGW), so the agent's own account can connect to a game running as the farm's user.hos_control_peer_sid_check()accepts only a local user account:S-1-5-21-a-b-c-RID, with exactly five parts afterS-1-5and a RID of 1000 or more;FILE_FLAG_FIRST_PIPE_INSTANCE, remote clients refused, and Linux'sSO_PEERCREDcheck. Linux needs no counterpart, since the farm's bwrap sandbox runs the game as the same user.docs/control.md's Security section covers both additions and the SID rules.peersidcase intests/control_test.c, run fromtests/test_control.py;tests/test_control_pipe_security.py. It readscontrol.c's source for the AppContainer branch, the peer branch and the refused-SID list; it fails if either grant is removed. WithLONGSHOT_MINGWset, it also compileshost/control.candtests/control_test.cforx86_64-w64-mingw32with-Werror.Flags and settings
HOS_CONTROL_PEER_SIDMeasurements
No performance change: the pipe's permissions are built once, when the bridge starts.
main:
7ff5256e(2026-11-14)this PR: fix/control-pipe-sandbox @
11e884ce7ff5256e11e884cetests/test_control.py(Linux)tests/test_longshot_ctl.pyx86_64-w64-mingw32compile ofhost/control.c,-WerrorTesting
Tested: on Linux,
tests/test_control.py,tests/test_longshot_ctl.py(38/38) and the newtests/test_control_pipe_security.py(source checks, and the llvm-mingw compile ofhost/control.candtests/control_test.c). The source check was confirmed to fail when either grant is removed.Not tested: nothing has run on Windows yet: the DACL as Windows reads it back, the
peersidcase, and a sandboxed game's pipe.tests/run_all.pywasn't re-run (to keep CPU free).Needs other testers:
beanstalk-agent sandbox-check(both modes) andpython -I -B tests/test_control.py, expecting the pipe checks to pass in both sandbox modes (request to open).Screenshots
Nothing on screen.
Risk and rollback
It only adds grants, and only for an AppContainer game or an explicitly named local user. Without
HOS_CONTROL_PEER_SID, and outside an AppContainer, the DACL is the same as before. Reverting the commit restores the old behaviour.Reviewer notes
hos_control_peer_sid_check()first.GRGWalso allows creating pipe instances; a narrower grant would turn away normal clients (.NET'sNamedPipeClientStream, a plain open), and this is documented indocs/control.md.Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above). The touched suites were run; the full suite was not re-run, to keep CPU free (see Testing).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.mainand passing here.Pushed: HOS_CONTROL_PEER_SID is now in docs/development.md's switch reference too, next to HOS_CONTROL.
c67b3215c411e884ce38WIP: fix(control): the bridge's pipe lets a sandboxed game's agent in (AppContainer, a farm user)to fix(control): the bridge's pipe lets a sandboxed game's agent in (AppContainer, a farm user)