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
- Python
- TypeScript
The test script attempts a raw TCP connection to Create a sandbox with internet blocked:Compare against a sandbox with default (open) network access:
1.1.1.1:80. In a blocked sandbox, socket.connect() raises an exception: