- block all outbound traffic
- allow only specific public domains
- restrict egress to specific CIDR ranges
Modes
| Mode | Description |
|---|---|
allow-all | Default. No outbound restrictions. |
deny-all | Block all outbound network access. |
custom | Allow or deny specific domains and CIDR ranges. |
Create a box with a policy
PassnetworkPolicy when creating a box:
networkPolicy is also supported in Box.fromSnapshot() and EphemeralBox.
Read the current policy
Use thenetworkPolicy getter:
Update a running box
Update the policy after creation:Matching rules
allowedDomainssupports exact matches such asapi.github.com- wildcard domains must use
*.suffixform, for example*.githubusercontent.com allowedCidrsanddeniedCidrsuse standard CIDR notation- in
custommode,deniedCidrstakes precedence over allowed CIDRs - private IP ranges are always blocked even if you try to allow them explicitly