What You’ll Learn
- Creating a sandbox with
network={"allow_out": ["api.github.com"]} - Understanding how
allow_outcreates an implicit deny-all for unmatched destinations - Verifying that non-allowlisted destinations are blocked
- Inspecting sandbox info to confirm the policy was applied
How It Works
Theallow_out parameter accepts domain names (e.g., "api.github.com", "*.google.com") and IP/CIDR ranges. When an allowlist is set, only traffic to those destinations is permitted; all other outbound traffic is denied.
Domain-based allowlisting requires DNS resolution at the firewall level. In some environments this may not be fully functional. The sandbox is always created with the policy stored and returned regardless.
Prerequisites
This example is available in Python. TypeScript version coming soon.
Code Walkthrough
Pass thenetwork dict with allow_out at sandbox creation time: