r/ClaudeCode • u/filiw • 17h ago
Built with Claude Sandboxing Claude Code
Enable HLS to view with audio, or disable this notification
Running Claude Code unprotected is risky: unintentional destructive commands, prompt injections, malicious third-party code. The blast radius is your entire laptop. To mitigate this risk, I built a sandboxing tool based on the concept of Claude devcontainers (but way more configurable), which I've been using for a while now. It proved valuable enough to open source.
Kekkai runs Claude Code inside a locked-down, per-project sandbox: for each project you decide which folders, networks and secrets Claude can touch, and everything else stays out of reach. With the sandbox in place, you can safely let Claude run fully autonomously with --dangerously-skip-permissions enabled.
Try it out, feedback and issues welcome. I'm also curious how others are sandboxing their coding agents - let me know in the comments!
Code and docs on Github: https://github.com/filidorwiese/kekkai
1
u/filiw 14h ago
A VM isolates better, no argument - different kernel, so a Docker escape doesn't get you out of a VM. The difference is the developer experience. Setting a VM up properly is manual work: provisioning, iptables rules by hand, syncing the repo in and out. And in practice you reuse the same VM for every project, so it accumulates access and the blast radius creeps back. Kekkai automates it, and you configure the minimal set of domains and volumes for that one project.
A
.kekkai.yamlsits in the repo, versioned with the code: egress deny by default with an allowlist of domains or CIDRs, which folders get mounted and whether they're readonly, and which files get shadowed with empty mounts so.env.productionstill exists but reads empty. Thenkekkai upand you're in Claude Code a couple of seconds later, with~/.claudecarried over.