sandbox-forge
Skill0 starsChanged 30 days agoApache-2.0View on GitHub
Run untrusted or experimental code in a locked-down Podman or Docker container: no network, no capabilities, read-only root, CPU/memory caps, 60s TTL, auto-prune. Use when asked to sandbox, isolate, or safely execute code or reproduce a bug.
- Reads credentials
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- archieSkill
- deep-research-firecrawlSkill
- lfmSkill
- redteamSkill
- revert-forgeSkill
- rust-forgeSkill
- selinaSkill
- ui-forgeSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Every sandboxed container MUST follow these strict security constraints:
- Very specific: line 20
Privileged Mode Disabled: Never run Docker with --privileged.
- Very specific: line 23
Host mounts restricted: Never mount the host root directory (/ or C:\) or sensitive configuration directories (/etc, ~/.ssh).
- Distinctive: line 33
Every spawned container must have a defined TTL (Time-To-Live).
- Distinctive: line 41
When generating sandbox runs:
- Very specific: line 72
Delete the script immediately after execution, including on failure: rm -f -- "sandbox_temp/${SCRIPT:?}" (:?
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Sandbox Forge
Goal
Scaffold and run untrusted code inside highly restricted Docker containers or virtual sandboxes. Ensure complete isolation of the host from any malicious command execution, network access, or resource exhaustion.
Sandbox Security Policies (CWE-250)
Every sandboxed container MUST follow these strict security constraints:
- Privileged Mode Disabled: Never run Docker with
--privileged. Drop all capabilities (--cap-drop=ALL). - Network Disabled: By default, isolate from the network (
--network none). Only enable if explicitly requested and approved by the user. - Read-Only Root File System: Mount the container root file system as read-only (
--read-only), except for designated temporary write volumes (e.g./tmpusing tmpfs:--tmpfs /tmp:rw,noexec,nosuid,size=64m). - Host mounts restricted: Never mount the host root directory (
/orC:\) or sensitive configuration directories (/etc,~/.ssh). Only mount the narrowest workspace directories needed, explicitly using read-only flags (:ro) if execution does not require writing.
Resource Limits & Pruning (CWE-400)
- CPU/Memory Limits:
- Limit CPU shares (
--cpus="1.0"or--cpu-shares=1024). - Limit memory (
-m 512mor--memory-swap 512m).
- Limit CPU shares (
- JobManager Container TTL & Auto-Pruning:
- Every spawned container must have a defined TTL (Time-To-Live). Default maximum execution time is 60 seconds.
- Enforce TTL with in-container
timeout -s KILL 60plus a host watchdogkill(see template). ⊥ rely on killing therunclient. - Label every sandbox container (
--label sandbox-forge=1) and prune only those ($RT container prune -f --filter "label=sandbox-forge=1" --filter "until=5m") on startup or shutdown of any sandboxed task. ⊥ unscoped prune — it deletes the user's unrelated stopped containers.
Invocation & Script Generation
When generating sandbox runs:
- Pick a unique name, then write the untrusted script to
sandbox_temp/$SCRIPT. Never reuse a filename across runs: podman on macOS caches a deleted path as missing for a few seconds, so a re-createdtest_script.pyis invisible to the next container. - Run it with the template below. It enforces the 60s TTL twice:
timeoutinside the container, and a host-side watchdog that kills the container if the inner timeout is missing or bypassed. Killing only therunclient is NOT enough — the container keeps running — so the template runs detached, names the container, and always removes it.RT=${RT:-$(command -v podman >/dev/null 2>&1 && echo podman || echo docker)} NAME="sandbox-forge-$(date +%s)-$$" SCRIPT="$NAME.py" # write the untrusted code to sandbox_temp/$SCRIPT trap '$RT rm -f "$NAME" >/dev/null 2>&1' EXIT $RT run -d --name "$NAME" \ --label sandbox-forge=1 \ --network none \ --cap-drop=ALL \ --security-opt no-new-privileges \ --read-only \ --tmpfs /tmp:rw,noexec,nosuid,size=64m \ --pids-limit 128 \ -m 512m --memory-swap 512m \ --cpus="1.0" \ -v "$(pwd)/sandbox_temp:/app:ro" \ -w /app \ python:3.11-slim \ timeout -s KILL 60 python "$SCRIPT" >/dev/null ( sleep 65; $RT kill "$NAME" ) >/dev/null 2>&1 & # host watchdog WATCHDOG=$! EXIT_CODE=$($RT wait "$NAME") pkill -P "$WATCHDOG" 2>/dev/null; kill "$WATCHDOG" 2>/dev/null # kill the sleep too, or callers block 65s OUTPUT=$($RT logs "$NAME" 2>&1 | tail -c 20000) - Interpret
EXIT_CODE:0success;137killed (TTL or OOM — check$RT inspect -f '{{.State.OOMKilled}}' "$NAME"before the trap removes it); anything else = script failure. Return exit code, OOM/timeout flag, andOUTPUTas structured feedback. - Delete the script immediately after execution, including on failure:
rm -f -- "sandbox_temp/${SCRIPT:?}"(:?aborts if the variable is empty).
Boundaries
- ⊥
--privileged, ⊥ host root or~/.ssh//etcmounts. - Network off by default; enable only on explicit user approval.
- ⊥ persist data outside sandbox without user approval.
- ∀ container → TTL + cleanup, even on failure.
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.

