prompt_injection policy to create for this purpose.
The
prompt_injection policy type exists in the policy type enum for API completeness, but scanning itself does not read policy configuration - it is hardcoded proxy behavior applied uniformly to every request.How It Works
- Every request flowing through the proxy has its message content (and top-level
prompt/content/inputfields) scanned against a fixed set of prompt injection patterns. - If a pattern matches, the proxy blocks the request with
403 Forbiddenbefore it reaches the LLM provider. - No audit event is emitted for a detected injection, and the original prompt is not stored anywhere by this check - only a warning-level application log line records the matched pattern (truncated) for the operator.
Patterns Detected
The scanner checks the request text (after Unicode NFKC normalization and zero-width-character stripping) against 15 fixed regular expressions across six categories:
Detection is a fixed-confidence match: any pattern hit is reported at confidence
0.85. There are no configurable sensitivity levels.
What the Agent Sees
When a prompt injection is detected, the agent receives:policy_id in the response - this check is not tied to a specific policy.
Enforcement Architecture
- Scan path: The proxy scans
messagescontent (string or structuredtextparts) plus top-levelprompt/content/inputfields before forwarding to the LLM provider. - Fail-open on parse failure: If the request body isn’t valid JSON, the scan is skipped and the request proceeds - this check only inspects bodies it can parse.
- No audit trail entry: Detections are logged to the application logger only; they do not appear in
GET /audit-trailand the flagged prompt itself is never persisted by MeshAI.

