What You’ll Learn
- Why network deny-all (and the credential vault) — not PII redaction — is what stops API-key exfiltration
- How to configure
PIIConfigto redact structured PII (email, SSN, credit card) from outbound HTTP - How to test TCP blocking, HTTP exfiltration, and DNS exfiltration
- How the edge proxy redacts structured PII from HTTP request bodies before forwarding
Prerequisites
- Declaw running locally or in the cloud (see Deployment)
DECLAW_API_KEYandDECLAW_DOMAINset in your environment
This example is available in Python. TypeScript support coming soon.
Security Configuration
The example uses two independent layers of protection:[REDACTED_EMAIL]. Note: API keys aren’t reliably redacted here — there’s no working api_key detector. To keep a key out of the sandbox entirely, use the Credential Vault, which injects it at the egress proxy so it never enters the VM. Active even if the network allow-list permits some outbound traffic.
Layer 2 — Network deny-all: Blocks all outbound TCP connections. This is the layer that actually stops a stolen secret from leaving — even data the PII scanner doesn’t recognize (like an API key) cannot reach any destination.
PII Types Explained
Code Walkthrough
1. The credential collection script
This script represents untrusted code that has access to credentials and PII:2. Three exfiltration attack vectors
The example tests three distinct exfiltration methods: TCP connectivity (basic):3. Run all tests
Expected Output
How PII Redaction Works (edge proxy)
When the guardrails service is active and network access is permitted (for example, to call an LLM API), the proxy intercepts and redacts credentials from HTTP traffic:api.openai.com), structured PII is stripped from outbound request bodies before they leave the sandbox. API keys and other secrets are not covered here — use the Credential Vault so a key is injected at the proxy and never enters the sandbox in the first place.