outbound rules apply before a request leaves the sandbox, and inbound rules apply before a response reaches your agent code. Use them to strip credentials from outbound headers, mask tokens in logs, or remove known injection patterns from responses.
Basic configuration
TransformationRule model
| Field | Type | Description |
|---|---|---|
direction | TransformDirection | "outbound", "inbound", or "both" |
match | str | Python re-compatible regex pattern |
replace | str | Replacement string; supports capture group backreferences (\1, \2) |
TransformDirection enum
| Value | When applied |
|---|---|
outbound | Applied to request bodies before they leave the sandbox |
inbound | Applied to response bodies before they reach the workload |
both | Applied in both directions |
Multiple rules
Rules are applied in the order they are listed.Common patterns
Strip API keys from Authorization headers
Strip API keys from Authorization headers
Mask database connection strings
Mask database connection strings
Remove prompt injection patterns from responses
Remove prompt injection patterns from responses
Strip system prompt extraction attempts
Strip system prompt extraction attempts
Mask Social Security Numbers (deterministic)
Mask Social Security Numbers (deterministic)
Remove invisible Unicode injection characters
Remove invisible Unicode injection characters
Attackers sometimes embed invisible Unicode characters in text to manipulate LLM context windows.
Combining with PII redaction
Transformation rules complement PII redaction. Use PII redaction for structured sensitive data (SSNs, credit cards) that benefits from response rehydration, and transformation rules for patterns that should be permanently removed.When TLS interception activates
Transformation rules require reading the request or response body, which means the security proxy must decrypt HTTPS traffic. TLS interception (Stage 3 of the pipeline) activates automatically when any transformation rules are configured. A per-sandbox CA certificate is generated at creation time and injected into the VM trust store. The proxy terminates TLS from the sandbox, applies transformations, and re-encrypts to the real destination. The agent code sees the destination’s certificate as usual.Regex patterns use Go’s
regexp package syntax, which is RE2-compatible. Backtracking patterns like (.+)+ are not supported. Test your patterns at regex101.com with the Go flavor selected.Order of operations
When both PII redaction and transformation rules are active:- Outbound: Transformation rules apply first, then PII scanning on the transformed body.
- Inbound: Injection defense runs, then transformation rules, then PII rehydration restores tokens.