Codumentor logo Codumentor Enterprise

Light Sandbox

Confines the agent's shell commands to the working folder. A confined command:

Reads elsewhere (your ~/.gitconfig, toolchains under ~, system files) work
as usual — except under the Windows AppContainer backend, which reads nothing
in your profile beyond the working folder, the toolchains on PATH and
read_extra (see Windows). File tools (read_file, write_file, …) are not affected by this
plugin.

The Office editors' document workers (doc_editor, xlsx_editor,
pptx_editor) run under the same sandbox on Linux and Windows, with
Codumentor's own code readable to them, and protected paths are checked
after each of their commands. Other plugins get the same through
Helper Processes.

Shipped in the Community edition, enabled by default. It cannot be combined
with Workspace Isolation: a configuration enabling
both refuses to start.

Platforms

OSMechanismStatus
Linuxbubblewrap (bwrap), no overlayavailable
LinuxLandlock (kernel ≥ 5.13), when bwrap cannot runavailable (fewer guarantees below 6.12)
macOSSeatbelt (/usr/bin/sandbox-exec, no sudo)available
WindowsAppContainer at low integrity, in a job object (windows-appcontainer)available (active; DPAPI listed as a known gap)
Windowslow-integrity token in a job object (windows-lowil), when the AppContainer cannot startavailable (partial: network and credential stores open)

On Linux install your distribution's bubblewrap package. On Ubuntu 24.04+
the apparmor package already lets /usr/bin/bwrap create user namespaces.

macOS

macOS needs nothing installed: sandbox-exec ships with the OS. Commands
may write the working folder and $TMPDIR only; secrets, Codumentor's data,
the keychain, the pasteboard, AppleEvents, defaults write and launchd
jobs are all refused, and there is no network unless a call asks for
network: true. Even then this Mac's own services (localhost, and the
Mac's LAN address) stay unreachable, and a server started inside the sandbox
cannot listen on loopback, so test suites that start a local server need
sandbox: false.

Other processes are out of reach too: a command cannot signal or inspect
processes outside its own sandbox, or read their launch arguments and
environment (KERN_PROCARGS2), so API keys in the server's environment stay
hidden.

Other differences from Linux: ps, top and pgrep do not work in the
sandbox; /tmp is not writable ($TMPDIR is); tools that start their own
sandbox need it turned off (swift build --disable-sandbox, Chrome
--no-sandbox); Office workers still run host-direct.

Landlock fallback

With backend: auto (the default) the probe tries bubblewrap first; where it
is missing or blocked (containers, hardened distributions, AppArmor without
the bwrap profile) it uses Landlock, which needs no privileges and no user
namespaces. backend: landlock pins it. sandbox status then shows a
backend_fallback row naming why bwrap was skipped. Landlock differs from
bwrap in places, and the status says exactly what it verified (active on
Linux ≥ 6.12 x86-64/arm64, partial below):

Commands start through a small launcher process (one per server) that is
itself confined; each command applies its own exact rules before it runs.

Windows

With backend: auto the probe tries the AppContainer backend
(windows-appcontainer) first and falls back to the low-integrity one
(windows-lowil); either can be pinned. Both run confined commands in
PowerShell and share the token and job object described under *Low
integrity* below.

AppContainer (windows-appcontainer)

Each command also runs inside a Windows AppContainer (one per Codumentor
home, created without admin rights). A container reads only what is
explicitly opened to it, so:

Limits:

Routes (besides GET status, whose admin_setup holds only counts):
GET setup, POST setup/run ({"ids": [...]}, omitted: all undismissed;
waits for the prompt) and POST setup/dismiss ({"ids": [...],
"dismissed": true}
). All three need admin:*.

If the AppContainer gets in the way, backend: windows-lowil runs commands
at low integrity only.

Low integrity (windows-lowil)

Commands run with a copy of your login token lowered to low integrity and
stripped of privileges, inside a job object that ends with the command (its
leftovers are killed) and refuses clipboard and desktop access. No admin
rights are needed. The policy becomes Windows integrity labels: the working
folder, the conversation's temp and the sandbox cache are labelled low (so
commands can write them), the deny-list is labelled so low processes cannot
read it, and protected paths are labelled so they cannot be written. The
first start walks the working folder once to label it (about 5 seconds per
100,000 files); later starts only re-check. codumentor sandbox reset
removes every label the sandbox set.

