diff --git a/Sandboxes/Proxy-domains.mdx b/Sandboxes/Proxy-domains.mdx index 4295d70d..a5adf463 100644 --- a/Sandboxes/Proxy-domains.mdx +++ b/Sandboxes/Proxy-domains.mdx @@ -11,7 +11,7 @@ tag: "public preview" Domain filtering lets you control which external domains a sandbox can reach. You can define an allowlist (only listed domains are reachable) or a denylist (all domains except listed ones are reachable). Domain filtering and proxy routing are **independent configurations** — you do not need to duplicate domains across both. A domain can appear in the allowlist without having a proxy routing rule, and vice versa. - Domain filtering relies on the sandbox's tools and libraries respecting the standard proxy environment variables (`HTTP_PROXY`, `HTTPS_PROXY`). Traffic from tools that ignore these variables will not be filtered. Routing-level enforcement is planned for a future release. + Domain filtering relies on the sandbox's tools and libraries respecting the standard proxy environment variables (`HTTP_PROXY`, `HTTPS_PROXY`). Traffic from tools that ignore proxy environment variables will not be filtered unless [domain filter enforcement](#domain-filter-enforcement) is enabled. ## Allowlist @@ -79,7 +79,45 @@ await SandboxInstance.create({ - When both `allowedDomains` and `forbiddenDomains` are set, `forbiddenDomains` takes precedence: a domain that appears in both lists will be blocked. + When both `allowedDomains` and `forbiddenDomains` are set, `allowedDomains` takes precedence: a domain that appears in both lists will be allowed. + + +## Domain filter enforcement + +By default, domain filtering depends on the sandbox's tools respecting `HTTP_PROXY` and `HTTPS_PROXY`. To enforce filtering even for tools that bypass those variables, add a `firewall` config with `rulesets: ["proxy"]`. This forces all outbound traffic to flow through the proxy at the network level. + + + +```typescript TypeScript +await SandboxInstance.createIfNotExists({ + name: "enforced-sandbox", + image: "blaxel/base-image:latest", + region: "us-was-1", + network: { + firewall: { rulesets: ["proxy"] }, + allowedDomains: ["httpbin.org"], + proxy: { routing: [] }, + }, +}); +``` + +```python Python +await SandboxInstance.create_if_not_exists({ + "name": "enforced-sandbox", + "image": "blaxel/base-image:latest", + "region": "us-was-1", + "network": { + "firewall": {"rulesets": ["proxy"]}, + "allowedDomains": ["httpbin.org"], + "proxy": {"routing": []}, + }, +}) +``` + + + + + Currently, this feature is not enforced automatically by the platform when a proxy is configured. In a future release, it will be automatically enforced whenever a proxy is configured. ## Firewall + proxy combined diff --git a/Sandboxes/Proxy.mdx b/Sandboxes/Proxy.mdx index b19e2867..1b270c06 100644 --- a/Sandboxes/Proxy.mdx +++ b/Sandboxes/Proxy.mdx @@ -92,9 +92,16 @@ sandbox = await SandboxInstance.create({ | Field | Type | Description | |---|---|---| | `allowedDomains` | `string[]` / `list[str]` | Allowlist — only these domains are reachable. Supports wildcards (`*.s3.amazonaws.com`). | -| `forbiddenDomains` | `string[]` / `list[str]` | Denylist — all domains except these are reachable. Supports wildcards. If both are set, `forbiddenDomains` takes precedence. | +| `forbiddenDomains` | `string[]` / `list[str]` | Denylist — all domains except these are reachable. Supports wildcards. If both are set, `allowedDomains` takes precedence. | +| `firewall` | `FirewallConfig` | Proxy firewall configuration. | | `proxy` | `ProxyConfig` | Proxy routing and bypass configuration. | +### `FirewallConfig` + +| Field | Type | Description | +|---|---|---| +| `rulesets` | `string[]` / `list[str]` | Domain filtering rules to apply. Set to `["proxy"]` to force all sandbox outbound traffic through the Blaxel proxy. | + ### `ProxyConfig` | Field | Type | Description | diff --git a/changelog.mdx b/changelog.mdx index 523d7b84..63f3d892 100644 --- a/changelog.mdx +++ b/changelog.mdx @@ -17,6 +17,14 @@ The SDKs can now clear a sandbox's expiration rules without recreating it. Pass +### Proxy-based firewall support + +Sandboxes can now enforce domain filtering at the network level. + + + + + ### Refreshed Billing Explorer experience