Skip to main content

What You’ll Learn

  • Creating a sandbox with allow_internet_access=False (Python) / allowInternetAccess: false (TypeScript)
  • Verifying blocked outbound traffic by attempting a raw TCP connection
  • Comparing behavior against a sandbox with default (open) network access
  • Proper cleanup of multiple sandboxes with try/finally

Prerequisites

Code Walkthrough

The test script attempts a raw TCP connection to 1.1.1.1:80. In a blocked sandbox, socket.connect() raises an exception:
Create a sandbox with internet blocked:
Compare against a sandbox with default (open) network access:

Expected Output