Dev.to Security 🔐 Cybersecurity 👁 0 📖 1 min read

EgressGuard - default-deny egress proxy for AI agents and MCP servers

I built EgressGuard because an AI agent that can run code can also send your data or your API keys anywhere. It's a self-hosted proxy that sits between an untrusted sandbox and the internet. Demo (30s): https://e-z.tool

I built EgressGuard because an AI agent that can run code can also send your data or your API keys anywhere. It's a self-hosted proxy that sits between an untrusted sandbox and the internet.

Demo (30s): https://e-z.tools/s30kvnry.gif

How it works:

  • Per-agent allowlist: exact + wildcard domains, ports, methods. CONNECT with MITM so the policy sees the request.
  • Credential brokering: the sandbox only holds EGRESS_PHC_ placeholders. The real secret is substituted at egress, and only for one exact binding (agent + host + path + method). Off-binding gives a 403 and no substitution.
  • Anti-SSRF: literal IPs refused, private/loopback/link-local/CGNAT ranges filtered, redirects and not followed.
  • Hot reload (SIGHUP, file watch, admin API) with validate-then-swap.
  • Embedded dashboard, CSV/JSON export, and exfiltration heuristics (burst, large upload, upload ratio, suspicious destination).

What CI checks end-to-end (9 verdicts, compose job): 403 with no rule, 200 on an allowed destination, 403 for a placeholder sent off-binding, 401 on a bound host with a fake secret substituted, CA key unreadable from the sandbox, admin unreachable from the sandbox, direct egress blocked, Host/Origin guard, CSV consistent with verdicts.

Limits, up front: v0.1, not audited, not for production. No response-body DLP or redaction, the sandbox token can be spoofed from the inside (per-sandbox mTLS is on the backlog), the audit is in memory, and it is single-node.

Similar ideas exist (OneCLI, Infisical Agent Vault, nilbox). What I tried to do differently is bind each secret to a single destination and show the proof in the audit log.

I'd most like feedback on the threat model: what bypasses am i missing?

https://github.com/6etu/egressGuard

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.