Set a network policy
Replace what a sandbox may connect to: everything, nothing, a list of domains and IP ranges, or the policy of its environment. Same as boat network set.
Authorizations
Path Parameters
Body
What the sandbox may connect to. Send mode, inbound or both: at least one. The side that the request does not name stays as it is. A sandbox that sets one side has its own policy and no longer follows its environment; mode: environment makes it follow again. On create, omitted means the policy of its environment; with from, the policy that the saved snapshot's sandbox had. On fork, omitted means what the source sandbox has. An API key without the network.write action always gets the policy that the sandbox would have without this field, a tighter one included: any other value is refused with 403 api_key_action_forbidden. A bad policy is refused with 400 invalid_network_policy. When no host can enforce a policy now, create and fork answer 409 network_policy_unsupported. A CI runner is always open and follows no environment.
open: no limit. deny: the sandbox opens no connection. allow: it connects only to the entries of allow. environment: no policy of its own; the sandbox follows the policy of its environment (open when the environment sets none). This is the default on create. In an organization environment that sets a policy, only owners and admins can give a sandbox another policy: members get 403 network_policy_managed.
open, deny, allow, environment With mode allow, 1 to 100 entries; empty or omitted with any other mode. Each entry is a domain (github.com), a wildcard (*.github.com, which covers the domain itself and every subdomain), a public IP address or a public CIDR range. No scheme, port or path. A domain entry allows TCP 443 (matched by TLS SNI) and TCP 80 (matched by HTTP Host). An IP or CIDR entry allows every protocol and port.
100Who can connect to the sandbox. open: anyone on the internet, on the ports that the sandbox opens. boat-only: only boat. The host drops every other connection to the sandbox, so code inside cannot make a port public. SSH, editors, port forwards, the desktop and raw ports stop: their routes answer 403 inbound_closed. A caller outside the sandbox (a session, or an API key that does not live in a sandbox) can still publish a port with POST /sandboxes/{id}/host. Commands and files through the API keep working. Omitted on PUT: the sandbox keeps what it has. Omitted on create or fork: what the sandbox inherits, else open. A change of inbound is a change of the policy: the same rules on keys and on organization environments apply.
open, boat-only Response
Enforced now, or saved on a stopped sandbox and applied before its next start (status is then pending).