Documentation Index
Fetch the complete documentation index at: https://docs.declaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
Use case
Regression probe for strict egress firewall rules. Before the fix, a sandbox withNetworkPolicy(allow_out=["api.openai.com"], deny_out=[ALL_TRAFFIC]) relied solely on the L7 proxy to block by TLS
SNI. A raw socket.create_connection(("evil.com", 443)) completed a
TCP handshake against the local proxy listener (the packet was
redirected there regardless of destination), and the probe reported
REACH even though the L7 policy would drop the connection shortly
after.
After the fix, only packets bound for resolved allow-list IPs are
redirected. Everything else hits the default DROP and the sandbox’s
connect() returns ConnectionRefusedError / ETIMEDOUT at the
kernel — matching what the policy promises.
What you’ll learn
- How Declaw enforces network policy at both L4 (firewall) and L7 (TLS SNI proxy)
- Testing raw TCP connectivity to denied hosts
- Verifying that allowed hosts still pass through
Prerequisites
Code walkthrough
The security policy allows onlyapi.openai.com and denies everything
else:
Expected output
- L4 denied — raw TCP to
evil.comand1.1.1.1fails at the kernel withConnectionRefusedorETIMEDOUT. - L7 denied —
urllibtoevil.comalso fails (SNI rejected by the proxy as defense in depth). - L4 allowed — raw TCP to
api.openai.comsucceeds, proving the allow-list path is not over-restricted.
Full source
Seecookbook/examples/network-l4-enforcement/main.py in the repo.