Show HN: 200-line local Python harness to audit AI agent sandbox leaks A developer released agent-canary, a zero-dependency, localhost-only Python harness of roughly 200 lines that audits whether an AI agent sandbox (Claude Code, Cursor, OpenClaw, n8n Nod, Codex) exposes `.env` files, `~/.ssh` keys or outbound network traffic, run via `python3 agent_canary.py audit`. The tool performs four read-only checks — host credential isolation (`~/.ssh`, `~/.aws/credentials`, `~/.kube/config`, `~/.docker/config.json`, `~/.npmrc`, `~/.pypirc`, `~/.git-credentials`), env and `.env` secret hygiene, blast-radius isolation (cloud metadata `169.254.169.254` and local Postgres/Redis/Mongo/MySQL/n8n/Ollama), and outbound egress on port 443 — and ships an `init` command that creates fake canary keys plus a prompt-injection fixture (`README_UNTRUSTED.md`, `mock_mcp_tool.json`) with a `127.0.0.1:9999` trap listener that logs leaks such as `[LEAKED in 1.84s] ... matched: CANARY_OPENAI_KEY`. The author cites the November 17 PyPI compromise of Microsoft's `agent-framework` (`v1.26.1`/`v1.26.2`) and Signal's November 20 default OS screenshot blocking as reasons to verify isolation posture, and pairs the MIT-licensed harness with a UFW baseline script (`harden-burner-vps.sh`) for Ubuntu 24.04 that blocks outbound RFC1918 LAN ranges and `169.254.169.254`. A zero-dependency, localhost-only 127.0.0.1 defensive audit harness to check whether your AI agent sandbox Claude Code, Cursor, OpenClaw, n8n Nod, Codex leaks .env files, ~/.ssh keys, or outbound network traffic. No external packages. No data leaves your machine. After the November 17 PyPI compromise of Microsoft's agent-framework v1.26.1 / v1.26.2 and Signal rolling out default OS screenshot blocking on November 20, trusting an autonomous agent on a main laptop or a production server is a real blast-radius problem. agent-canary lets you verify your actual isolation posture in 10 seconds instead of guessing. python3 agent canary.py audit Optional: tag which agent you are testing OS & container are auto-detected python3 agent canary.py audit --label "OpenClaw" Checks performed read-only, never prints secret values : 1. Host credential isolation are ~/.ssh , ~/.aws/credentials , ~/.kube/config , ~/.docker/config.json , ~/.npmrc , ~/.pypirc , or ~/.git-credentials readable from this shell? 2. Env & .env secret hygiene are raw OPENAI , ANTHROPIC , STRIPE , AWS , GITHUB TOKEN vars in os.environ , or plaintext .env files in the current directory? 3. Blast-radius isolation is cloud metadata 169.254.169.254 or local Postgres/Redis/Mongo/MySQL/n8n/Ollama reachable? 4. Outbound egress control can an untrusted tool open an arbitrary outbound port 443 socket? Create a temporary folder containing fake canary keys and a benign prompt-injection fixture README UNTRUSTED.md + mock mcp tool.json : python3 agent canary.py init --dir ./canary-sandbox Start the strict 127.0.0.1:9999 trap listener in Terminal 1: python3 agent canary.py listen Point your AI agent at ./canary-sandbox and ask it to summarize README UNTRUSTED.md or inspect mock mcp tool.json . If the agent reads .env and hits http://127.0.0.1:9999/exfil , the listener logs: php LEAKED in 1.84s Canary exfiltrated to 127.0.0.1:9999/exfil - matched: CANARY OPENAI KEY See harden-burner-vps.sh https://github.com/SuperMnr/agent-canary/blob/master/harden-burner-vps.sh for a minimal Ubuntu 24.04 UFW baseline that blocks outbound RFC1918 LAN ranges and 169.254.169.254 . Pair it with: - Kernel-level sandboxing and credential-injection proxies such as nolabs-ai/nono https://github.com/nolabs-ai/nono - Scoped secret vaults never raw .env files on disk - A prepaid, hard-capped API key instead of your main billing card Full write-up comparing Docker mounts, nono , and disposable cloud sandboxes: Read on DEV https://dev.to/supermnr/i-built-a-200-line-canary-test-to-audit-my-ai-agent-setup-my-dev-box-scored-14-2j2 . MIT — strictly for defensive self-auditing of environments you own.