packages/plugins/sandbox-providers/daytona/DIRECTORY-CONSTRAINT-FINDINGS.md
bwrap) findings for the Daytona session pathThe Daytona provider ran an advisory bubblewrap (bwrap) wrapper around each
user command. The wrapper gave an agent real-time feedback when the agent wrote
to a directory that the ephemeral sandbox does not keep. The wrapper was
advisory only. It added no security boundary; the ephemeral sandbox is the only
boundary.
The provider now runs each user command plain, both on the persistent-session path and on the one-shot fallback path. This note records why the provider drops the directory-constraint goal for now, and what a future re-introduction needs.
The session model runs one persistent shell per lease and feeds every command
into that shell. The plan aimed to enter the bwrap sandbox one time per session
and amortize its cost across every command in the session. A live validation
proved this aim is not reachable with the current Daytona session daemon.
exec-replace of the session shell with bwrap stops the session from
running any later command. A side-channel file proved the inner shell never
ran the next command. A repeat without --new-session gave the same result,
so --new-session is not the cause. The exec-replace itself breaks the
session daemon's per-command delivery.bwrap wrap works inside a session (separated stdout and
stderr, correct exit codes, the session stays alive), but it costs about
1.75 s per command. An un-wrapped session command takes about 0.29 s; a
bwrap-wrapped session command takes about 2.05 s. The wrap adds the full
cost back on every command, which removes the session model's speed win.The wrapper was advisory, not a security boundary. The provider already ran a
command plain when the bwrap capability probe failed, so the plain path is an
accepted, shipped behavior. Dropping the wrapper drops only the advisory
feedback; it does not change the command's privilege or isolation. The command
runs as the unprivileged sandbox user (daytona) in both cases.
exit cannot end the persistent session shell.bwrap apply, the bwrap capability
probe, the bwrap command builder, and the bwrapAvailable /
sandboxUsername lease metadata that only the removed path used.access: "rw" mapping. Nothing reads the set today. It stays
in place so a future isolation wrapper can consume it without a new sync
change.nsenter.exec-replace.exec-replace model is proven unreachable and the per-command wrap is too
slow.bwrap setup cost on every command.