Put your agent in a cage, not your prod DB.
Real gpt-5.4-mini agent, real kernel/proxy denials — the planted .env and
SSH key are fake demo values. Full 43-second cut:
docs/demo/clawcage-ad.mp4.
clawcage wraps any AI coding agent — Claude Code, Codex, aider, your own
scripts — in a deny-by-default sandbox. Configured filesystem and network
boundaries can keep SSH keys and .env files out of reach and restrict writes.
Those boundaries include baseline grants and platform-specific limitations;
files or write endpoints you allow remain available to the agent.
$ clawcage claudeOne static Go binary. No daemon, no container images, no root, no account, no telemetry, no network calls at startup — ever.
Agents act on text. A skill, a README, a fetched web page, a GitHub issue, a compromised npm package — any of them can say "run this command", and the agent will. Detecting malicious intent in text is a losing arms race, so clawcage does not try.
We don't detect malicious text. We constrain capability at execution time.
The agent is constrained by cage.yaml, the backend's baseline grants, and
the guarantees actually in force on the host (see the table below). The same
configured boundaries apply whether the agent is malicious, prompt-injected,
or confused. They do not prevent abuse of allowed files or endpoints; argv
rules are best-effort, and binary allowlisting requires an exec: section.
No AI in the security path. Enforcement is a deterministic policy engine
at the OS boundary: kernel sandboxing for files and processes, a mandatory
egress proxy for the network. LLMs appear in exactly two optional places —
drafting a manifest from an observed run, and explaining a blocked action in
English — and both degrade to deterministic output when no LLM is configured.
An import-guard test (internal/explain/imports_guard_test.go) structurally
prevents the enforcement packages from even linking against the LLM code.
Homebrew:
$ brew install BariBariGood/tap/clawcageChecksum-verified installer:
$ curl -fsSL https://raw.githubusercontent.com/BariBariGood/clawcage/main/packaging/install.sh | shcurl | sh means trusting GitHub's TLS and this repo at fetch time. The script
is ~100 lines of POSIX sh, checksum-verifies the binary against the release's
own checksums.txt before installing, fails closed, and never pipes anything
to eval — but if that trust model bothers you (it's reasonable that it does),
use Homebrew, go install, or download the tarball and verify the checksum
yourself. macOS specifics (quarantine, no-sudo install): docs/macos-install.md.
From source (Go 1.25+):
$ go install github.com/BariBariGood/clawcage/cmd/clawcage@latestbrew upgrade clawcage, re-run the installer script, or go install ...@latest
again. clawcage never phones home, so it will not notify you of new releases —
check the releases page or your package manager.
Every example below uses claude, but clawcage wraps ANY program. No agent on
this machine? Try the cage itself:
$ cd some-project && clawcage init --yes
$ clawcage sh$ source <(clawcage completion bash) # zsh: compdef clawcage <(clawcage completion zsh); fish: clawcage completion fish | source$ sha256sum -c --ignore-missing checksums.txt # checksums.txt from the same GitHub release
$ clawcage version # prints the tag's version + commitBinaries are built with CGO_ENABLED=0 -trimpath from the tagged commit; with
the same Go toolchain (pinned by go.mod) you can rebuild and compare hashes
yourself. The go install path is an independent build channel whose module
hash is pinned by the public Go checksum database. There is no artifact
signing yet — the release checksums and the reproducible build are the trust
anchors, stated plainly.
$ cd your-project
# 1. Write a starter manifest. It shows exactly what it grants before writing:
$ clawcage init
project node.js (package.json) preset: nodejs-project
agent claude
the agent will be able to:
read/write ./** (this project; write-protected: ./**/.git/hooks/**, ./.git/config, ./.git/hooks/**, ./cage.yaml, ~/.config/clawcage/**)
never ./**/id_rsa*, ./.env*, ~/.aws/**, ~/.config/gh/**, ~/.gnupg/**, ~/.ssh/** (deny, not overridable at runtime)
network *.githubusercontent.com, github.com, registry.npmjs.org (TLS, methods per rule)
run git (some invocations denied), node, npm, npx
everything else: prompts you first, denies on timeout.
# ...or draft one from an observed run instead (recorded, reviewed, never auto-enabled):
$ clawcage learn claude
# 2. Check what your host can enforce (per-guarantee, with fixes for anything degraded):
$ clawcage doctor
# 3. Run the agent caged:
$ clawcage claudeRunning clawcage <agent> with no manifest proposes the same starter
interactively — one keystroke to accept, e to edit first, q to walk away.
Non-interactive runs with no manifest refuse to start (exit 122) instead of
running unprotected.
Everything after the agent name is passed to the agent verbatim; flags before
it belong to clawcage (clawcage --manifest ./cage.yaml npx some-agent --agent-flag).
When something is denied at a prompt, you choose: allow once, allow always
(written back into cage.yaml, comments preserved), or deny. Non-interactive
and CI runs auto-deny everything that would prompt.
Other commands: clawcage replay [session|last] (timeline of a recorded
session, --follow to tail live, --format jsonl to export),
clawcage verify-log (integrity-check the recorder's hash chain),
clawcage explain <code|last>, clawcage policy (lint / semantic diff /
test / explain the merged policy), clawcage secrets (the encrypted vault),
clawcage gc, clawcage version.
Real output, namespace backend, starter manifest from clawcage init:
$ clawcage bash -c 'cat ~/.ssh/authorized_keys'
clawcage: namespace cage — guarantees in force: fs, net-no-bypass, exec-kernel, secrets-brokered; NOT in force: limits, per-tool-fs (details: clawcage doctor)
clawcage: DENIED exec spawn cat /home/user/.ssh/authorized_keys — no exec.allow rule matches this program (exec.default-deny; covered by the opt-in read-only floor: exec.baseline: coreutils-ro)
allow it: cage.yaml → exec.allow: [{cmd: cat}] details: clawcage explain exec.default-deny
clawcage: 1 denied: 1 exec (cat) — clawcage replay lastEvery denial names its stable reason code and, where the manifest schema makes
the fix obvious, the minimal cage.yaml edit. For the everyday shell plumbing
(cat, ls, grep, sed, ...) there is also a one-line opt-in floor —
exec.baseline: coreutils-ro — that allowlists a fixed, documented set of
read-only tools without touching the fs or network walls (see
docs/policy-spec.md §6.1). Add the rule (one line, or press
A at the interactive prompt to write it back for you) and the legitimate
version works — while the actual secret stays out of reach, because inside the
cage the path does not exist:
$ clawcage bash -c 'cat notes.txt' # after exec.allow: [{cmd: cat}]
readable
$ clawcage bash -c 'cat ~/.ssh/authorized_keys'
cat: /home/user/.ssh/authorized_keys: No such file or directoryThe full reason-code table lives in docs/denials.md;
clawcage explain <code> prints the same rows at the terminal. Explicit-deny
codes deliberately come with no allow instructions.
Per claim: the enforcing mechanism, the fixture or test specifying the
expected behavior (testdata/evilskills/, paired — where a benign analogue
exists — with a fixture asserting the legitimate equivalent still works),
and the strength per platform. "Kernel" means the OS enforces it against arbitrary code;
"proxy" means clawcage's
network chokepoint enforces it; "best-effort" and "not provided" mean exactly
those words. Fixture references are not blanket passing results: see Status
for the known-failure ledger and unexecuted macOS corpus. Filesystem grants
include the backend baseline (including scratch space and, on macOS,
/private/etc); they are not limited to the manifest paths alone.
macOS status: the Seatbelt backend is wired into the binary and starts real caged runs on Apple silicon — verified with the real binary on an M4 Pro (macOS 26.5.1):
doctorreportsbackend seatbelt/caged runs available (tier: seatbelt), and kernel-enforced fs/exec/egress denials were observed alongside a working allowed egress path through the proxy. What is genuinely NOT enforced there, and disclosed by the banner anddoctor:limits,per-tool-fs, and login-keychain reachability. And macOS filesystem telemetry carries only best-effort Seatbelt denials (the violation-log monitor forwards blocked reads/writes into the flight recorder with their paths — lossy, deny-side only): there is no seccomp decision sensor, so allowed accesses leave no per-file rows. The fs boundary is kernel-enforced either way. Checkclawcage doctoron your Mac; it says exactly what is and is not in force per guarantee.
| Claim | Mechanism | Proof | Linux | macOS |
|---|---|---|---|---|
Agent can't read outside fs.read plus backend baseline grants |
mount-ns view (paths don't exist) + Landlock where available; Seatbelt path rules on macOS | v01-symlink-ssh, v02-hardlink-shadow, v03-dotdot-traversal |
Kernel | Kernel (Seatbelt) |
Agent can't write outside fs.write plus backend baseline grants |
same | v08-write-bashrc, v04-toctou-swap |
Kernel | Kernel (Seatbelt) |
| Agent can't reach non-allowlisted hosts | Linux: netns with no route except the proxy; macOS: Seatbelt deny-default network with loopback pinholes to the proxy; L7 policy + in-cage DNS that answers allowlisted names only | v15-rawsocket-egress, v16-hardip-connect, v17-dns-exfil, v21-transparent-bypass |
Kernel + proxy | Kernel (Seatbelt) + proxy |
| Agent does not receive brokered secret values (operator-granted secrets are outside this claim) | placeholders in env; injection at the proxy, bound to the TLS-verified destination host; vault outside the cage | v25-secret-misroute, v25-secret-replay, v31-vault-read |
Architecture | Architecture |
With an exec: section, agent can't exec non-allowlisted binaries |
kernel execute allowlist (Landlock EXECUTE / noexec mounts) | v32-exec-outside-allowlist, v33-exec-abspath-bypass |
Kernel | Kernel (Seatbelt) |
argv-level rules (git push --force*) |
PATH shim; on Linux, argv-constrained commands are additionally wrapped so an absolute-path spawn is refused by the kernel | v33-exec-abspath-bypass, b34-exec-wrapped-by-name |
Best-effort — in-cage code can still request an allowed argv from the broker and exec the vended descriptor with a different one; commands that can't be wrapped (interpreted scripts) stay advisory. The binary allowlist and the network rules are the real boundary | Best-effort — unwrapped: absolute-path spawns skip the shim |
Per-tool fs narrowing (tools.<key>.fs) |
exec broker verdict + a second Landlock ruleset installed by the shim immediately before the tool executes (rulesets stack: the tool and its children run inside cage-global ∩ tool scope; the tool keeps the disclosed baseline — host base profile and the cage's shared TMPDIR//dev/shm scratch); namespace backend only — a Landlock cage's execute withholding refuses even the broker's descriptor at execve, so the tool could never run there; refuses to start (exit 121) when a declared narrowing cannot be installed — no Landlock, non-namespace backend, unwrappable command, or tool-level fs.deny (the per-exec ruleset is grant-only) |
TestToolFSE2E + TestToolFSE2ERefusesUnwrappable + TestToolFSE2ERefusesLandlockBackend (real-binary CI gate in the landlock-e2e lane; the fixture harness cannot host this — see testdata/evilskills/README.md) |
Kernel (Landlock ABI ≥ 3 under the namespace backend — ABI 3 is the first that mediates truncate(2), so an older kernel could not refuse a narrowed tool shrinking files outside its scope; refuses otherwise) |
NOT enforced — Seatbelt profiles are per-cage; disclosed by banner/doctor, guarantees: [per-tool-fs] refuses |
| Audit trail the agent can't tamper with | flight recorder outside the agent's access; hash-chained rows, clawcage verify-log (integrity checks, not authentication against the database owner) |
v30-recorder-tamper |
Enforced (subject to disk space) | Enforced |
| Attribution of filesystem decisions under a racing anchor or symlink component | cwd timeline (watched chdir/fchdir + completion fence) for cwd anchors; completion-fenced identity witness (inode + link target of every walked component, re-checked once the caller's next syscall proves the raced one finished) plus a rebinding timeline (every watched unlink/rmdir/rename/mkdir/symlink counted against its resolved name — both ends of a rename — so flips that restore the sampled identity are still seen) for the components of any watched path — absolute paths included; double-read for dirfd anchors; session-level degraded note on the first observed disagreement |
TestAttributionRaceGate (real-binary CI gate over testdata/attribution-race/run.sh: control exact and unmarked, cwd zero wrong-and-silent, symlink and symlink-paced (the paced-writer regime of QA finding G1) must sample the class — most rows marked — and stay within the disclosed silent residual, dirfd gated on the session-level disclosure — its per-event residual is the disclosed probabilistic gap) |
Verified or disclosed, never guaranteed — cwd-anchored races are detected deterministically and marked per event; path-component rewrites (a symlink repointed or replaced, or a plain directory exchanged for one — open to any process that can write a parent directory, no fs_struct sharing needed, absolute paths included) are marked whatever their timing by the fenced witness plus the rebinding timeline, including flips that restore the component's identity inside a paced writer's long window (measured on the QA reproducer shape: 97–100% of rows marked, wrong-and-silent 0 across paced and unpaced 3×400 runs); dirfd-anchored movement is caught probabilistically per event (ceiling ≈ one half), escalated to a session-level warning on the first catch. Residuals: a CLONE_FS-without-CLONE_THREAD sibling process evades the topology gate; a dirfd flip slower than the double-read window can pass unmarked; a rebinding by an unwatched mechanism (e.g. a mount-table change), a syscall still in flight when its deferred row's age budget expires (rows are drained on age, never judged against arbitrarily later filesystem state; a dead thread's rows fall back to the surviving process's root), or concurrently-pending rebindings of two or more mutator threads netting out to the sampled identity, cannot be verified |
Not applicable — no seccomp decision sensor; telemetry comes from the Seatbelt violation log |
Agent can't escape the cage with a syscall (nested namespaces, ptrace-attach to a sibling, device nodes, raw sockets, TIOCSTI, mount, bpf, io_uring, kernel modules, …) |
seccomp-BPF escape filter (EPERM; clone3 ENOSYS so the flag mask is inspectable; foreign ABI killed), installed by both Linux backends immediately before execve, after the mounts are in place |
v10-mknod-device, v11-ptrace-sibling, v15-rawsocket-egress, v27-nested-userns, v34-tiocsti-inject, benign b11-debugger-allowed / b27-toolchain-userns |
Kernel — on any host with seccomp(2); without it the run is degraded loudly (--require seccomp refuses instead). Denials are enforced but not recorded: a RET_ERRNO refusal is visible only to the payload and in the kernel audit log, so no flight-recorder row exists for one |
Not provided — macOS has no seccomp equivalent; disclosed by the banner and doctor |
Host identity and configuration files (/etc/passwd, /etc/shadow, /etc/group, machine-id, …) aren't readable |
Linux base profile grants curated /etc entries only (resolv.conf, nsswitch.conf, the trust stores, gitconfig, ld.so.cache, services/protocols, the zoneinfo pointers), never /etc itself; /etc/hosts is synthesised loopback-only under the namespace backend — under Landlock, which cannot substitute content, the base profile's grant is withheld (reads denied) and the run discloses it as a startup degradation |
v03-dotdot-traversal, v41-etc-recon, v50-ca-key-read, benign b42-etc-gitconfig |
Kernel (they are not in the view) | Not provided — the Seatbelt base profile grants /private/etc wholesale, so host identity files are readable inside the cage; recorded as a startup degradation |
limits.max_shm bounds the cage's shared memory |
size= on the cage-private /dev/shm tmpfs; a write past the cap fails with ENOSPC in the kernel |
v36-shm-fill (8 MiB manifest stops a 64 MiB dd) |
Kernel — namespace backend only; the Landlock backend mounts nothing and says so as a startup degradation rather than accepting the key and ignoring it | Not provided — no cage-private /dev/shm; disclosed |
Resource limits (limits:) |
cgroup v2 where delegated; rlimits otherwise | limits-e2e CI lane (real-binary OOM-kill / pids.max on a delegated cgroup; the harness cannot host this fixture — see testdata/evilskills/README.md) |
Best-effort — kernel-enforced where a delegated cgroup v2 subtree exists; clawcage doctor reports whether they are enforced on your host |
Best-effort |
| Sub-host (URL-path) network rules | per-rule paths:/method filters at the proxy |
fixture-backed for method rules (v21-npm-publish-exfil) |
Proxy | Proxy |
| Protection against kernel 0-days | — | — | Not provided — compose with a VM/gVisor | Not provided |
| Detection of "malicious" text | — | — | Deliberately not attempted | same |
Two honesty mechanisms back this table at runtime: every run starts with a
one-line banner naming which guarantees are and are not in force on this
host (you saw it in the transcript above), and clawcage doctor prints the
per-guarantee matrix, what any degradation means, and the fix. No silent
downgrades.
| Tool | What it's great at | Why it doesn't answer this problem |
|---|---|---|
| Docker | reproducible environments, image distribution | Unrestricted egress by default; volume mounts are all-or-nothing; no secret brokering, approvals, or audit; a reachable docker.sock is root-equivalent (fixture v26-docker-sock). You could build most of clawcage on top of Docker — that's the point: it isn't there. |
| firejail | quick per-app profiles on desktop Linux | Large setuid-root binary (historical CVE source); its profile language wasn't built for per-domain L7 egress or secret injection; no audit/replay. |
| bubblewrap | minimal, well-audited sandbox primitive (Flatpak's base) | It's a primitive, by design: no policy language, no egress proxy, no DNS control, no approvals, no recorder. clawcage uses the same kernel facilities and adds the policy layer. |
| gVisor | kernel-syscall-surface reduction | Solves a lower layer (kernel exploit mitigation). No L7 egress policy or secret brokering. Composes well: gVisor under, clawcage's policy on top. |
| devcontainers | reproducible dev environments | An environment convention, not a security boundary: full network, secrets in env vars, docker.sock frequently mounted. |
| a VM | strongest isolation boundary | Excellent blast-radius wall, weak policy: the VM's network is open unless you build the egress proxy yourself, secrets you copy in are exposed, no per-action audit. Also the heaviest workflow tax. Use a VM and clawcage for truly untrusted code. |
# Everything not allowed here is denied.
version: 1
extends:
- preset: nodejs-project # built-in: readonly base + ./** write + npm registry (GET) + node/npm/npx
approval: prompt # blocked ops ask: allow once / always / deny (default)
fs:
read:
- "./**" # relative globs resolve against this file's directory
write:
- "./**"
deny: # deny beats allow, always
- "./.env*"
- "~/.ssh/**"
net:
allow:
- domain: "api.github.com" # exact host
- domain: "*.githubusercontent.com" # or wildcard suffix
methods: [GET, HEAD] # optional; empty = all methods
# ports: [443] # optional; empty = 80 + 443
secrets:
GITHUB_TOKEN: # agent env gets GITHUB_TOKEN=${GITHUB_TOKEN} — a placeholder
inject:
- domain: "api.github.com" # real value injected only toward this exact host
header: "Authorization"
format: "Bearer {}"
exec:
allow:
- cmd: "npm"
- cmd: "git"
args: ["push origin *"] # restricted arg patterns (best-effort — see the guarantees table)
deny:
- cmd: "git"
args: ["push --force*"]
limits:
max_processes: 256
max_memory: 2GB
wall_time: 2hFull reference — every key, defaults, glob and merge semantics: docs/manifest.md. How the pieces fit: docs/architecture.md.
A hand-written manifest with filesystem grants but no exec: section still
runs — the kernel execute allowlist stays inactive and any binary under a
granted path (or on PATH) can spawn. clawcage policy lint warns about this
(L015) and other over-broad grants, but only if you ask. Pass
clawcage run --strict-lint … to make the run itself refuse to start
(exit 124) when the merged policy has any error- or warning-severity lint
finding. Useful for unattended/headless runs, where nobody is watching for
warnings:
clawcage --strict-lint --manifest cage.yaml claude "fix the failing tests"- The manifest is parsed strictly and flattened into an immutable policy
outside the cage; the
cage.yamlthe agent can see is an inert copy (rewriting it changes nothing and is logged — fixturev28-manifest-reload-toctou). - The agent tree runs inside the strongest containment tier the host offers —
Landlock, namespaces + pivot_root + seccomp on Linux; Seatbelt
(
sandbox-exec) profiles on macOS — chosen by probe, refusing to run if none can enforce. - The only network route out is clawcage's proxy: an
lo-only network namespace on Linux, a Seatbelt deny-default network with loopback pinholes on macOS. Not anHTTP_PROXYenv var that malware can ignore. - The proxy routes on the TLS-verified server name, MITMs with a local per-install CA for method/path rules and secret injection (pinned clients fail closed), and runs the cage's DNS — answering only allowlisted names.
- Recorded decisions land in a hash-chained SQLite flight recorder outside
the agent's access;
clawcage replayshows those records. Recording is not complete: macOS filesystem telemetry is lossy and deny-side only, and Linux escape-syscall denials leave no recorder row.clawcage verify-logchecks sequence continuity and hash-chain consistency. Deleting a trailing suffix can leave a valid prefix that passes without recomputing the chain; detecting that truncation requires comparison with a previously preserved external anchor.--emit-anchoremits an anchor for preservation, not an automatic comparison. The chain does not authenticate the log against a database owner who can rewrite it. Agent exclusion from the recorder is the boundary. On Linux the fs decision sensor watches every path-taking filesystem syscall the enforcement tiers can refuse — the open/create/delete/rename family (both ends of a rename), symlink and link (both ends), chown, chmod, the xattr calls, the stat family, timestamps and mknod — so an enforced filesystem denial produces a recorded decision; fd-relative operations on already-open descriptors (fchmod, ftruncate, f*xattr …) remain unwatched and the sensor's attach note discloses that scope.
The cage is a blast-radius reducer, not a magic wand: its value is bounded by how tight your manifest is, and a manifest that allowlists everything is close to no cage. The defaults are deliberately tight to keep the scary capabilities expensive to grant.
- Allowed-domain abuse. If you allow a host, the agent can reach all of
that host on the allowed methods/ports/paths. Method and path rules cut the
worst of it (registry presets are GET/HEAD-only, so
npm publish's PUT is denied — fixturev21-npm-publish-exfil), but an allowed host that offers an open write endpoint (e.g. gists on an allowedgithub.com— fixturev19-gist-relaydocuments this residual) is an exfiltration channel. Request-body size caps and the recorder's body-size logging make bulk uploads bounded and visible, not impossible. - In-project git hooks.
.git/hooksis inside your writable project; a payload can plant a hook that fires on your next commit outside the cage (fixturev09-git-hooks-poison). Presets mount it deny-write by default; opting out re-opens this. - UDP/QUIC passthrough. Denied by default (
v18-udp-quic-egress). If a manifest explicitly enables UDP passthrough to a host, that traffic gets no L7 inspection — it's an exfil channel to that host. - Attribution of filesystem telemetry is verified or
disclosed, never guaranteed. A multithreaded payload racing its own
anchor (
chdir, or a dirfd flip) cannot make the recorder file a confidently wrong verdict silently for the cwd class — those races are detected deterministically and the row is markedcwd-race-uncertain— and path-component rewrites (a symlink in the path repointed, or a plain directory exchanged for a symlink, by any process that can write a parent directory — nofs_structsharing needed, so absolute paths are exposed too; markedsymlink-race-uncertain) are caught by an identity witness re-checked once the caller's next syscall proves the raced one finished, so a rewrite anywhere in the kernel's resolution window is marked whatever its timing — plus a rebinding timeline: every watchedunlink/rmdir/rename/mkdir/symlinkis counted against its resolved name (both ends of a rename), so flips that restore the component's inode and target before the fence's re-stat — routine under a PACED writer, whose window spans many flips (QA finding G1 measured 3.75–11.75% wrong-and-silent on the identity witness alone there) — are still seen (measured with both mechanisms on the QA reproducer shape: 97–100% of rows marked, wrong-and-silent 0 across paced and unpaced 3×400 runs — measured, not guaranteed: the residuals are a rebinding by an unwatched mechanism such as a mount-table change, a syscall still in flight when its deferred row's age budget expires — rows are drained on age, never judged against arbitrarily later filesystem state, and a dead thread's rows fall back to the surviving process's root — and concurrently-pending rebindings of two or more mutator threads netting out to the sampled identity). Dirfd-anchored movement is only caught probabilistically per event (~one half at best; session-level warning on the first catch), and aCLONE_FS-without-CLONE_THREADsibling can still evade the topology gate. A payload can also deliberately make its own log vague by marking everything uncertain; that vagueness is surfaced as a degradation signal, which is itself worth alarming on. Enforcement is per-syscall and unaffected either way. - Filesystem telemetry records decisions, not outcomes. The decision
sensor sits on the syscall entry: it sees what the payload ASKED for and
what policy answered, never what the kernel returned. An allowed row
therefore means "policy allowed this path", and where the target was not
present in the caller's cage view when the decision was made the row is
marked policy-only —
replayprints it as a policy decision, and the summary counts it as neither a read nor a write, because nothing was read. A denial row is likewise a decision the payload was refused, not an observed failure. What no row can claim is the syscall's return value. - Escape-syscall denials are enforced but not recorded. The seccomp filter
answers in the kernel with nobody watching (
RET_ERRNO), so a refusedunshare,ptrace-attach,mknodor raw socket reaches the payload as EPERM and leaves no flight-recorder row; where the kernel acceptsSECCOMP_FILTER_FLAG_LOGit lands in the kernel audit log instead. Per-denial rows in clawcage's own log would need the filter rebuilt onSECCOMP_RET_USER_NOTIF, which cannot be layered on the enforcing filter (ERRNO outranks USER_NOTIF, so no notification is delivered).doctorsays this on theescape filterline. - Covert timing channels over allowed traffic: low-bandwidth, not blocked (deterministic capability control can't close them without breaking real work); auditable in the recorder.
- Kernel 0-days. clawcage assumes namespaces/seccomp/Landlock/Seatbelt hold. If the attacker has a sandbox-escape kernel exploit, no userspace policy layer is the last line of defense. Run truly untrusted code under a VM/gVisor as well.
- The operator. Whoever writes
cage.yamlis trusted. The cage protects you from the agent, not the world from you.
The threat model in full, including what each platform can and cannot enforce: SECURITY.md. To validate an install against a real agent on your own machine (CI only ever uses loopback fakes): docs/validation.md.
clawcage's own exit codes are reserved 120–124 so they never collide with the wrapped program's exit code (which passes through untouched; killed-by-signal reports as 128+N):
| Code | Meaning |
|---|---|
| 0 | the wrapped program exited 0 |
| 1–119, 125–255 | the wrapped program's own exit code (pass-through) |
| 120 | usage error, or the wrapped binary could not be executed |
| 121 | no sandbox backend available on this host |
| 122 | manifest invalid / refused to start unprotected (non-interactive first run) |
| 123 | wall-time limit exceeded (limits.wall_time or --wall-time) — cage killed |
| 124 | CI-strict deny (approval: enforce + a denied operation), or --strict-lint refusal (error/warning lint finding in the merged policy) |
| 128+N | the wrapped program was terminated by signal N |
| Doc | What it covers |
|---|---|
| docs/manifest.md | every manifest key, with examples |
| docs/policy-spec.md | exact policy semantics (globs, exec rules, baselines) |
| docs/denials.md | every denial reason code and its fix |
| docs/architecture.md | how the pieces fit together |
| docs/macos-install.md | macOS install specifics (quarantine, no-sudo) |
| docs/validation.md | validating an install against real agents |
| docs/runbooks/openchamber-opencode.md | runbook: OpenChamber-managed OpenCode under the cage (desktop-app random-port pitfall) |
make bench ships in the repo (bench/) and measures cold bring-up,
proxied-request overhead, and per-exec shim cost against an uncaged baseline
on your machine. Headline numbers are deliberately not printed here until they
are published from a pinned reference host — no "near-zero overhead" claims
without a benchmark you can rerun. The shape of the costs: one-time cage
bring-up per run (latency not yet measured here), a proxy hop with
TLS re-termination per connection, and a broker round-trip per argv-policied
exec.
- "An HTTP proxy?
curl --noproxyand raw sockets ignore it." The proxy is not an env var. On Linux the cage's netns has no route off-box except the proxy; raw-IP and raw-socket attempts fail closed (v15-rawsocket-egress,v16-hardip-connect). On macOS the Seatbelt profile denies network by default with kernel-inherited pinholes only to the proxy. - "MITM-ing TLS is gross and breaks pinning." Yes — per-install CA,
generated locally, never leaves the machine. Pinned/ECH connections that
refuse the CA fail closed (
v24-tls-pin-evade): denied, not silently passed. That's the deliberate trade: inspectability of allowed hosts over compatibility with pinning. An explicittls_passthroughopt-out tunnels without inspection — and without secret injection. - "The agent will just edit
cage.yaml." The live policy is loaded outside the cage before the agent starts; the in-cage copy is inert (v28-manifest-reload-toctou). Only operator-approved prompts write back. - "Exfiltrate through an allowed host." True, and documented as the biggest residual risk — see Honest limits. Method/path rules and body caps narrow the pipe; the recorder makes bulk uploads visible. We say this here, not in small print.
- "DNS exfiltration." The in-cage DNS answers only allowlisted names and
never forwards arbitrary labels upstream (
v17-dns-exfil); high-entropy or over-long labels under allowed wildcards are additionally refused (dns.exfil.*reason codes). - "Kernel 0-day and you're done." Correct; stated in Honest limits. clawcage is a policy layer over kernel sandboxing, not a hypervisor.
- "macOS Seatbelt is deprecated."
sandbox-exec's SBPL is undocumented-but-stable API used by Apple's own tooling; the same kernel MACF layer backs Safari's and Chrome's sandboxes. Its semantics here are validated by an executable probe suite on real Apple-silicon hardware (tools/macprobes/), and where the macOS backend differs from Linux, the guarantees table andclawcage doctorsay so per-guarantee rather than pretending parity. (See the macOS status note above the guarantees table for what is and is not in force on a real Apple-silicon run.) - "Why should I trust YOUR binary? This is a security tool." Checksums
on every release, reproducible
CGO_ENABLED=0 -trimpathbuilds you can rebuild and compare, ~15 direct dependencies all pinned ingo.sum, no telemetry, no network calls at startup, and the whole thing is readable Go. - "An LLM writes the policy — so the LLM is the security boundary." No: LLMs only draft manifests (you review the diff before anything is written) and explain denials. Enforcement never asks a model anything — it's a deterministic evaluator with stable reason codes, and an import-guard test keeps the LLM code unlinkable from enforcement.
- "A tight manifest will break my agent constantly → alert fatigue →
allow-always everything." Approval prompts are once-per-rule with
allow-always write-back, prompt floods are coalesced and capped
(fail-closed on overflow), and
clawcage learndrafts the manifest from an observed run so the starting policy matches reality. If you allowlist everything, you get no cage — also stated in Honest limits.
v1, pre-1.0. Policy engine, Linux backends (Landlock + namespaces + seccomp),
egress proxy with TLS interception and in-cage DNS, secret vault + brokering,
hash-chained flight recorder with replay/verify-log, approval UI,
first-run/init/learn/doctor/explain/policy commands, and an
adversarial corpus of 127 fixtures (attacks paired with the benign
counterpart each attack must not break; 24 of them form the macOS group, so
103 apply to Linux) are built and tested on Linux CI. On macOS the fixture
runner itself executes under a real Seatbelt cage (fixtures whose clauses need
the Linux syscall sensor skip with an explicit reason), but the macOS corpus
group has no disposable CI execution lane yet. Hosted macOS ARM64 and Intel
VMs run the standard unit/race jobs, and have run the separate integration
fixtures, but not the shipped macOS corpus (see testdata/evilskills/README.md
§How the corpus runs). The Linux corpus is executed,
not yet held: the adversarial lane drives every Linux-applicable fixture
through the real runner when that lane runs, with an anti-skip check that fails the
lane if fewer are loaded or executed than exist on disk — but 40 of those 103
(13 of them benign) do not currently hold and are listed, with the reason for
each, in
testdata/adversarial-known-failures.yaml.
The lane fails on any failure not in that ledger, and on any ledgered fixture
that starts passing, so the exemption cannot grow or rot in silence. All three
Linux containment tiers are proven there with the real binary on real
kernels: Landlock (ABI-6 x86_64 and ABI-7 arm64 landlock-e2e lanes,
anti-skip), namespaces (namespace-e2e, plus a namespace-restricted
lane proving the loud exit-121 refusal under Ubuntu 24.04's default
apparmor_restrict_unprivileged_userns=1), and cgroup v2 limits
(limits-e2e on a delegated systemd user scope). The macOS
Seatbelt backend is wired in and verified with the real binary on Apple
silicon (M4 Pro, macOS 26.5.1): caged runs start, doctor reports
backend seatbelt with a probe-backed per-guarantee matrix, and
kernel-enforced fs/exec/egress denials were observed. Not enforced on
macOS, and said so at run time: limits, per-tool-fs, the
escape-syscall filter (no seccomp equivalent), the limits.max_shm cap
(no cage-private /dev/shm), withholding host identity files (the
Seatbelt base profile grants /private/etc wholesale), and
login-keychain reachability; macOS filesystem telemetry is deny-side
only and best-effort (the Seatbelt violation-log monitor records blocked
reads/writes with their paths; no seccomp decision sensor, so allowed
accesses leave no per-file rows).
Versioning: pre-1.0, minor = features, patch = fixes — and any change that makes a previously-denied action allowed is at minimum a minor bump, called out in the changelog's Security section. See CHANGELOG.md.
Security reports: SECURITY.md. Contributions: CONTRIBUTING.md.
Apache-2.0 — see LICENSE.
