sandboxing
Skill0 starsChanged 4 days agoMITView on GitHub
Use when running a nested agent CLI (opencode, codex, another model), a test harness or an untrusted-but-cooperative script on Linux that must not see your environment variables, API keys, other processes or files outside its own folder, or must not damage files it wasn't given - "run it so it can't read my keys", "keep the tested model away from my home folder", bubblewrap/bwrap.
- Reads credentials
- Deletes or force-pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- martinholovsky/claude-skills-generatortheir own version, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- martinholovsky/claude-skills-generator★ 48same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- capturing-tk-screenshots-headlessSkill
- concept-parableSkill
- decisionsSkill
- provider-onboardingSkill
- pygameturboSkill
- skillspector-installSkill
- thonny-pluginSkill
- timestampSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
No shell for the tested model: when narrow tools will do (a read-only docs tool, a fixed command).
- Very specific: line 23
Keep real keys outside: Use an egress proxy that injects credentials, or a key file read only by the caller.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sandboxing
Not for hostile code. This keeps a cooperative program (a nested agent, a
test harness) from wandering: reading your keys or files by accident, sending
them to an inference provider, or rm -rf-ing the wrong folder. Code that is
trying to escape needs stronger isolation: see
references/limits.md.
Cheapest protection first
- No shell for the tested model when narrow tools will do (a read-only docs tool, a fixed command). Nothing to sandbox.
- Keep real keys outside. Use an egress proxy that injects credentials,
or a key file read only by the caller; inside, set placeholder keys
(
--setenv OPENROUTER_API_KEY=placeholder). - Then the sandbox for whatever still runs commands.
Quick start
python3 scripts/leak_test.py # once per machine: must print PASS
python3 scripts/sandbox.py --check # what a sandboxed command sees
python3 scripts/sandbox.py --work /tmp/run1 --ro /opt/node \
--setenv OPENROUTER_API_KEY=placeholder -- CMD [ARGS...]scripts/ is relative to this skill's folder. Exit status is the command's
(a signal gives 128+N; under timeout, 124). sandbox.py's own errors (bad
option, preflight, missing tool) exit 125, as env and timeout do, with a
sandbox.py: error: line on stderr saying what to fix; check that line when
the command itself might exit 125. --show prints the full bwrap command
without running it.
Inside, the command sees: an empty environment plus HOME=/work, PATH,
LANG, TMPDIR=/tmp, the caller's proxy variables and the CA variables;
uid 1000; read-only /usr, /etc/ssl; private /proc, /dev and /tmp;
/work (writable) and only the binds you add.
| Option | Effect |
--work DIR | writable folder at /work (also HOME and the cwd); default: a new private (mode 700) folder in /tmp, removed afterwards unless --keep |
--cwd DIR | working directory inside, relative to /work (e.g. --cwd proj); must exist |
--ro SRC[:DEST], --rw SRC[:DEST] | read-only / writable bind (repeatable); SRC/bin of a --ro bind goes on PATH |
--setenv NAME=VALUE, --pass-env NAME | set a variable inside; copy one of yours in (readable inside: never a real key) |
--no-net | no network; default is shared network with your proxy variables and a CA copy at /ca.crt |
--mem MB, --nproc N, --cpu SEC | limits (prlimit); --mem caps address space, not memory use |
--user NAME | host user when started as root (default sandboxer, created if missing) |
Gotchas
- Started as root, bwrap runs as the
sandboxerhost user (setpriv), and--workis chowned to it. Every bind source must be readable by that user: a root-only parent (an agent's scratch folder) fails preflight with the folder's name. Copy the data under/tmp(chmod -R a+rX) instead. A--rwsource must also be writable by it (preflight says so otherwise); files made there belong tosandboxeron the host. --memand Node.js:--memlimits virtual address space, and V8 reserves a lot of it at startup, so Node (and opencode's runtime) dies below about 768 MB ("Failed to reserve virtual memory", exit 133/134) while using far less. Use--mem 1024or more for Node-based commands; sandbox.py warns.- Runtimes outside
/usr(Node.js under/opt, a venv): bind the runtime's folder with--ro; itsbin/is then onPATH. HOME=/work: config goes in/work/.config/...; put it in the work folder before the run./tmpis private and gone after the run: write results to/workand read them from outside.- Refused binds: your home,
/root,~/.ssh,~/.aws,~/.config/gh,~/.claude,~/.codex,~/.local/share/opencode, or a folder holding them. Bind a narrower folder (--allow-sensitiveoverrides; don't). - Proxy URL with
user:password@is refused, since it would be readable inside (--allow-proxy-credentialsoverrides). - No
/etc/passwd:whoamifails and git needsuser.name/user.emailset./etc/hostsis a minimal one (localhostonly, not the host's file, which may name internal hosts);--ro /etc/hostsbinds yours instead. - Everything you bind or pass in is readable by the command: that is the boundary.
Read when needed
- references/nested-agents.md: running opencode (or any agent CLI) inside, with placeholder keys and JSON output.
- references/limits.md: threat model, what this does not protect, stronger tools.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

