Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/sandbox/internet-access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
const sandbox = await Sandbox.create({ allowInternetAccess: true })

// Create sandbox without internet access
const isolatedSandbox = await Sandbox.create({ allowInternetAccess: false })

Check warning on line 19 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L19

Did you really mean 'isolatedSandbox'?
```
```python Python
from e2b import Sandbox
Expand Down Expand Up @@ -47,7 +47,7 @@
```js JavaScript & TypeScript
import { Sandbox, ALL_TRAFFIC } from 'e2b'

// Deny all traffic except specific IPs

Check warning on line 50 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L50

Did you really mean 'IPs'?
const sandbox = await Sandbox.create({
network: {
denyOut: [ALL_TRAFFIC],
Expand All @@ -55,8 +55,8 @@
}
})

// Deny specific IPs only

Check warning on line 58 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L58

Did you really mean 'IPs'?
const restrictedSandbox = await Sandbox.create({

Check warning on line 59 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L59

Did you really mean 'restrictedSandbox'?
network: {
denyOut: ['8.8.8.8']
}
Expand Down Expand Up @@ -84,7 +84,7 @@

### Domain-based filtering

You can allow traffic to specific domains by specifying hostnames in `allow out`. When using domain-based filtering, you must include `ALL_TRAFFIC` in `deny out` to block all other traffic. Domains are not supported in the `deny out` list.

Check warning on line 87 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L87

Did you really mean 'hostnames'?

<CodeGroup>
```js JavaScript & TypeScript
Expand Down Expand Up @@ -112,7 +112,7 @@
</CodeGroup>

<Note>
When any domain is used, the default nameserver `8.8.8.8` is automatically allowed to ensure proper DNS resolution.

Check warning on line 115 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L115

Did you really mean 'nameserver'?
</Note>

You can also use wildcards to allow all subdomains of a domain:
Expand Down Expand Up @@ -148,10 +148,10 @@
```js JavaScript & TypeScript
import { Sandbox, ALL_TRAFFIC } from 'e2b'

// Allow traffic to specific domains and IPs

Check warning on line 151 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L151

Did you really mean 'IPs'?
const sandbox = await Sandbox.create({
network: {
allowOut: ['api.example.com', '*.github.com', '8.8.8.8'],

Check warning on line 154 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L154

Did you really mean 'allowOut'?
denyOut: [ALL_TRAFFIC]
}
})
Expand All @@ -173,6 +173,16 @@
Domain-based filtering only works for HTTP traffic on port 80 (via Host header inspection) and TLS traffic on port 443 (via SNI inspection). Traffic on other ports uses CIDR-based filtering only. UDP-based protocols like QUIC/HTTP3 are not supported for domain filtering.
</Note>

<Warning>
**Blocked connections may appear successful from inside the sandbox.**

For TCP traffic, the firewall has to accept the connection on the sandbox-side proxy first and then use a syscall to retrieve the original destination IP before it can decide whether the destination is allowed. This means that, from inside the sandbox, a TCP connection (e.g. a `connect()` call or a check like `bash -c '</dev/tcp/host/port'`) can succeed and report the socket as open even when the destination is denied by your `denyOut` rules — no packets actually reach the destination.

Check warning on line 179 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L179

Did you really mean 'syscall'?

To verify that traffic is reaching its destination, check for an application-level response (e.g. an HTTP status code, a TLS handshake, or expected protocol bytes) rather than relying on the TCP connection succeeding.

This is a limitation of how outbound traffic is currently routed from the sandbox to our firewall and may change in the future.
</Warning>

### Priority rules

When both `allow out` and `deny out` are specified, **allow rules always take precedence** over deny rules. This means if an IP address is in both lists, it will be allowed.
Expand Down Expand Up @@ -303,10 +313,10 @@
```js JavaScript & TypeScript
import { Sandbox } from 'e2b'

// Block all egress except an explicit allowlist

Check warning on line 316 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L316

Did you really mean 'allowlist'?
await Sandbox.create({
network: {
denyOut: ({ allTraffic }) => [allTraffic], // allTraffic === '0.0.0.0/0'

Check warning on line 319 in docs/sandbox/internet-access.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/internet-access.mdx#L319

Did you really mean 'allTraffic'?
allowOut: ['1.1.1.1', '8.8.8.0/24'],
},
})
Expand Down