How the egress allow-list reads
A sandbox’s egress settings hold two lists, allow and deny. Each entry is one of these:
*: anywhere public;- a domain,
pypi.org: that name; - its subdomains,
*.github.com: names at any depth below it, notgithub.comitself; - an IP or a CIDR,
203.0.113.7or203.0.113.0/24: those addresses, dialed by address.
Any entry takes a port: github.com:22. A domain in allow without one means ports 80 and 443; an IP, a CIDR or * without one means every port. deny holds exceptions to allow, written the same way, and wins. The two lists hold up to 100 entries together. An empty allow lets nothing out, and the default is allow: ["*"].
A change applies at once, with no restart, and closes the open connections it no longer allows.
How it is enforced
Only TCP and DNS leave a sandbox: no UDP, so no QUIC or HTTP/3, and no ping. Every TCP connection goes through its server’s egress proxy, and every DNS question to the sandbox’s own resolver.
- DNS answers only allowed names. The resolver asks upstream only for a name that a domain entry (or
*) allows, and answers REFUSED for any other without asking further, so no data leaves in DNS questions. - The proxy dials, not the sandbox. It reads the name a TLS client sends or an HTTP request’s Host, judges it by the list, resolves the name itself and dials that address, never the one the sandbox chose.
- Plain HTTP is judged request by request. A request for another host than the one its connection was judged on is answered 421, and the client opens a new connection, judged by that host.
- Other protocols need a port. SSH, and anything else that is neither TLS nor HTTP, passes only to a domain entry that names the port, as
github.com:22does. - A refusal says why. An HTTP or TLS client gets a 403 that names the host and what refused it; anything else is reset.
Always refused, whatever the list says: private, link-local and CGNAT ranges, the server itself, port 25, and HTTP/2 without TLS.
from pethost.sandboxes import Egress, SandboxSettings, Sandboxes
sandboxes = Sandboxes() # reads PETHOST_TOKEN
allow = ["pypi.org", "files.pythonhosted.org", "github.com", "*.github.com"]
sandbox = sandboxes.create_sandbox(settings=SandboxSettings(egress=Egress(allow=allow)))
print(sandboxes.run_command(sandbox.sandbox_id, command="curl -sI https://pypi.org/simple/ | head -1").stdout)
# HTTP/2 200
print(sandboxes.run_command(sandbox.sandbox_id, command="curl -sS https://example.com").stderr)
# curl: (6) Could not resolve host: example.com
# git over SSH as well, at once, in the running sandbox
sandboxes.update_sandbox(sandbox.sandbox_id, settings=SandboxSettings(egress=Egress(allow=allow + ["github.com:22"])))pethost sandbox new --name builder --allow pypi.org --allow files.pythonhosted.org --allow github.com --allow '*.github.com'
pethost sandbox set builder --allow pypi.org --allow github.com --allow github.com:22 # replaces the listWhat a domain entry trusts
TLS is judged on the name the client sends, then passes unread. So a domain entry trusts whatever is served at that name’s addresses: a CDN’s other sites, or a client that hides the name it asks for. A fence that must hold there names IPs, or binds a secret to the host, whose TLS the server then terminates to judge each request.
Bounds and records
Each sandbox opens 200 new connections a second after a burst of 1,000, holds 1,024 open through the proxy, and asks 200 DNS questions a second. Every host it reached or tried, allowed or not, is in its events a minute at a time, with its connections and bytes each way, so you can write a list from what a sandbox really used. The secrets and egress guide has every rule.
How it compares
On 21 November 2026, boat.dev had no egress control: “boat has no API setting for network rules.” E2B allowed and denied IPs, CIDRs and domains. Daytona restricted network access on its first two tiers, with no way to change it there, and let you set it from tier 3, which a $500 top-up unlocks. Modal’s control by CIDR and domain was in beta, for TLS on port 443. On Pethost the list is in every plan and the trial, and costs nothing.