Safebox
Unprivileged Linux sandbox and change management engine for autonomous AI coding agents.
Problem
Autonomous AI coding agents run unconfined on developer machines with full terminal access. A single hallucinated command can execute destructive deletions like rm -rf, leak credentials from ~/.ssh, or exfiltrate private source code across unrestricted outbound network sockets.
Built
I built Safebox to isolate untrusted agents at the Linux system call boundary without requiring root privileges, background daemons, or heavy virtual machines. By composing unprivileged user namespaces, ephemeral OverlayFS scratchpads, and in-kernel Landlock Mandatory Access Control, Safebox starts in under 30 milliseconds, traps file mutations in memory, and provides instant zero-cost rollback.
<30ms
Cold Start
0
Root Privileges
100%
LSM Enforced
0
Byte Disk Sprawl
Interactive System Exploration
namespaces > overlayfs > landlock lsm > userspace nat > pid 1 shimUser Namespaces
Maps caller identity to container root without host privileges
Effective UID
uid=0 (root)
Mapped via /proc/self/uid_map
Capabilities in Namespace
Full CapSet (64 caps)
Allows private mount/pivot
Host Escalation Risk
Zero Capability
Kernel blocks host VFS changes
// Write single-identity credential mapping
uidMap := fmt.Sprintf("0 %d 1\n", os.Getuid())
gidMap := fmt.Sprintf("0 %d 1\n", os.Getgid())
os.WriteFile("/proc/self/uid_map", []byte(uidMap), 0644)
os.WriteFile("/proc/self/gid_map", []byte(gidMap), 0644)0 CAP_SYS_ADMIN
Host Privileges
1 (Single ID)
UID Extent Size
Zero (/etc/subuid bypassed)
Subuid Dependency
1.2ms
Setup Latency
Safebox executes entirely in unprivileged userspace. By virtualizing process credentials through CLONE_NEWUSER and writing single-extent UID and GID mappings, the sandboxed process gains full administrative control inside its private sandbox boundary while remaining a standard unprivileged user on the host.
Safebox Simulation Engine
Safebox establishes rootless Linux namespaces, ephemeral OverlayFS, and Landlock LSM default-deny rules before handing off to the untrusted agent CLI.
Stack
3 techs · grouped by layerBackend
- Go(55% learning)
Infrastructure
- Linux(85% learning)
- Open Source
Also used