Network
Control a sandbox's outbound access with the E2B SDK's allowInternetAccess and network create options, and change it later with sandbox.updateNetwork(). The gateway turns these settings into a Kibotos network policyThe rules that decide where a Workspace's outbound traffic may go: its mode, destination rules, and any Egress or Resolver it references. A new Workspace has no network access by default., and can send the sandbox's outbound TCP through your own SOCKS5 proxy.
Supported endpoints and options
| Request | In the JS SDK |
|---|---|
allow_internet_access in create requests | allowInternetAccess create option |
allowOut and denyOut, with addresses and CIDRs | network.allowOut and network.denyOut create options |
egressProxy | network.egressProxy create option |
PUT /sandboxes/{id}/network with any of the fields above | sandbox.updateNetwork() |
For inbound access to application ports, see Application ports.
Outbound policy
The following create options deny all outbound traffic except to one range:
const sandbox = await Sandbox.create('kibotos-minimal', {
...connectionOptions,
allowInternetAccess: false,
network: { allowOut: ['140.82.112.0/20'] },
});connectionOptions stands for apiKey, domain, and the other connection options in the example on E2B compatibility.
How requests map to the policy
The gateway translates each request into a policy mode and destination rules:
| Request | Kibotos network policy |
|---|---|
Denies all IPv4, without allowOut | DENY_ALL |
Denies all IPv4, with allowOut | PUBLIC_INTERNET; deny is denyOut plus 0.0.0.0/0 and ::/0, and allow is allowOut |
| Any other request | PUBLIC_INTERNET; allowOut and denyOut become allow and deny unchanged |
Denies all IPv4 means allow_internet_access: false, or denyOut containing 0.0.0.0/0 (ALL_TRAFFIC in the SDK). E2B sandboxes have IPv4-only outbound access, so on E2B this denies all outbound traffic. On Kibotos, the gateway therefore denies IPv6 as well.
For evaluation order and address family rules, see Network policy in the native API.
Entries
Entries are written as in E2B:
- Each item is one address or CIDR.
denyOutdoes not accept domain names. - Of the unspecified addresses, only
0.0.0.0/0is accepted;::/0returns 400. - A CIDR with host bits set takes effect as its network address, while
getInfo()still echoes it as written. - The two lists together hold at most 256 items, including the
::/0the gateway adds. More returns 400. - Private and special-purpose addresses cannot be opened, even in
allowOut. Rejected connections fail immediately instead of waiting for a timeout.
Domain names and domain patterns in allowOut return 501 with the capability name network egress allowlist domains. As in E2B, a domain name without ALL_TRAFFIC returns 400 first. rules returns 501. Both are listed in Not supported.
DNS
With allowOut or denyOut, DNS queries from the sandbox still work. The guest sends queries only to the node's link DNS address, and the node forwards them to the deployment's DNS servers. Neither list affects this.
On E2B, DNS is also denied in this case, unless allowOut includes the resolver.
Changing the network
As in E2B, a change replaces the whole outbound configuration, and fields you leave out are cleared.
Important
A change without allow_internet_access counts as not denying, as in E2B. A change with only denyOut reopens public internet access that was previously closed. To keep it closed, include allow_internet_access: false or ALL_TRAFFIC in every change.
- An empty change request clears all entries and opens public internet access.
- The gateway returns 204 after confirming that the new policy is in effect on the node, waiting at most 30 seconds.
- On timeout, the gateway returns 500 and states that the change may have been accepted.
- Concurrent changes return 409.
- Changing the network does not extend the sandbox's lifetime and does not change its tokens.
Egress proxy
egressProxy makes the sandbox's outbound TCP leave through your own SOCKS5 proxy. The gateway saves the proxy as an EgressAn outbound SOCKS5 proxy that the caller runs. When a Workspace's network policy references it, TCP connections to the given ranges leave from the caller's network. and references it in the network policy for the destination ranges 0.0.0.0/0 and ::/0. For what an Egress is and how to manage it, see Egress.
The following create options send outbound TCP through a proxy with password authentication:
const sandbox = await Sandbox.create('kibotos-minimal', {
...connectionOptions,
network: {
egressProxy: {
address: 'proxy.example.com:1080',
username: 'sandbox',
password: process.env.PROXY_PASSWORD,
},
},
});To change the proxy later, call sandbox.updateNetwork({ egressProxy }) with the full proxy settings.
Proxy fields
| Field | Rules |
|---|---|
address | Required, host:port, where host is a host name or IP. An address in a private or special-purpose range, or a host name that resolves into one, returns 400 |
username, password | Optional, at most 255 bytes each, authenticated per RFC 1929. Giving only password returns 400; giving only username returns 501 with the capability name network egress proxy username without a password |
- In SDK 2.46.1,
egressProxyhas only these three fields and no TLS settings. The gateway connects to the proxy without TLS. - Any other key in
egressProxyreturns 400.
Traffic through the proxy
- What is forwarded:
denyOutis evaluated first, and denied connections never reach the proxy. All other new TCP connections go through the proxy, with no blocking of private addresses, so addresses in the proxy's own network are reachable too. - Traffic that bypasses the proxy: DNS queries still go to the node's link DNS address, and the node forwards them to the deployment's DNS servers without the proxy. Other UDP is not allowed under
PUBLIC_INTERNETin the first place, so it does not go through the proxy either. Pings to proxied destinations are denied. - When the proxy is unavailable: connections fail outright and do not fall back to going direct.
- Denying all outbound traffic while setting a proxy: the policy cannot be
DENY_ALL, so the gateway usesPUBLIC_INTERNETwithdenyset to0.0.0.0/0and::/0. All connections are still denied, and only DNS queries work.
Changing or removing the proxy
- A change with
egressProxyupdates this sandbox's Egress in place, and must include the password every time. If the sandbox had no proxy, a new Egress is created. - An in-place update does not change the policy's revision. The gateway returns 204 only after the Egress's new revision is in effect on the node.
- A change without
egressProxyremoves the proxy. The gateway first removes the reference, confirms that the change is in effect, and then deletes the Egress. - If another client changes the policy to reference a different Egress, the gateway only removes the reference, and neither modifies nor deletes that Egress.
Egress cleanup
- After a sandbox is deleted, the gateway deletes its Egress.
- Egresses of sandboxes deleted on expiration, and Egresses left behind when the gateway fails midway, are deleted by a cleanup that each gateway instance runs every 5 minutes.
- Egresses created less than 10 minutes ago are excluded from cleanup.
Fields returned by queries
GET /sandboxes/{id} and the list endpoint return the network configuration actually in effect. In the SDK, read these fields with getInfo(); see Sandboxes and lifecycle.
| Field | Echo rules |
|---|---|
allowInternetAccess | The current desired policy. It is echoed only if the create request explicitly included this field, or the network was later changed successfully. The JS SDK always sends this field at creation (default true); when you call REST directly and omit the field, it is not echoed |
network.allowOut, network.denyOut | The original values from the most recent request that set the outbound network policy; not echoed when there are no entries. If the policy was later changed outside the gateway, the entries of the native policy are echoed |
network.egressProxy | The address and username of the Egress the policy references, read from the Egress. Not echoed when there is no proxy |
Passwords are write-only: network.egressProxy in getInfo() and the list endpoint never includes the password.
Notes
- Destination rules need ctrl support. If ctrl does not advertise
workspace.network_policy.destination_rules, requests with entries return 501 with the capability namenetwork egress allow and deny lists, instead of falling back to the on/off switch only. - The proxy needs Egress support in ctrl. If ctrl does not advertise
workspace.network_policy.egress.socks5, requests withegressProxyreturn 501 with the capability namenetwork egress proxy, instead of falling back to going direct.
Next steps
- Application ports: reach HTTP and WebSocket services in a sandbox.
- Network policy: how the native policy evaluates a destination.
- Egress: manage caller-owned proxies with
kiboor the native API.
Commands and files
The E2B SDK's sandbox.commands.* and sandbox.files.* calls work on Kibotos sandboxes as they do on E2B. This page covers the supported process and file endpoints, which user a request runs as, how paths resolve, and how process streams and directory watches behave.
Volumes
A Volume keeps a sandbox's data across pauses and after the sandbox is deleted. This page covers creating Volumes by name, mounting one in a sandbox, deleting it, and what queries return.