Case study · Open source
secure-agent-workspace
Let Claude Code work on its own, without giving it your passwords or your machine.
§01 The problem
Fast agents need access. Access is the risk.
AI coding agents are fastest when they run without asking permission for every command. But then whatever they run, and any prompt injection that steers them, can use your shell, your SSH keys, your cloud credentials and your database passwords. Most teams either keep clicking “allow” all day or give the agent far more access than it needs.
§02 What it does
Autonomy inside, credentials outside.
- 01
An isolated container per project.
Claude Code runs without permission prompts inside a rootless Podman container with no Linux capabilities. Your home folder, keys and other projects are not in it.
- 02
No credentials inside.
Databases and AWS are reached through secure-executor, a separate container that holds the credentials. The agent asks it to run an operation; it never sees a password or a key.
- 03
Writes wait for you.
Reads are answered at once. A database change, an AWS call or a Terraform apply is prepared by the agent and runs only after you approve it from your own terminal, which the agent cannot reach.
- 04
Internet through an allowlist.
The container reaches the internet only through a proxy that allows the domains you list.
- 05
Testing without Docker.
Throwaway databases and services next to the workspace, declared in the project's manifest, and container images built on your machine from a git commit you review.
§03 How it works
Two exits, both guarded.
ws is a single Go binary. It creates, per project, a workspace container on an internal Podman network. That network has two exits: an egress proxy with a domain allowlist, and the socket of secure-executor, which keeps the credentials, checks every request against a per-agent policy, answers reads and queues writes for approval. The human approves from the host with ws approve, on a channel the agent has no access to. Every action is audited.
§04 My role and the stack
Designed and built end to end.
I designed and built the project end to end: the security model, the executor, the ws launcher, the container images, the installer and release pipeline, and the documentation. The work was AI-assisted: I made the design decisions and reviewed the changes, with Claude (Anthropic's AI) as a pair programmer.
Stack
Numbers (as of v0.4.0-rc5)
- ~64,000
- lines of Go (without vendored dependencies)
- 770
- automated tests
- 4
- container images, published on ghcr.io and pinned by digest in every binary
- 31
wscommands; connectors for PostgreSQL, Oracle (read-only), AWS and Brevo
Binaries for Linux, macOS and Windows (amd64/arm64); tested on Linux.
§05 Install
Three commands after the download.
Requirements Linux (amd64) with Podman 4 or later working rootless. On Ubuntu, 24.04 or later (22.04 ships Podman 3.4, which does not work). Arch, Manjaro and Fedora ship a recent Podman.
# Ubuntu 24.04 only: install Podman
sudo apt install -y podman crun uidmap git curl
# Install ws (checks the download against the release's SHA256SUMS)
curl -fsSL https://github.com/PySlim/secure-agent-workspace/releases/download/v0.4.0-rc5/install.sh | WS_VERSION=0.4.0-rc5 sh
ws doctor # checks Podman, user ids, disk… and says how to fix what is missing
ws init # a few questions, then it downloads the public images
ws start # starts the executor and the egress proxy
Claude Code itself is not shipped: the first time you open a project, ws installs it from npm and you log in with your own Claude account.
§06 Use it
Register, work, approve.
A project is registered once from a clone of its repository. After that, the agent works inside its workspace and you approve its writes from your own terminal.
# 1. Register a project, from a clone of its repository
cd ~/src/my-app
ws manifest init # writes .claude-ws.yaml (repos, domains, test services…)
ws project add --file .claude-ws.yaml # creates the project's workspace
# 2. Work with Claude Code inside it
ws claude my-app
# 3. Approve the agent's writes from your own terminal
ws pending # what the agent prepared
ws approve ID # run it (or: ws reject ID)
# Everyday helpers
ws status # projects, containers, pending approvals
ws domain add api.example.com # allow one more domain for the agent
ws cp my-app --from /workspace/report.pdf ~/Downloads # copy a file out of the workspace
ws upgrade # update ws and its images
Test services, declared in .claude-ws.yaml:
services:
db:
image: postgres:16
env: { POSTGRES_PASSWORD: test }
The agent reaches it as db:5432. It runs on the project's own internal network.
§07 Engineering highlights
For the technical reader.
Defense in depth, not trust:
rootless Podman with a remapped user namespace, all capabilities dropped,
no-new-privileges, a read-only root filesystem, internal networks and a domain allowlist.Credentials never cross into the agent's container.
The executor identifies callers by socket and applies a per-agent, per-connection policy; production connections cannot be written to.
Human-in-the-loop by design:
writes are prepared, shown in full (the exact SQL or API call) and run only after approval on a separate channel; uncertain outcomes are reconciled and audited.
Safe image builds:
images are built from a git commit (
git archive), extracted with path-traversal protection, reviewed by the human before building, and run as an unprivileged user.Supply chain:
release images pinned by digest in the binaries, checksummed downloads, reproducible packages, secret scanning and vulnerability checks in CI.
Open-sourced with care:
published from a clean, single-commit history after automated scans for secrets and private data, with a license audit and third-party notices.
§08 Limitations
What it is not, yet.
- Prerelease: not audited by a third party and not production-ready. Use test databases and accounts.
- Tested on Linux amd64; macOS and Windows builds exist but are untested.
- Human approval is only a barrier if the agent cannot become root on the host: run it as designed.
§09 Links
Read the code, try it, contribute.
- Repository on GitHub (opens GitHub)
- Release v0.4.0-rc5 (opens GitHub)
- Good first issues (opens GitHub)
- Discussions (opens GitHub)
- Changelog (opens GitHub)
- Security policy (opens GitHub)
- License (Apache-2.0) (opens GitHub)
secure-agent-workspace is an independent open-source project. It is not affiliated with or endorsed by Anthropic. Claude and Claude Code are Anthropic's products; Claude Code is installed by each user from npm and its use is subject to Anthropic's terms.