Sandboxing
Lime ships a custom sandbox runtime as a separate binary, srt
(crates/sandbox-runtime/), used to isolate the most dangerous tool
calls. It is enforced on Linux and macOS; on Windows, configuration is
parsed but isolation is not applied.
What srt provides
| Layer | Description |
|---|---|
| Isolation | Per-call process isolation via bwrap on Linux, sandbox-exec on macOS. |
| Network | Network namespace (Linux) or sandbox profile (macOS) with no interface, or a restricted allow-list. |
| Filesystem | Read-only root, read-write workspace, optional explicit mount allow-list. |
srt is invoked transparently by the runtime — there is no separate
configuration step beyond the sandbox section of your settings.
Configuration
{ "sandbox": { "enabled": true, "namespaceRestrictions": true, "networkIsolation": true, "filesystemMode": "workspace-only", "allowedMounts": ["/tmp", "/usr/local/share/git-core"] }}| Field | Type | Default | Description |
|---|---|---|---|
enabled | bool | false | Master switch. When false, every other field is ignored. |
namespaceRestrictions | bool | true | Apply mount/pid/uts/ipc namespaces. |
networkIsolation | bool | true | Enter a network namespace with no external interface. |
filesystemMode | off / workspace-only / allow-list | workspace-only | Which paths are writable inside the sandbox. |
allowedMounts | string[] of absolute paths | [] | Additional read-write mounts. Used when filesystemMode is allow-list and as supplementary mounts for workspace-only. |
Inspect runtime status
lime sandbox # one-shot snapshot/sandbox # inside the REPLBoth render:
- Whether the sandbox is enabled.
- Whether
srtis on thePATH(or which path was used). - Resolved
filesystemModeandallowedMounts. - A short test that confirms the runtime can launch a sandboxed
truewith the configured options.
Which tool calls go through srt?
The runtime sends a tool call through srt when all of the following
hold:
sandbox.enabledistrue.- The host platform is Linux or macOS.
- The tool is in the
FullAccesspermission category (e.g.bash,bash_session_*,powershell,repl,enter_worktree,spawn_agents_on_csv). - The tool’s invocation does not declare an explicit
requires_unrestricted_hostflag (a small allow-list of system tools that need direct host access).
ReadOnly and WriteWorkspace tools run in-process; the
permission model gates them. The sandbox is for
the long tail of arbitrary code execution.
Limitations
- Windows is not enforced. Sandbox configuration is parsed but isolation is not applied; rely on the permission model and exec rules. WSL 1 is also unsupported (WSL 2 works as Linux).
- No GPU isolation. If your tool calls use the GPU, isolate at the container layer instead.
- No CPU / memory caps. Use
cgroups(Linux) or your host’s process-control layer for that.
Defense in depth
The sandbox is one layer. The full stack is:
- Hooks (
PreToolUse) — write your own veto / rewrite logic. - Exec rules — TOML allow/deny.
- Permission policy — per-tool allow/deny/ask + permission mode.
- Sandbox — namespace / net / fs isolation for
FullAccesscalls.
Disabling any one of them does not disable the others.