How to run OpenClaw in a locked down Docker sandbox, allow safe model access, and avoid common credential and supply chain traps.
Published: 2026-02-03
URL: https://sumantthakur.substack.com/p/dont-give-openclaw-your-keys-secure
OpenClaw is the clearest signal yet that AI agents have crossed a line. They no longer just generate text. They execute actions. That shift breaks several assumptions most teams still rely on. This post explains why that matters, how the threat model changes, and how to experiment safely using a locked down Docker sandbox.
The week OpenClaw changed the conversation OpenClaw went from an interesting open source project to a global talking point almost overnight. Developers liked it because it does things instead of just suggesting them. Security teams reacted because those things include running shell commands, touching files, and calling APIs with real credentials.
This is not hype for the sake of hype. It is a capability shift. Most AI tools until now lived safely in the suggestion layer. OpenClaw lives in the execution layer. That difference is why this moment feels explosive.
Why this is not just another AI tool OpenClaw breaks three assumptions that quietly underpin modern software operations. Humans are always the safety boundary Third party code is limited to libraries, not autonomous actors Network access and credentials are static configuration problems When you introduce an agent that can plan and act, all three assumptions fail at once. Callout The dangerous part of agents is not that they think.
It is that they are allowed to do. Thanks for reading Autonomous AI Architect! Subscribe for free to receive new posts and support my work. The theory that actually matters To reason about OpenClaw and similar systems, separate them into two layers. Layer 1: reasoning and planning This is the LLM side.
It produces plans, steps, and intentions. This layer can hallucinate or make mistakes, but on its own it cannot harm your system. Layer 2: actuation and execution This is the runtime. It executes commands, reads files, installs skills, and makes network calls.
This layer mutates state. Traditional AI safety focuses on Layer 1. Real world damage happens in Layer 2. Once an agent has execution authority, your attack surface includes: the skill ecosystem configuration files that contain secrets runtime permissions and Linux capabilities outbound network access If agents can talk to other agents or external services, the blast radius grows even faster.
A realistic threat model If an agent has file, shell, or network access, an attacker who influences prompts, skills, or configs can: exfiltrate credentials run arbitrary commands pivot into cloud accounts install persistent backdoors via skills Assume compromise and design for containment.
The containment principles that actually work Before touching code, internalize these rules. Principle 1: Least privilege If the agent does not need shell access, do not give it shell access. Principle 2: Network off by default No internet unless explicitly required. No exceptions. Principle 3: Immutable runtime Read only root filesystem. Writable paths must be explicit and minimal. Principle 4: Skills are code Every skill is executable code. Treat it like a binary from the internet. Principle 5: Ephemeral secrets Short lived tokens only.
Rotate aggressively. These are not theoretical. They come directly from early security failures observed in the ecosystem. A safe OpenClaw Docker sandbox you can run today This demo lets you explore OpenClaw without exposing your machine or credentials. Files you will create Dockerfile config/config.json Dockerfile Save as Dockerfile. FROM node:25-alpine RUN addgroup -S claw && adduser -S -G claw -u 1000 claw RUN npm install -g openclaw@latest WORKDIR /home/claw USER claw EXPOSE 18789 CMD ["openclaw", "gateway", "--port", "18789", "--verbose"] Build the image. docker build -t openclaw-sandbox:latest .
Minimal config with no secrets Create config/config.json. { "model": { "type": "none", "description": "offline demo no external LLM" }, "channels": [], "skills": [] } Callout Do not place real API keys in this file. Treat it as public. Run OpenClaw in a locked down container mkdir -p config docker run --rm -it \ --name openclaw-sandbox \ --user 1000:1000 \ --cap-drop=ALL \ --security-opt=no-new-privileges \ --pids-limit=100 \ --memory=512m \ --cpus=0.5 \ --read-only \ --tmpfs /tmp:rw,size=64m \ -v "$(pwd)/config/config.json":/home/claw/.config/openclaw/config.json:ro \ --network none \ openclaw-sandbox:latest Why these flags matter --cap-drop=ALL removes Linux capabilities --security-opt=no-new-privileges blocks privilege escalation --read-only limits filesystem damage --network none prevents data exfiltration --tmpfs /tmp provides a small writable runtime space If OpenClaw needs a writable directory, mount only that path as tmpfs.
Allowing controlled network access When you want to connect to an LLM, do not open the internet. Use a forward proxy with a strict allowlist. Create a user network docker network create openclaw-net Run a proxy with an allowlist docker run -d \ --name openclaw-proxy \ --network openclaw-net \ -e PROXYALLOWLIST="api.your-llm.example.com" \ your-proxy-image Run the agent through the proxy docker run --rm -it \ --name openclaw-sandbox-controlled \ --user 1000:1000 \ --cap-drop=ALL \ --security-opt=no-new-privileges \ --pids-limit=300 \ --memory=1g \ --cpus=1 \ --read-only \ --tmpfs /tmp:rw,size=128m \ -v "$(pwd)/config/config.json":/home/claw/.config/openclaw/config.json:ro \ --network openclaw-net \ -e HTTPPROXY="http://openclaw-proxy:3128" \ -e HTTPS_PROXY="http://openclaw-proxy:3128" \ openclaw-sandbox:latest Callout The proxy is now your only egress point.
Anything not allowlisted is blocked by default. Tests that prove your sandbox is working Try these before doing anything serious. With network disabled, ask the agent to fetch a URL. It should fail. Ask it to read a file you did not mount.
It should fail. Install a skill that writes to .ssh. It should fail. With the proxy enabled, try a non allowlisted domain. It should fail. If any test succeeds unexpectedly, stop and fix the sandbox. Why the ecosystem is the real risk OpenClaw is open, extensible, and easy to extend.
That combination is powerful and dangerous. Public skill registries lower friction for innovation and for malware. This is not new. We have seen the same pattern with npm, PyPI, and browser extensions. Callout An agent ecosystem is a package ecosystem with a much larger blast radius. Incident response, compressed If something goes wrong: Revoke and rotate all exposed credentials Preserve container logs Scan repos and CI artifacts for leaked secrets Isolate the host Treat it as a security incident, not a bug Early incidents already show credential theft and malicious skills in the wild.
Share Autonomous AI Architect Final take OpenClaw proves that agentic assistants are real and useful right now. The question is no longer whether they work. The question is whether your operational and security model is ready for software that acts autonomously. Run agents like they are already dangerous. Because they are.