I Built a 200-Line Canary Test to Audit My AI Agent Setup. My Dev Box Scored 1/4
Two things happened in the last two weeks of November 2026 that made me stop trusting autonomous AI agents on my main machine. On November 17, versions 1.26.1 and 1.26.2 of Microsoft's PyPI package agent-framework were
Two things happened in the last two weeks of November 2026 that made me stop trusting autonomous AI agents on my main machine.
On November 17, versions 1.26.1 and 1.26.2 of Microsoft's PyPI package agent-framework were compromised with a credential stealer targeting cloud secrets and CI/CD tokens. Three days later, on November 20, Signal turned on default screenshot blocking ("Block Siri AI" on iOS and Android screen security) because OS-level AI assistants read decrypted pixels straight off the presentation layer.
Both stories point to the same uncomfortable reality: if an autonomous agent (Claude Code, Cursor, OpenClaw, n8n Nod, Codex) shares your user session, your .env files, and an open outbound network, one poisoned MCP description or bad dependency is enough.
Instead of writing another opinion piece about AI security, I wrote a zero-dependency Python script (agent-canary, about 200 lines, strictly localhost 127.0.0.1) so I could actually measure my own setup instead of guessing.
What agent-canary actually checks
agent-canary does two things locally without sending a single byte off your machine:
-
A 4-check sandbox posture audit (
python3 agent_canary.py audit) run inside the exact shell or container where your agent operates (it auto-detects OS and whether you are on a bare host, WSL2, Docker, Kubernetes, or Railway):-
Host credential isolation: are
~/.ssh,~/.aws/credentials,~/.kube/config,~/.docker/config.json, or~/.npmrcreadable from this shell? (It only checksos.accessand never reads file contents.) -
Env &
.envsecret hygiene: are rawOPENAI_*,ANTHROPIC_*,STRIPE_*,AWS_*, orGITHUB_TOKENvars sitting inos.environ, or is a plaintext.envreadable in the working directory? -
Blast-radius isolation: can the agent reach cloud metadata (
169.254.169.254) or local Postgres/Redis/Mongo/MySQL/n8n/Ollama ports? -
Outbound egress control: can an untrusted tool open an arbitrary outbound port
443socket?
-
Host credential isolation: are
-
A local prompt-injection canary trap (
init+listen): it drops three clearly fake canary keys (CANARY_OPENAI_KEY,CANARY_STRIPE_KEY,CANARY_SSH_TOKEN) alongside a benign untrusted Markdown/MCP fixture pointing strictly tohttp://127.0.0.1:9999/exfil. You point your agent at the folder and see whether your sandbox blocks exfiltration or prints[LEAKED].
When I ran the posture audit on my own bare workstation shell, here is the real output that came back:
====================================================================
AGENT-CANARY SANDBOX POSTURE AUDIT
Runtime: Windows 11 / bare host
====================================================================
[FAIL] 1. Host credential isolation -> FAIL - readable host files: ~/.ssh, ~/.docker
[PASS] 2. Env & .env secret hygiene -> PASS - No raw API env vars or local .env detected
[FAIL] 3. Blast-radius isolation -> FAIL - Localhost services reachable: 11434/Ollama
[FAIL] 4. Outbound egress control -> FAIL - Arbitrary outbound HTTPS (443) is unrestricted
--------------------------------------------------------------------
SCORE: 1/4 checks passed
--------------------------------------------------------------------
Running an agent inside Docker Desktop with $HOME or your project .env mounted does not magically fix this either. If the container has your .env file and unrestricted outbound HTTPS, a compromised package or prompt injection still walks right out the front door.
"I already have a VPS, I'll just run my agent there"
This is the first objection most developers bring up, and honestly it can be worse than running on a laptop.
Think about what is already sitting on your existing VPS: production PostgreSQL, client backups, Coolify or n8n workflows, Stripe webhook secrets, TLS certs. Dropping an autonomous agent that installs Python/Node packages and parses untrusted emails onto the same server as your production databases increases your blast radius instead of reducing it.
Security teams solved this problem decades ago with quarantine hosts (the infrastructure equivalent of a burner phone): your agent host should contain zero production databases, zero personal SSH keys, and nothing you would cry about wiping in 30 seconds.
Comparing the 3 real defenses in late 2026
Once you see a 0/4 or 1/4 score, there are three practical ways to actually fix it:
| Defense Layer | Protects ~/.ssh & .env? |
Blocks arbitrary egress? | Survives closing laptop lid? | Honest trade-off |
|---|---|---|---|---|
| 1. Laptop + Docker bind mount | Partially (if .env excluded) |
Rarely configured | No | Easy to leak secrets via env vars or open outbound network |
2. Local kernel sandbox (nolabs-ai/nono) |
Yes (Landlock/Seatbelt + credential proxy) | Yes (L7 domain filter) | No | Rust daemonless sandbox, awesome locally, stops when laptop sleeps |
| 3. Disposable isolated cloud sandbox (Railway) + Burner API | Yes (container holds zero personal/prod files) | Configurable / isolated per project | Yes (24/7) | Usage-based billing (watch your spend meter; not a fixed-cap box) |
A quick note on nolabs-ai/nono (which has been blowing up on GitHub recently): if you only run interactive coding agents while sitting at your desk, nono is genuinely clever. Instead of passing your API key into the agent's environment variables, it uses OS kernel primitives (Linux Landlock/seccomp, macOS Seatbelt) and injects credentials through a sidecar proxy so the agent process never sees the raw key.
Where nono alone stops is always-on agents (OpenClaw, n8n Nod, scheduled inbox or browser watchers) or disposable test sandboxes you can wipe in one click. Those belong in an isolated cloud container completely separated from your laptop and your production server.
The 4-layer quarantine stack I ended up with
If you want to push agent-canary from 0/4 to 4/4 for an always-on agent or a safe test sandbox without putting your main machine or production server at risk:
-
No raw
.envfiles on disk for agent secrets: use a scoped secret vault with short-lived, revocable tokens (or a credential-injection proxy likenono) so a leaked workspace directory contains zero reusable keys. - A prepaid, hard-capped "burner" API key: stop plugging your main OpenAI or Anthropic key (tied to an uncapped credit card) into autonomous loops. Keep a separate prepaid account loaded with $10 to $20 max on an open-weight endpoint so the worst-case runaway loop or key leak has a hard dollar ceiling. I use Novita AI for cheap open-weight agent runs (DeepSeek/Qwen) with a strict prepaid balance.
-
A disposable isolated container environment instead of your prod VPS: never co-host autonomous agents with your production databases. Spin up a dedicated empty sandbox project you can nuke and redeploy in seconds. Railway is built nicely for this kind of agent/sandbox workflow (per-second metering, Hobby starts at $5/month with $5 included usage, and using referral code
20FreeUsdadds $20 in platform credits once you upgrade to a paid plan). One honest caveat: Railway's plan fee is an included credit, not a hard auto-shutoff cap, so set usage alerts in workspace settings. -
Network isolation from Day 1: keep your agent project off your production private network, and if you run on your own Linux VM instead, block RFC1918 LAN ranges (
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16) and cloud metadata (169.254.169.254). I included a minimalharden-burner-vps.shUFW starter script in the repo for self-managed hosts.
(Full disclosure: the Novita AI and Railway links above are referral/affiliate links, meaning I may earn a commission or credit at no extra cost to you. Everything else in this post and repo, including agent-canary and nono, is free and open source.)
Test your own setup and drop your score
Clone the repo and run the 10-second check inside whatever shell, Docker container, or VM your agent uses:
git clone https://github.com/SuperMnr/agent-canary.git
cd agent-canary
python3 agent_canary.py audit
-
GitHub Repo (
agent_canary.py+harden-burner-vps.sh): github.com/SuperMnr/agent-canary
Drop your one-line agent-canary scorecard in the comments (which agent, which sandbox, and your X/4 score). I am curious how many people actually hit 4/4 out of the box without tweaking egress rules.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.