Security model¶
Docker Sandboxes isolates what runs in a sandbox from the host; fastsandbox drives it and decides what crosses into each sandbox: the directories of the host, the network rules, the credentials, the tools. This page says what is protected, who is trusted, where the boundaries are, which guarantees come from where, and what is out of scope.
What is protected¶
- Your machine: its files, its processes, your user account.
- Your repositories, and what runs from them later: hooks, CI configuration, build scripts.
- Your credentials: API keys, subscriptions, tokens of MCP servers.
- The services you reach: what a sandbox can do with your keys and through the network.
- Other sandboxes and the work in them.
Who is trusted¶
| Actor | Trusted | Why |
|---|---|---|
| Your program: task functions, dependencies, lifespan, callbacks | Yes | It runs on the host, in your process, with your rights: it is not isolated. |
| Any process that can open the socket of the daemon | As much as you | The socket has no authentication beyond its file permissions, your user only: whoever opens it controls every sandbox of the user. |
Docker Sandboxes: sandboxd, its proxy, its microVMs |
Yes | It provides the isolation; fastsandbox adds none. |
| Kits and their images | As much as their publisher | Their install commands run as root in the sandbox; the kit of an agent declares the hosts it reaches. |
| Code in the sandbox: commands, programs, coding agents | No | It is what the sandbox contains. |
| A coding agent | No, and possibly steered by others | It reads the repository, issues, web pages and tool output, any of which can carry instructions; it runs with its approvals turned off. |
| MCP servers | As much as the rights they hold | They act outside the sandbox. |
The boundaries¶
The architecture page shows where each part runs. What crosses from the sandbox to the outside crosses one of these paths, each opened by you:
The socket¶
Whoever can reach the socket of the daemon controls every sandbox of the user: creates them, runs commands in them as root, reads their files, mounts any directory of the host into one, changes the global network policy, and starts sandboxes that use the credentials the daemon holds, a subscription for instance, without seeing their values. Keep the socket, and the programs that use fastsandbox, to trusted code.
An SSH tunnel is root in its sandbox, without
credentials: the SSH server of a sandbox accepts any user, since reaching the
socket is already the authorization.
Host directories¶
| Marker | What the sandbox can do to the host |
|---|---|
WorkspaceDir() |
Change any file of the directory, at once: it is mounted read-write, with no read-only form |
WorkspaceDir(clone=True) |
Nothing: it works on a private clone; the repository is mounted read-only |
Mounted(target, read_only) |
Change the directory or file, unless read_only=True |
Uploaded(target) |
Nothing: it gets a copy |
A read-write directory lets an agent change files that run later on the host
without a review: Git hooks, which git diff does not show, CI
configuration, a Makefile, the scripts of a package.json. See
Host paths.
Network¶
- The global policy of the daemon holds for every sandbox of the user. Its
preset, chosen when
sbxwas set up, may allow every host (Open), or deny by default (Balanced, Locked Down). - The rules fastsandbox adds for a sandbox go with it. A deny rule wins over any allow rule; an allow rule adds to the global policy and restricts nothing: under Open, only deny rules keep a sandbox from a host.
- The proxy can forward a request to a service on the loopback of the host,
host.docker.internal:<port>: deny it when a task does not need it. - HTTP rules apply before the sandbox starts: they cover its startup commands, not its install commands, which run at its creation.
client.policy.check()answers for the global policy only. What a sandbox reached is in the activity log,client.policy.log(), read while it exists.
See the network model.
Credentials¶
- Proxied keys stay with the proxy; the sandbox holds a placeholder. Any process in it can still send that placeholder to the hosts of the key and have the key written in: a compromised agent can make calls billed to your key, or act with its rights, while the sandbox lives.
- In clear in the sandbox: the variables of
env=,KIRO_API_KEYforkiro, and the token of an MCP server of the host. A secret belongs in a key, not a variable. - Held by the daemon: a subscription signed in under
sbxserves every sandbox of its kit created through the socket, as your own account.
See Credentials.
MCP servers and the gateway¶
- A server of the host,
McpServer.host, runs with your rights; the token the sandbox holds in clear gives access to that server alone, for that run. - In its dynamic mode, the MCP gateway lets an agent load any server
registered on the host with
sbx mcp add; a static set of servers, given at creation, prevents it. - A server the gateway starts from a local program runs on the host, outside any sandbox.
See MCP.
Ports, resources and leftovers¶
- A published port makes a service of the sandbox reachable from the host.
cpusandmemorybound one sandbox; there is no disk option per sandbox, and no limit across the sandboxes of the user beyond what the daemon enforces.max_concurrencybounds the runs of one event loop.- A sandbox left by a killed process keeps its files, its rules and its keys until you remove it: see Sandbox lifecycle.
Where each guarantee comes from¶
| Source | What it guarantees |
|---|---|
| Docker Sandboxes, per its documentation | One microVM with its own kernel per sandbox; all outbound TCP through the proxy, which applies the policy; UDP and ICMP blocked by default; sandboxes cannot reach each other. |
| fastsandbox and its crates | Host patterns checked before they are sent; the API version of the daemon checked at connection; the values of keys never given back to Python; a spec refused when a deny rule covers the host of one of its keys; the sandbox of a block or a run removed on return, error or cancellation, with its rules and keys; a unique name per sandbox by default. |
| You, the operator | Only trusted code reaches the socket; the preset of the global policy fits the work; keys have the narrowest rights and a spending limit at their provider; work that comes back is reviewed before it runs on the host; sbx and fastsandbox stay in the supported range. |
Out of scope¶
- Hostile code. fastsandbox relies on the isolation of Docker Sandboxes and was not assessed against code built to escape it. It does not certify that running hostile code is safe.
- Several tenants. A daemon serves one user: every sandbox of that user shares its socket, its global policy, its image store and the credentials it holds. Do not run the work of parties who distrust each other through one daemon.
- What was not measured: the behavior on a restart of the daemon. The
audit of
docker-sandboxmeasured the rest: an HTTP allow rule does not narrow a host the global policy allows, other paths and methods going through; the activity log keeps a removed sandbox, by name.
A checklist for unattended agents¶
- Give the agent a clone (
WorkspaceDir(clone=True)) or an upload, not a read-write workspace. - Check the global policy,
sbx policy ls. Deny what the agent must not reach; to confine it to a list of hosts, setsbxup with the Balanced or Locked Down preset. - Give it only the keys it needs, with narrow rights; keep secrets out of
env=. - Give it only the MCP servers it needs, and a static gateway.
- Give the task a
timeout: a prompt timeout ends the wait, not the agent, which stops when its sandbox is removed. - Check its work with the tests of the project, and read a patch before you apply it.
- After a crash, list what was left with
sbx ls.
The API of the daemon¶
The sandboxd socket API is private to Docker Sandboxes and changes with sbx
releases. fastsandbox checks the API version of the daemon when it connects and
refuses one it has not been audited on, unless told otherwise
(version_policy); see The client.
Reporting a vulnerability¶
See the security policy of the repository.