Skip to main content

What You’ll Learn

  • Creating a sandbox with network={"allow_out": ["api.github.com"]}
  • Understanding how allow_out creates 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

The allow_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 the network dict with allow_out at sandbox creation time:
The test script uses a raw TCP socket to verify blocking:
Test that a non-allowlisted IP is blocked:
Verify the policy is stored by inspecting sandbox info:

Expected Output