Choosing a runtime response to prompt injection detection: block, redact, or flag
No single response fits every case. Choose by combining detection confidence, content source, agent privilege, and the consequence of the action.
How the three responses differ
Block, redact, and flag are three different controls, not three strengths of the same control. Each trades prevention against workflow continuity in a different way.
Block
Stops the content or action. Strongest prevention, highest false-positive cost.
Redact
Removes the suspect span and continues. Preserves workflow but alters context.
Flag
Allows and records. Detective only, so it depends on review speed.
Response modes compared
The table pairs each response with its tradeoff and the conditions under which it fits best.
| Response | Effect | Tradeoff | Use when |
|---|---|---|---|
| Block | Stops the content or action. | Strongest prevention, highest false-positive cost. | Confidence is high, or a sensitive or irreversible tool call is at stake. |
| Redact | Removes the suspect span and continues. | Preserves workflow but alters context. | The suspect span is separable and the remaining content is still safe to use. |
| Flag | Allows and records. | Detective only, so it depends on review speed. | Confidence is low and the agent cannot take consequential action. |
Factors that should drive the choice
Do not choose a response from detection confidence alone. Combine these factors for each event:
- Detection confidence. High confidence points toward blocking. Low confidence points toward flagging, provided the agent cannot take consequential action.
- Content source. Treat the origin of the suspect content as a policy input alongside the other factors, and record it for every event.
- Agent privilege. Whether the agent can make a sensitive or irreversible tool call changes how much risk an allowed event carries.
- Consequence of the action. The more consequential the action, the stronger the response should be.
- Separability of the suspect span. Redaction fits only when the suspect span can be removed and the remaining content is still safe to use.
Designing a tiered runtime policy
Implement the mapping from these factors to a response as central, versioned runtime policy with full logging, not as per-application logic. A central policy keeps enforcement consistent across agents and makes every change traceable.
- Block tier. Applies when confidence is high or when a sensitive or irreversible tool call is at stake.
- Redact tier. Applies when the suspect span is separable and the remaining content is still safe to use.
- Flag tier. Applies when confidence is low and the agent cannot take consequential action.
Because flagging only detects, its value depends on how quickly events are reviewed. For flag-only rules on tool-enabled agents, set alerting and review timelines that match how fast the agent can act.
What to require from runtime enforcement tooling
Logging, review, and tuning each mode needs
- Record the detection score, content source, policy and version applied, and action taken for every event.
- Retain original and modified content for redactions, under access controls, since logs may hold sensitive data.
- Provide a review queue for blocked and flagged events, with a way to label each as a true or false positive.
- Feed labeled outcomes back into threshold and policy changes, and track false positives and misses over time.
- Keep change history for policy edits so you can show who changed enforcement and when.
- For flag-only rules on tool-enabled agents, set alerting and review timelines that match how fast the agent can act.