ai-container
Hardened Alpine sandboxes for AI coding agents
Running autonomous coding agents locally introduces filesystem and loopback risk, yet enabling unprivileged user namespaces weakens the attack surface reductions of linux-hardened. ai-container solves both by using rootful Podman with explicit subordinate UID/GID isolation and a dedicated loopback-free pasta network stack.
How it's built
- Kernel & User Mapping
- Preserves linux-hardened sysctl posture (
kernel.unprivileged_userns_clone=0) while confining container UID 0 to unprivileged host subuid/subgid slices. - Controlled Invocation
- Hardened
aibox-runwrapper validates project working directories and target UIDs before mounting only the designated workspace into an Alpine sandbox. - Network Namespace
- Uses
pastauser-mode networking configured to strip access to host loopback services and LAN ranges unless explicitly bridged.
What it does
- Zero unprivileged user namespaces required on linux-hardened
- Fixed aibox-run helper with strict uid/cwd sanitization
- Isolated pasta network namespace with no host loopback access
Decisions
- Backed toolchains on a shared 16 GB ext4 image so ephemeral agent sandboxes start instantly without bloated container layer copies.
- Chose Alpine Linux inside the guest to minimize CVE surface area and shell footprint.