Its status is partial, by design:

Writes outside the folder (also through a junction), reads of the deny-list
and of Codumentor's data, writes to protected paths and reading the server's
memory are verified blocked. A file moved into the folder from elsewhere keeps
its own label and stays read-only to commands until it is copied instead.

What happens when it cannot run

At startup the plugin probes the host: it spawns small canaries that try
to write outside the folder, read a planted secret, read another process's
environment and connect to a loopback port, and only what is verifiably
blocked counts. The startup log prints one line with the result.

StateShell commandsWhere you see it
activeconfined as aboveSandbox: active (bwrap, offline)
partialconfined; the unverified guarantees are listedSandbox: partial … not enforced: …
unavailablerun unconfined, decided as with no sandbox: your allow/deny rules and approvals mode apply, nothing is treated as contained, and every approval dialog shows a "not sandboxed" badge with the reasonSandbox: NOT AVAILABLE — <reason>. Fix: <fix>
disabledrun unconfined, permission rules as usualSandbox: off (config)

If the sandbox fails after startup (e.g. bubblewrap was removed), the failing
command reports the error and the next turn runs unconfined as above.

The chat header's sandbox chip is green when the state is active and the
network is blocked (amber otherwise, red when unavailable). Its popover lists
the probe rows; a declared gap (residual: true in the status JSON, e.g.
dpapi_decrypt on Windows) is shown as a "known limit" with a plain-language
note, not as a failed check. The popover also says what the assistant can ask
for: network access for one command (where the network is blocked) and a run
outside the sandbox (unless allow_unsandboxed: false), each behind your
approval.

Network and unsandboxed commands

When the sandbox blocks the network, the shell tool gains two parameters:

When an offline command fails with a network error (Could not resolve host,
ENOTFOUND, …), the result tells the agent to retry with network: true.

Each conversation's private /tmp ($CODUMENTOR_HOME/sandbox/tmp/<id>/) is
removed when the conversation is deleted, and after 7 days without use.

The agent is told which state applies in its tool environment note
(Sandbox: light, network off — … or Sandbox: none (<reason>)).

Configuration

plugins:
  - module: codumentor.plugins.light_sandbox
    class: LightSandboxPlugin
    args:
      enabled: true            # false: sandbox off, plain host execution
      backend: auto            # auto | bwrap | landlock | seatbelt | windows-appcontainer | windows-lowil
      allow_unsandboxed: true  # offer the shell tool's `sandbox: false` escape
      read_deny_extra: []      # more paths nobody may read (~, $VAR, %VAR% expanded)
      read_deny_remove: []     # drop a default deny entry (exact match; warns at startup)
      protected_extra: []      # more read-only paths, relative to the working folder
      protected_remove: []     # drop a default protected path
      read_extra: []           # Windows AppContainer: more readable directories
      env: {}                  # added to every command's environment
      seccomp: default         # Linux: default | off | log | enforce
      allow_nested_sandboxes: false # Linux bwrap only; targeted seccomp relaxation
      network_helper: auto     # Linux: auto | pasta | slirp4netns | none
      network_helper_path: null  # the helper binary, when not on PATH

Changes take effect after a restart.

Commands

HTTP

GET /ui/plugins/light_sandbox/status (?refresh=true re-probes):

{
  "enabled": true,
  "probed": true,
  "state": "active",
  "backend": "bwrap",
  "containment": {"writes": true, "secret_reads": true, "network": true, "process": true},
  "reason": "",
  "fix": "",
  "checks": [{"name": "write_outside", "ok": true, "detail": "blocked"}],
  "network_default": "off",
  "network_helper": "pasta",
  "allow_unsandboxed": true,
  "summary": "Sandbox: active (bwrap, offline) — commands may write only the working folder",
  "working_folder": "/home/me/project",
  "workspace_isolation_in_edition": false
}

workspace_isolation_in_edition says whether this build contains the
per-conversation workspace sandbox. When it is false (the Community
edition), the chip's popover adds one line naming per-conversation
workspaces as what Enterprise adds, linking to the editions guide
(src/codumentor/enterprise_pointers.py).

containment.network: true means the network is blocked (for ordinary,
offline commands). network_helper names the helper network: true commands
use, or null when they share this machine's network; the network_loopback
check says the same as blocked/open. The route is not mounted when the plugin
is absent.

Notes