Skip to main content

What You’ll Learn

  • Creating TransformationRule entries with regex match and replace fields
  • Controlling direction with OUTBOUND, INBOUND, or BOTH
  • Using TransformationRule.apply() locally to verify regex matching before deploying
  • Using TransformationRule.applies_to() to check which directions a rule covers
  • Attaching rules to a SecurityPolicy at sandbox creation time

Prerequisites

  • Declaw instance running and DECLAW_API_KEY / DECLAW_DOMAIN set

Code Walkthrough

This example is available in Python. TypeScript support coming soon.

1. Define transformation rules

Each TransformationRule takes a regex match pattern, a replace string, and a direction.

2. Create a sandbox with the rules attached

The proxy applies each rule to all matching traffic for the lifetime of the sandbox.

3. Transformation directions

4. Test rules locally with apply() and applies_to()

Before deploying, verify your regex patterns work as expected:

5. Before/after examples for all three rules

6. Cleanup

Expected Output