Skip to main content
Network limits control where a sandbox connects. Its outbound policy is an egress mode with optional CIDR and domain allowlists, set by network on the create. PUT /sandbox/{id}/network replaces the policy while the sandbox runs or is paused.
Request

Egress Modes

The sandbox has no IPv6. DNS resolves public names only. The platform deny set applies under every mode, above allow_out. It covers 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, 100.64.0.0/10, and the host’s public address. TCP port 25 is blocked to every destination under every mode. The sandbox’s resolver sits inside the deny set and answers DNS on port 53 only, so an allow_out entry for it is refused. See Isolation.

Allowlist Entries

allow_out holds up to 256 entries, CIDRs and domains together. It is accepted only under allowlist, and refused under the other modes with 422 allow_out_not_allowed. An entry that overlaps the deny set is refused with 422 cidr_not_allowed, and 0.0.0.0/0 is refused. An IPv6 CIDR is refused with 400, because the sandbox has no IPv6. A malformed entry is refused with 400, pointing at /network/allow_out/<index> on a create and /allow_out/<index> on a PUT. Duplicate entries are dropped. Internationalized names are given in punycode.

Domain Matching

A domain entry matches the TLS server name of an HTTPS connection, or the Host header of a plain HTTP request. The platform resolves the allowed name itself and connects to that address, never to the address the sandbox dialed. A forged server name therefore reaches only an address the allowed name resolves to. Matching applies to the first name on a connection. The rest of the connection passes through unchanged. Several sites behind one shared address remain reachable through a connection opened to an allowed name. Under allowlist, the following are refused to every destination outside the CIDR entries.
  • QUIC and every UDP port except DNS
  • Every TCP port except 80 and 443, which reach a domain entry’s name only
Under an allowlist with domain entries, a refused TCP connection to port 80 or 443 is accepted and then closed, so it may appear open for a moment from inside the sandbox.

Changing the Policy

PUT /sandbox/{id}/network replaces egress and allow_out on a running or paused sandbox. egress is required. rules may be omitted. When present, it must equal the sandbox’s current rules, or the request is refused with 422 rules_immutable.
Request
The response is 202 for a running sandbox, which shows the previous policy until the host applies the new one, and 200 for a paused sandbox. blocked on a sandbox with rules is refused with 422 rules_not_allowed. On a sandbox without rules, blocked with rules in the body is refused with 422 rules_immutable. A request during a pause or a snapshot is refused with 409 operation_in_progress. The new policy applies to every flow the sandbox already opened, not only new ones. A connection the new policy refuses stops carrying data in both directions, and the sandbox’s socket sees no close, so the connection stalls. No restart is needed, and a later PUT with public restores reach.

Outbound Address

Outbound traffic leaves from the host’s public address. The address is shared with other sandboxes on the host and is not fixed.