Repository navigation
[RFC] Lightweight Linux sandbox backend using bubblewrap + cgroup v2 for non-K8s / non-container deployments #8238
kongxiangxin
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
DeerFlow currently offers these execution modes:
LocalSandboxProvider: runs commands as host subprocesses. The docs are explicit that this is not a security boundary, andallow_host_bashis disabled by default.AioSandboxProvider: Docker/DooD containers, or Kubernetes Pods through the provisioner.We need to run DeerFlow on bare-metal / VM / edge hosts where Docker and Kubernetes are not available or not permitted. In that environment the local provider cannot safely run model-generated shell/code, and disabling
bashremoves much of the agent's value. Spinning up a full container runtime or a K8s cluster is not an option.Proposal
Add an opt-in, Linux-only
BwrapSandboxProviderbased on bubblewrap, with optional cgroup v2 resource limits.Isolation
bwrapfor mount, PID, IPC, UTS, user and (optionally) network namespace isolation.user-datadirectory read-write; bind the skill tree read-only. No host filesystem outside those roots.no-new-privileges, and use a seccomp profile compatible with the existing tool surface.--die-with-parent,--new-session, and bounded process cleanup to avoid orphaned commands.Resource limits
memory.max,pids.max, andcpu.maxwhen delegation is available.Delegate=yes) orsystemd-run --scope; rootful deployments can write the cgroup directly.rlimitwith a startup warning, or refuse to start when a hard limit was requested. This is one of the things I would like maintainers to decide.bwrapprocess.Integration sketch
Implementation would follow the existing
SandboxProvider/Sandboxcontract:execute_command()builds abwrapargv and runs it as a subprocess./mnt/user-data/...keeps working.bwrap; a Linux CI job that checks user-namespace availability and runs a realbwrapsmoke test; docs covering host prerequisites and security caveats.Why not reuse the existing modes?
LocalSandboxProvideris intentionally a convenience mode, not an isolation boundary.bwrap is attractive because it is a small, widely packaged setuid/unprivileged helper with no daemon and no container runtime dependency. It is not a VM, so kernel attack surface remains; the seccomp/capability restrictions and cgroup limits are part of the proposal, not an afterthought.
Questions for maintainers
BwrapSandboxProvider, or a more general pluggable "local isolation backend" abstraction?sandbox.bwrapvs. a genericsandbox.local_isolation)?Additional context
The primary target is non-K8s, non-container deployments (bare metal, VMs, edge appliances) that still need a real isolation boundary around agent-generated commands. I am happy to contribute the provider, tests, and docs once the shape is agreed.
Related docs:
backend/docs/CONFIGURATION.md(Sandbox section) andbackend/docs/ARCHITECTURE.md(SandboxProvider abstraction).All reactions