Security guardrails
Updated on 16 November 2026.
Detect sensitive data and adversarial input in prompts and responses, then monitor, redact, tokenize or block it. Set the basics per app in the app's settings; use the Policy Engine's Data & Adversarial Risks card when you need rules that depend on who is calling, which model, or which part of the request.
Configure this control
Choose the mode used by your gateway. When the Policy Engine is on, published rules govern this control; classic values saved through Edit anyway apply only after the engine is disabled. See What happens to classic settings.
- Classic settings
- Policy Engine
Turn it on for an app
The Security Guardrails section includes:
Defaults for a new app
Create App has no guardrail step. Every new app starts with these guardrails:
Because the default action is Monitor, a new app records detections without changing traffic. Review findings before you change any category to Redact or Block.
Actions
- Adversarial risks and the hallucination check support Block or Monitor only. There is no value to redact.
- Action resolution: the category's own action takes precedence, then the app's default action, then Monitor.
- Set everything to default clears per-category actions so every category follows the default action.
- The Action mix panel counts categories by action, including categories that are off.
Image Risks uses Monitor, Strip or Block. Strip removes the whole image. Text redaction, partial redaction and tokenization inside an attachment also remove that attachment, rather than editing the original file. See attachment actions.
Tokenize
Use Tokenize when users need the real values in the answer but the model provider must not see them. The gateway swaps each detected value for a typed placeholder, and swaps it back in the response.
- Same value, same placeholder. A value keeps its placeholder for the whole conversation, so later turns stay consistent. Each new value gets the next number for its type (
<PERSON_2>,<EMAIL_1>). - One conversation, one user. The gateway keeps the placeholders of a conversation for 24 hours after its last request. A conversation is identified by its conversation id (for example the
x-conversation-idheader orprevious_response_id), or by its first message when there is none. When the gateway knows who is calling (user identity, a named user key, a separate app key, or the request'suserfield), the placeholders also belong to that user, so another user who sends the same conversation id never gets the values back. - Streaming and tool calls. Placeholders are restored in streamed responses and in tool-call arguments.
- Stricter actions win. If another category redacts or blocks the same value, that action applies instead.
- New values in the response. When the category also checks responses, a sensitive value the model writes that was not in the conversation is redacted, as with Redact.
- Where Tokenize works. Chat completions, Anthropic Messages, OpenAI Responses, native Gemini
generateContentand Bedrock Runtime (converse,invoke_model), with and without streaming. Everywhere else, including SDK Mode, embeddings, speech and attachments, Tokenize behaves as Redact. - Logs show placeholder counts and types, never the original values.
Placeholders are restored inside tool-call arguments. If the model can call tools you do not trust, a prompt injection could make it pass a placeholder to such a tool, which would then receive the real value. Use Redact for those apps.
Data risks
Each text data-risk category has these settings:
Image Risks applies to request images and has a switch and action per image type. It requires Scan attachments and Classify images in the app's Attachments section, or the equivalent published Policy Engine configuration. Document extraction and OCR let the text data types above inspect supported files as well as message text.
Risk level and sub-category sensitivity
Every sub-category has a sensitivity. The category's risk level determines which sensitivities trigger detection: a low risk level detects only clearly sensitive values, and a high risk level also detects weaker contextual signals.
Example for PII, where passport is a high-sensitivity sub-category and name, home address and email are low-sensitivity:
Change one sub-category's sensitivity to tune that value without changing the whole category.
The app's risk level wins over the organization-wide setting in Detection Models. When the Policy Engine is enabled, the policy wins.
Adversarial risks
Each category has an on/off switch and a Block | Monitor action. Its scope is fixed to the side of the conversation it targets.
Enable all turns every adversarial category on.
Precision detections
Exact-match patterns for structured identifiers. Use them when you need a specific identifier detected in addition to the contextual data risk categories. Each detection has its own switch and action (Redact, Partial redact, Tokenize, Block or Monitor; default Monitor), and all are off until you turn them on. A red dot marks a high-sensitivity identifier.
The built-in catalog has more than 80 identifiers:
To match your own identifiers with a regex, create a Custom Detection instead.
Hallucination check
Flags responses the gateway scores as likely fabricated, using a fixed threshold of 0.8.
It runs on non-streaming responses only, because a streamed response cannot be blocked once it has started. To set a different threshold per app or group, use the Policy Engine's Hallucination protection card.
Source IP restrictions
Accept gateway calls only from listed networks. Turn on Enabled and enter Allowed source IPs as comma-separated IPv4, IPv6 or CIDR values, for example 203.0.113.10, 10.0.0.0/8. Calls from other addresses are rejected.
Going further with the Policy Engine
- Open Govern > Policy Engine > LLM Gateway > Controls > Data & Adversarial Risks.
- Choose a recipe or use the add menu in Detection rules, Language Blocking, or Tag matching traffic.
- Set Applies to, the conditions and outcome. Check Reads as, then Save to draft.
- Use Test > Try a situation for a matching request and an exception, then Review & publish.
Detection rules
Select data types, a findings threshold, an action, and whether the rule applies to Request, Response or Both. A whole category or individual types can be selected; app custom detections appear in the Custom group. Scan tool-call arguments checks arguments separately and supports Monitor or Block.
The highest-priority matching action applies to the request or response; the stricter action wins ties. A higher-priority Monitor or Redact can cancel a lower-priority Block, including a block selected by another data type. Non-blocking redaction is selected per data type. Check the panel's How rules combine explanation before adding an exception, and test requests containing several data types together.
Detection rules do not offer Tokenize yet. To tokenize, set the action in the app's settings (Classic settings) or with the Management API.
Without a rule here, nothing is redacted or blocked. A type is scanned only when a rule needs it, so the absence of a finding does not by itself prove that the type was checked.
Language Blocking
Choose Only allow certain languages to monitor or block passages outside the languages you select. Languages are unrestricted without a matching rule. Highest priority decides; conflicting values at the same priority fail validation. Streamed responses are skipped.
Tag matching traffic
Add a severity to matching traffic for investigation and reporting. Severity does not change Monitor, Redact or Block. All matching tag rules contribute, and the highest severity is reported regardless of priority.
Hallucination scoring and source IP restrictions have their own controls: Hallucination protection and Identity and network trust.
Endpoint coverage
The table below describes the text guardrails. Attachment scanning adds request-file protection on supported conversational surfaces and request-side SDK text/messages checks when enabled and available on the deployment. This includes supported data URLs embedded in text; it does not scan model-generated files. SDK callers should inspect attachment results and coverage, separately from message-text predictions.
- Streaming: request-side checks run as normal. Response-side redaction and blocking apply only when the gateway holds the full response, so streamed chunks pass through unmodified. Tokenize placeholders are still restored in streamed chunks.
- Copilot Studio cannot accept rewritten tool input, so Redact, Partial redact and Tokenize become Block. See Copilot Studio.
- Realtime sessions log the handshake, byte counters and usage, but do not run DLP. Use SDK Mode to scan Realtime transcripts out of band.
Related
- Custom detections - your own regex and intent detections.
- Guardian Agent - dependency checks and task adherence.
- Policy Engine overview - how cards, scopes and priorities work.