quiet robotBook a call

Sandboxes

Outbound network

Deny, allowlist or open, with allow and block rules by domain, IP address or CIDR range. How a sandbox's internet access is set, changed and enforced.

View as Markdown

Sandboxes is in early access. It is free to try, some parts are still in testing, and details may change. Sign up free

Each sandbox has an egress mode:

ModeThe sandbox can reach
denyNothing on the internet. The default.
allowlistOnly what allow lists.
openAny public address. Needs the Team plan.

Private networks, the host and other sandboxes are blocked in every mode.

JSON
{ "egress": { "mode": "allowlist", "allow": ["pypi.org", "files.pythonhosted.org", "*.githubusercontent.com"] } }
  • *.example.com matches every subdomain of example.com, not example.com itself. List both if you need both.
  • If you send allowlist with no allow, your organization's default list is used. New organizations start with pypi.org, files.pythonhosted.org and registry.npmjs.org. Change defaults under Policy in the dashboard.

Allow and block rules

allow and deny each take up to 200 rules. A rule is a domain, an IP address or a CIDR range, with an optional port:

RuleMeans
pypi.orgThat domain
*.github.comAny name under github.com
203.0.113.7One address
198.51.100.0/24A range
[2001:db8::/32]An IPv6 range (brackets let you add a port)
db.example.com:5432One port
203.0.113.0/24:8000-8100A port range
example.com:*Every port
  • An allow rule with no port means ports 80 and 443. A block rule with no port means every port.
  • Blocked always wins over allowed.
  • deny works in allowlist and open mode. For example, open internet except a few domains and ranges:
JSON
{ "egress": { "mode": "open", "deny": ["*.tracker.example", "198.51.100.0/24"] } }
  • Private ranges can't be allowed. A rule that isn't valid is refused with a message saying why, so nothing is dropped silently.

Change rules while a sandbox runs

PUT /sandboxes/{id}/egress with any of mode, allow and deny (fields you leave out stay as they are). New connections follow the new rules at once. A paused sandbox wakes first. You can do the same on the sandbox's page in the dashboard.

JSON
{ "mode": "allowlist", "allow": ["pypi.org", "203.0.113.0/24"], "deny": ["203.0.113.66"] }

A sandbox can't be switched wider than the maxMode it started with. By default that is what its first rules needed, so a deny sandbox stays closed. To keep the option of opening it later, start it with egress.maxMode:

JSON
{ "egress": { "mode": "deny", "maxMode": "open" } }

Allowing a port other than 80 or 443 needs maxMode: "open". Asking for more than maxMode allows answers 409 egress_too_wide.

Every change is written to the audit log as sandbox.egress, with the rules before and after.

How it's enforced

The rules are enforced inside the VM, by a firewall and a proxy that the sandbox's own code can't change. Commands don't run as root, and changing rules needs your API key, which a sandbox never holds.

  • Domains are checked by a proxy inside the VM (the HTTPS CONNECT host, or the HTTP Host header). HTTP clients use it on their own (HTTP_PROXY and HTTPS_PROXY are set). Tools that ignore proxy settings don't leak; their connections fail.
  • Addresses and ranges are also written into the firewall, so any program can reach an allowed address directly, and nothing can reach a blocked one. For a database or another non-HTTP service, allow its address or range.
  • A domain that resolves to an address in a blocked range is blocked too.
  • In open mode, blocking a domain sends web traffic (ports 80 and 443) through the proxy so it can be checked. To block a domain on other ports, block its address or range.
  • UDP other than DNS is blocked.

Blocked attempts are written to the audit log, with the domain or address.

Data sent out

Outbound data is counted per sandbox. The first 5 GB a month are free, then $0.05 per GB.