Default behavior
By default, sandboxes have unrestricted outbound internet access. Any domain or IP is reachable.Block all outbound traffic
ALL_TRAFFIC is a constant equal to "0.0.0.0/0". Adding it to deny_out blocks everything.
- Python
- TypeScript
Domain allowlist
Allow only specific domains and block everything else.- Python
- TypeScript
Wildcard domain matching
Use*. prefix to match all subdomains.
When domain filtering is enabled, DNS queries to
8.8.8.8 are automatically allowed so that domain resolution works. You do not need to add it manually.IP and CIDR rules
Use IP addresses or CIDR ranges directly when you know the destination IPs.Combined domains and IPs
Domain and IP rules can be mixed in the sameallow_out list.
Priority rules
Allow rules always take precedence over deny rules, regardless of order.
- If the destination matches any
allow_outentry, the connection is permitted. - If the destination matches any
deny_outentry, the connection is rejected. - If no rule matches, the connection is permitted by default (unless
deny_out=[ALL_TRAFFIC]).
SandboxNetworkOpts model
| Field | Type | Description |
|---|---|---|
allow_out | list[str] | Domains, IPs, or CIDRs to allow |
deny_out | list[str] | Domains, IPs, or CIDRs to deny; use ALL_TRAFFIC to deny everything |
mask_request_host | str | None | Override the Host header on outbound requests |
Host header masking
Usemask_request_host to override the Host header on all outbound requests. Useful when routing traffic through an internal proxy.
How enforcement works
Domain and IP rules are enforced at two layers:- Layer 3/4 (iptables): IP and CIDR rules are applied as kernel
iptablesDROP rules. No userspace proxy overhead. - Layer 7 (TCP proxy): For domain-based rules, all TCP traffic is redirected to the per-namespace proxy. HTTP Host headers and TLS SNI fields are inspected before forwarding.
Block cloud metadata service
Cloud instances expose a metadata endpoint at169.254.169.254. This is automatically blocked in all sandboxes to prevent SSRF attacks.
Using SecurityPolicy network configuration
For richer network control integrated with PII scanning and audit logging, useNetworkPolicy inside a SecurityPolicy: