Kagex/Guides
FirewallSecurity & Zero-Trust · 5 min read

Default-Deny Allowlist Egress Firewall & DNS Rebinding Defense

Packages and approved APIs pass through cleanly while internal company networks, localhost services, CGNAT, and untrusted webhooks fail closed.

Always denied
127.0.0.0/8 · RFC1918 · 169.254.0.0/16 · 100.64.0.0/10
Policy modes
allowlist (default) · none · full · @presets
SNI check
Host + SNI + resolved IP verification
Manage allowlists during setup and execution
# Inspect or test egress rules live:
sandboxctl net status "$ID"
sandboxctl net allow "$ID" pypi.org files.pythonhosted.org

# Setup dependencies openly during bootstrap, then auto-lockdown:
sandboxctl mcp install cursor --setup "pip install -r requirements.txt" --project .

Key Engineering Points · Ghost Secrets Vault & Zero-Leak Proxy

All 10 key points →
  • 1Real API tokens and credentials stay encrypted/stored solely on the host with 0600 permissions under daemon data roots.
  • 2Sandboxes receive only synthetic harmless placeholder tokens formatted as sbxph_<name>_<hex>.
  • 3Outbound HTTPS requests targeting approved secret hosts terminate TLS cleanly at a per-daemon ECDSA P-256 local CA proxy.
  • 4Host egress proxy swaps real credentials in transit strictly when both host allowlist and secret destination rules match.
  • 5Echoed secrets inside upstream HTTP response bodies or debug headers are redacted automatically back into placeholders via scrubReader.
  • 6Cleartext HTTP requests attempting to carry secret placeholders are dropped immediately before touching the wire.

Stopping SSRF & DNS Rebinding Before Connect

internal/network/dns intercepts lookups and discards any A/AAAA record resolving to loopback, private LAN, link-local metadata, or CGNAT ranges. Even wildcard DNS tricks pointing to 127.0.0.1 or 10.0.0.0/8 cannot slip through.

Setup Phase vs Strict Runtime Phase

Use --setup for package fetches that touch diverse CDNs once per fresh template, then let Kagex transition automatically into minimal allowlist enforcement.

Inspect this architecture live in 3D

Step through MCP ingress, Ghost Secrets, CoW blades, and run sandboxctl commands interactively in your browser.

Frequently Asked Questions

No. Loopback (127.0.0.0/8) and host LAN interfaces are unconditionally blocked from inside microVMs.