Give a coding agent permissions without handing over your keys
· 4 min read
A coding agent working on its own runs as your user: it reads ~/.ssh, ~/.aws, the .env and your
environment variables, writes anywhere in the repository and connects to any site. The risk is in the
times it gets something wrong or follows instructions it found in a file, an issue or a web page. The
configuration examples are from seisin and
tartaros, two tools of mine; the idea works with any
sandbox.
1. Where it writes
Each agent writes only in its own folder. In seisin you declare it in a file at the root of the repo, and anything not listed is denied:
[roles.frontend]
writes = ["src/web/**", "public/**"]
[roles.backend]
writes = ["src/api/**", "migrations/**"]
seisin run frontend -- claude -p "fix the contact form"
If the frontend agent tries to write in src/api/, the operating system refuses and seisin tells it whose
file that is.
2. Which credentials it sees
Outside the agent’s environment, one file per key, and each role names the ones it needs:
[keys]
dir = ".secrets"
[roles.frontend]
keys = ["deploy-token.txt"]
By default seisin lets the agent read everything else, including ~/.ssh and ~/.aws. To close them:
[runtime]
read = "territory"
3. Which domains it reaches
The model’s API, GitHub and one or two more are almost always enough:
[network]
allow = ["github.com", "*.github.com"]
[roles.backend]
network = ["api.stripe.com"]
A role’s list replaces the general one: the backend in this example only reaches api.stripe.com.
4. What it leaves for later
A git hook, a .claude/settings.json or a .mcp.json written inside the allowed folder runs later,
outside the sandbox. In my measurement of three sandboxes it was
the category with the most escapes: 37 of 79. tartaros keeps those files read-only at any depth,
including nested repositories:
tartaros run --write ./repo --read-deny ~/.ssh --read-deny ~/.aws \
--allow-domain api.anthropic.com --allow-domain github.com \
-- claude --dangerously-skip-permissions -p "fix the failing tests"
With a single agent, the Claude Code or Codex sandbox already covers writes and network; check points 2 and 4.
Try it
Ask the agent, inside the sandbox:
cat ~/.ssh/id_ed25519
curl https://example.com
echo 'echo hello' > .git/hooks/pre-commit
All three have to fail, and what it needs to work has to keep working. The sandbox lab has 196 contracts like these (as of 26 October 2026) to run against yours.
Related
- Three in four sandbox escapes I measured broke no configured rule sandbox-runtime, nono and Codex against 168 tests from their own projects' suites. Most escapes come from defaults.
- Agents that know whose file it is leave it alone, then patch around it What Claude Code, Codex and opencode do when the kernel denies a write to another role's file. With the bare denial, two of the three push back in every run. Knowing the owner beforehand, none tries, but two of the three still fix the bug in their own files. seisin's denial message was never shown.