Seatbelt: a readwritePaths grant allows connect() to every Unix socket under it, so getTemporaryFilesPolicy exposes local programs' sockets
Relevant area(s)
macOS / Seatbelt, Node SDK policy helpers
Brief description of your issue
On macOS a readwritePaths entry lets the workload connect() to any Unix-domain socket below it. Combined with
policy.filesystem.getTemporaryFilesPolicy(), which returns the user's whole temp folder ($TMPDIR, i.e.
/var/folders/.../T/) read-write, a sandbox built from the recommended helpers can talk to every local program that keeps
its socket there (IDE servers, language servers, agents' control sockets, ssh-agent forwards, etc.), with the user's
rights on the other end.
This is the same shape as #1455 (a recommended helper widening the sandbox more than its name suggests), fixed by #1463.
What an embedder has to do today: not use getTemporaryFilesPolicy, create a private temp folder per sandbox, grant only
that, and set TMPDIR to it.
Steps to reproduce
- On the host, listen on a Unix socket under
$TMPDIR(e.g.node -e "require('net').createServer(s=>s.end('hi\n')).listen(process.env.TMPDIR+'/probe.sock')"). - Spawn a workload with
filesystemfromgetTemporaryFilesPolicy()(orreadwritePaths: [$TMPDIR]) and no network. - From inside,
node -e "require('net').connect(process.env.TMPDIR+'/probe.sock').pipe(process.stdout)"printshi.
Measured on 1.1.0, with a control:
temp policy: rw=["/var/folders/…/T/"]
rw = getTemporaryFilesPolicy(): hi-from-host
rw = a private folder only: connect error EPERM
Expected behavior
Any of:
- document that a read-write grant includes Unix-socket connect on macOS;
- have
getTemporaryFilesPolicyreturn a fresh per-sandbox temp folder instead of the user's whole one; - a way to grant read-write without socket connect. #1277's proposed
seatbelt.deniedUnixSocketPathswould let callers deny it, but the default stays open.
Environment
@microsoft/mxc-sdk 1.1.0, macOS 26.7 arm64.