Skip to main content
This guide explains how to use TrueFoundry’s built-in Prompt Injection guardrail to detect and block prompt injection and jailbreak attempts in LLM interactions.
Implementation: This guardrail is powered by Azure Prompt Shield and runs on TrueFoundry-managed infrastructure — no third-party API keys or setup required. For vendor-hosted prompt-injection controls using your own credentials (Azure Prompt Shield, Bedrock Guardrails, Google Model Armor, and others), see Supported Guardrails and Guardrails Overview.

What is Prompt Injection Detection?

Prompt Injection Detection is a built-in TrueFoundry guardrail that identifies prompt injection attacks and jailbreak attempts in user inputs. It is powered by Azure Prompt Shield under the hood and is fully managed by TrueFoundry — no external credentials or setup required.

Key Features

  1. Jailbreak & Injection Detection: Detects a wide range of prompt injection techniques including:
    • Direct prompt injection attempts that try to override system instructions
    • Jailbreak attacks (e.g., “DAN” / “Do Anything Now” style prompts)
    • Indirect injection via document or context content
  2. Dual Analysis: Analyzes both the user prompt and any document/context content separately, catching attacks embedded in either location.
  3. Zero Configuration: Fully managed by TrueFoundry with no credentials, thresholds, or categories to configure. Works out of the box.

Adding Prompt Injection Guardrail

1

Navigate to Guardrails

Go to the AI Gateway dashboard and navigate to the Guardrails section.
2

Create or Select a Guardrails Group

Create a new guardrails group or select an existing one where you want to add the Prompt Injection guardrail.
3

Add Prompt Injection Integration

Click on Add Guardrail and select Prompt Injection from the TrueFoundry Guardrails section.
TrueFoundry guardrail selection interface showing Prompt Injection option

Select Prompt Injection from TrueFoundry Guardrails

4

Configure the Guardrail

Fill in the configuration form:
  • Name: Enter a unique name for this guardrail configuration (e.g., prompt-injection)
  • Enforcing Strategy: Choose how violations are handled
5

Save the Configuration

Click Save to add the guardrail to your group.

Configuration Options

Prompt Injection only supports validate mode — it detects and blocks attacks but does not modify content. See Guardrails Overview for details on Enforcing Strategy.

How It Works

The guardrail analyzes incoming content in two parts:
  1. User Prompt Analysis: Scans the user’s message for direct injection or jailbreak patterns
  2. Document Analysis: Scans any system prompt or context content for indirect injection attempts
If an attack is detected in either part, the request is blocked (in enforce mode) with a violation message indicating where the attack was found. Example: Jailbreak Blocked:
Example: Indirect Injection Blocked:
Start with Audit enforcing strategy to monitor detections in Request Traces before switching to Enforce.

Use Cases

Prompt Injection works best as an LLM Input guardrail. Combine it with other guardrails like Content Moderation for comprehensive input protection.