Skip to main content
Intercept middleware can block, redact, mask, log, or modify prompts before they reach an AI provider. For production apps, it is usually best to roll out gradually. Start by observing. Then tune. Then enforce.

Local environment

In local development, use logging so you can understand what the middleware detects.
This lets prompts continue while writing detection logs.

Staging environment

In staging, continue logging but use traffic and examples that look closer to production.
This lets you confirm that PII redaction works without blocking user flows too early.

Production environment

In production, use stricter defaults.
This setup:
  • blocks common prompt injection attempts
  • redacts common structured PII
  • blocks high-risk secrets
  • avoids exposing raw sensitive values to the provider

Suggested environment matrix