Defense control

Input / Content Inspection

How to inspect user input and externally sourced content for prompt injection risk signals before and during context assembly, and how to turn findings into risk-tiered dispositions. An inspection result is probabilistic evidence, never a trust, declassification or authorization decision.

By Norbert HofmannPublished: 2026-09-25Last reviewed: 2026-09-25Level: AdvancedAudience: Security Engineers, Developers, AI Engineers
Control family
Context and content
Control type
Probabilistic signal feeding deterministic disposition policy
Core question
Does this content, in the representation the model will see, raise prompt injection or related risk signals
Level
Advanced
Table of contents

Security Objective

Input and content inspection analyzes user input and externally sourced content before or during context assembly. It looks for prompt injection and related risk signals, classifies what it finds, and hands the result to a disposition policy that decides whether content is annotated, routed, quarantined, minimized, blocked or sent for review.

Its value is early, content-level visibility. Inspection can stop obviously unsuitable content from entering a context window, can route suspicious content to a more restricted workflow, and can produce evidence for telemetry and incident response. It cannot guarantee that content is safe, because model interpretation of language remains probabilistic and attackers adapt. For why inspection is one layer rather than complete prevention, see Why Prompt Injection Is Not Just Input Validation.

Ownership Boundaries

What content inspection owns and what neighbouring controls own
ControlQuestion it answersRelation to inspection
Input / content inspectionDoes this content representation raise risk signals, and how is it classifiedOwns content analysis, findings and their hand-off to disposition policy
Data provenanceWhere did this content come from and how was it derivedSupplies source context that inspection may consume; inspection never writes provenance
Spotlighting / data markingHow can untrusted data be marked so its role is clearer to the modelInspection may trigger marking but does not own the technique
Prompt injection detectionDo content, behavior, plans, actions and telemetry together indicate an attackBroader runtime detection; inspection is its pre- and in-context content slice
Agent authorizationMay this fully resolved action executeDeterministic and independent; a clean inspection grants nothing
Information flow controlMay data with these attributes move from source to sinkDeterministic and independent; a clean inspection never lowers a label
Human-in-the-loopDoes a selected consequential action need a human decisionFindings can inform review context; they do not replace the gate

Inspection answers a narrow question about content. It does not decide who may act, what data may flow where, or what a component is permitted to touch. Agent authorization, information flow control and least privilege remain deterministic controls outside the model. How untrusted content is marked for the model is covered in spotlighting / data marking.

Inspection Results Are Evidence

Four distinctions keep inspection results from being misused as security decisions.

01
RuleNot detected is not safe

A clean result means the inspector raised no signal on the representation it saw. It does not make content trusted, benign or authorized.

02
RuleDetected is not proven compromise

A finding indicates risk. It does not prove malicious intent, and it does not show that any model was influenced or any effect occurred.

03
RuleA signal is not provenance

Inspection says something about content. Provenance says where content came from. Neither substitutes for the other.

04
RuleParsing is not semantic trust

Schema validity, successful decoding, normalization, OCR or parsing establish structure, not whether the meaning is safe to follow.

Threat Model and Limits

The threat is content that attempts to change what the model treats as its instructions, either typed by a user (direct prompt injection) or embedded in data the application retrieves or receives (indirect prompt injection). Related risk signals include attempts to extract hidden context, to request out-of-scope actions or to smuggle content into later steps.

Limits are structural. Natural language has no fixed boundary between data and instruction; the same sentence may be benign in one task and hostile in another; inspectors see a representation, not the model's eventual interpretation; and adversaries test against deployed inspectors. Inspection therefore reduces exposure and improves visibility but is never a complete security boundary.

Trust Model

The inspection engine and its output are separate objects. A system component can run the analysis faithfully, yet the score or label it produces remains variable evidence about variable content. Only the disposition policy that consumes the signal, and the enforcement controls further downstream, are system decisions.

Content, inspection signal and enforcement
Variable trustSource content
SystemAuthoritative provenance / context metadata
SystemRepresentation builder / parser
Variable trustModel-visible / inspected representation
SystemInspection engine
Variable trustInspection signal / score
SystemDisposition policy
SystemContext assembly / routing
Variable trustModel proposal
SystemAuthorization / IFC
Variable trustEffect

Three rules follow. Parsing and inspecting content never upgrade its trust. The inspection signal never flows into authorization or flow decisions as a permission. And a missing or failed signal is represented as uninspected, never as clean.

Inspection Points in the Content Lifecycle

Where inspection can run
  1. 01
    User input

    Before a user turn is added to the conversation context.

  2. 02
    Ingestion

    When documents, messages or pages enter a store or index.

  3. 03
    Retrieval

    When retrieved chunks or search results are selected for a request.

  4. 04
    Tool result

    When a tool, connector or API response returns to the orchestrator.

  5. 05
    Agent handoff

    When content passes between agents or workflow steps.

  6. 06
    Memory and cache write

    Before derived content is persisted for later reuse.

Ingestion-time inspection is cheaper and lets stored findings follow content, but it can go stale as inspectors improve. Request-time inspection sees the actual context and task but adds latency. Many systems combine both and record which inspector version produced each finding.

User Input Versus External Content

Direct and indirect content need distinct evaluation contexts. A user turn is expected to contain requests; the question is whether it tries to override system-level policy. External content is expected to be data; any instruction-like text inside it is a signal, because data should not direct the system at all.

Raw, Parsed, Normalized and Model-Visible Representations

Representations an inspector may see
RepresentationWhat it isWhy it matters
RawOriginal bytes or file as receivedEvidence and re-inspection baseline
Parsed / extractedText and fields after format parsingMay omit or add content compared with raw
NormalizedAfter canonicalization such as decoding or whitespace handlingRemoves some representation differences
Model-visibleExactly what is placed into the context windowClosest to what can influence the model

Inspect the model-visible representation where possible, because that is what the model interprets. Retain a link from each finding to the raw representation and to the representation actually inspected, so an investigator can reproduce the result and see what the model received.

Text, Structured Fields, Documents and Multimodal Content

Different content types need different representations before inspection. Structured tool responses contain free-text fields that can carry language even when the schema is valid. Documents yield text through parsers that may include or skip metadata, comments or hidden layers. Images and audio reach text models through OCR, captions or transcriptions, and only those derived representations can be inspected by a text inspector.

For document and multimodal content, record which extraction path produced the inspected text. A clean OCR result says nothing about content that the OCR step did not capture.

Encoding and Canonicalization as Preprocessing

Content may be encoded, escaped or formatted in ways that make the same meaning look different. Normalizing representations before inspection helps inspectors compare like with like. This page intentionally gives no catalogue of encodings or obfuscation methods.

Rule-Based and Classifier-Based Signals

Signal families
FamilyStrengthsWeaknesses
Signature and ruleTransparent, fast, easy to test and explainNarrow; paraphrase and new phrasing avoid it
HeuristicCaptures structural cues cheaplyNoisy; thresholds drift with content mix
Classifier or model-basedGeneralizes to paraphrase and contextOpaque; can itself be influenced; needs evaluation and versioning

Combining families improves coverage, but combination is still probabilistic. Record which family produced a finding so dispositions and investigations can weigh it appropriately.

Semantic and Contextual Signals

Useful signals often depend on context rather than wording: instruction-like text inside a data channel, content that addresses the assistant or its tools, requests unrelated to the user's task, or references to hidden context. The same text may be ordinary in a user turn and suspicious inside a retrieved document, which is why evaluation context matters.

Provenance-Aware Inspection

Inspection can consume data provenance as context: entry path, source type, tenant or connector can select which inspector runs and which thresholds apply. Inspection does not own provenance, never writes findings into provenance fields, and never derives provenance from what content claims about itself.

Risk-Tiered Dispositions

A disposition policy outside the model maps findings, entry path and workflow risk tier to an action. Higher-authority workflows justify stricter dispositions and lower thresholds.

01
OptionAnnotate

Attach the finding as metadata for downstream controls and telemetry.

02
OptionRoute

Send the request to a restricted workflow with fewer tools or no side effects.

03
OptionQuarantine

Hold content out of context pending review or re-inspection.

04
OptionMinimize or strip

Remove specific spans. Stripping can change meaning and can itself be exploited, so apply it only where the loss is acceptable and record it.

05
OptionBlock

Refuse to place the content into context for this request.

06
OptionRequire review

Escalate to a reviewer; see human-in-the-loop for approval design.

Inspector Trust and Service Failure

The inspector is a system component that processes untrusted content, and a model-based inspector can itself be influenced by that content. Keep its output constrained to a fixed result schema, never let it call tools, and treat its output as a signal only.

When the inspector is unavailable, times out or returns an unparseable result, the content is uninspected. What happens next is a risk-tier decision: high-impact workflows may block or route to a restricted path, while low-impact read-only workflows may proceed with the gap recorded. No single fail-open or fail-closed rule fits every application.

False Positives, False Negatives and Drift

False negatives let risky content through; downstream enforcement must assume they happen. False positives block or degrade legitimate work, which pushes teams to raise thresholds or add bypasses. Both must be measured separately rather than traded off silently.

Content mix, user behavior, inspector versions and attacker techniques change over time. Maintain a versioned, labelled regression corpus, re-run it on every inspector or threshold change, and watch finding rates for shifts that indicate drift.

Derived Content Re-Entering Context

Summaries, translations, tool results, agent messages and memory entries are new content produced from earlier content. When they re-enter a context window they need their own inspection, because a transformation can preserve or reshape instruction-like text. A clean finding on the source does not carry over automatically to the derivative.

Relationship to Downstream Controls

How findings relate to other controls
ControlMay use a finding toMust not use a finding to
Spotlighting / data markingDecide which content to markTreat unmarked content as trusted
Agent authorizationLog context for decisionsGrant or widen permission
Information flow controlRecord risk attributes alongside labelsLower a classification
Human-in-the-loopShow reviewers the findingSkip a required approval on a clean result
Data provenanceCorrelate findings with lineageWrite or rewrite provenance

Worked Scenario

Synthetic example. A support assistant receives a user request to summarize an open ticket and propose a reply. Retrieval adds a customer-uploaded attachment whose extracted text contains a synthetic test marker phrased as an instruction to forward internal notes to an external address. The assistant has a send-email tool.

Gate-by-gate attribution
GateObservationOutcome
ProvenanceAttachment recorded as customer-supplied, external authorContext for inspection; no decision
Inspection (user turn)No signal on the user requestProceeds; not a trust decision
Inspection (attachment)Instruction-like signal in a data channelSignal recorded with inspector version and span
Disposition policyExternal content, send-capable workflowAttachment quarantined from context; request routed read-only
Model proposalSummary and draft reply onlyVariable output
Authorization / IFCNo send without the user's explicit action; internal notes cannot flow to external recipientsWould deny regardless of inspection result

In a benign variant, an attachment containing ordinary troubleshooting steps raises no signal and is placed into context with its provenance. The summary is produced normally, and the send tool still requires the user's own confirmation.

What the Scenario Proves and Does Not Prove

It shows inspection producing an early signal that a disposition policy used to reduce exposure, and it shows authorization and flow control independently preventing the harmful effect. It does not show that inspection alone contained the attempt, that a paraphrased version would be caught, or that the benign attachment was trustworthy. Containment is attributed to the combination of gates.

Telemetry and Evidence

Record for each finding

  • Correlation ID linking request, content and finding
  • Entry path and provenance reference
  • Representation inspected and link to raw representation
  • Inspector identity, version and signal family
  • Signal value or label and the matched span where applicable
  • Disposition applied and the policy version that applied it
  • Uninspected state and reason when inspection did not run

Findings can contain sensitive content. Apply the same access control and retention to findings as to the content they describe.

Incident Response for Suspicious Content

Response steps

  • Preserve the raw representation and the finding record
  • Use provenance to identify the source and its derivatives
  • Check whether downstream controls allowed any effect
  • Quarantine affected content and derived artifacts
  • Add a sanitized synthetic case to the regression corpus
  • Review thresholds and dispositions for the affected risk tier

A finding is a starting point for investigation, not a conclusion that compromise occurred.

Controlled Testing

Test with synthetic markers and bounded, labelled corpora of benign and adversarial-style cases. Keep test content out of production stores, version the corpus, and label each case with entry path, modality and expected disposition. Do not build or publish a reusable payload library; the goal is to measure inspector behavior, not to maintain attack material.

Metrics

Each measure keeps its own denominator. There is no composite score, and benign task utility is reported separately.

Inspection metrics with explicit denominators
MeasureNumeratorDenominator
Inspection coverage rateContent items inspected at their required pointsContent items requiring inspection by policy
Detection recallLabelled adversarial-style cases flaggedLabelled adversarial-style cases in the test corpus
False-positive rateBenign cases flaggedBenign cases in the test corpus
Unknown / uninspected content rateItems entering context without a completed inspectionItems entering context
Representation coverageItems inspected in the model-visible representation, with raw linkage retainedItems inspected
Disposition coverageFindings with a recorded disposition and policy versionFindings
Drift regression pass rateRegression cases with expected resultRegression cases run
Containment rate (with downstream controls)Adversarial-style cases with no disallowed effect, gates attributedAdversarial-style cases executed end to end
Detection latencyDistribution (for example median and high percentiles) of inspection timeInspected items
Benign task utilityBenign tasks completed acceptablyBenign tasks attempted

Common Mistakes

Failure patterns
  1. 01
    Clean as trusted

    A clean result used to skip authorization or lower a label.

  2. 02
    Merged channels

    External content concatenated into the user turn.

  3. 03
    Wrong representation

    Raw bytes inspected while the model sees different extracted text.

  4. 04
    Silent failure

    Inspector outage treated as a clean result.

  5. 05
    Unrecorded stripping

    Spans removed without logging, changing meaning invisibly.

  6. 06
    Single layer

    Inspection deployed as the only prompt injection control.

Implementation Checklist

Before relying on inspection

  • Inspection points defined per entry path
  • Direct and external content evaluated in separate contexts
  • Model-visible representation inspected, raw linkage retained
  • Disposition policy outside the model with versioned rules
  • Failure behavior defined per risk tier
  • Findings never used as permission or declassification
  • Derived content re-inspected when it re-enters context
  • Regression corpus and drift monitoring in place
  • Authorization, flow control and least privilege enforced independently

Standards and Sources

Standards and guidance referenced

OWASP
LLM01:2026 Prompt Injection
NIST
AI 100-2e2025 (taxonomy and terminology)
Microsoft
Defend against indirect prompt injection attacks (vendor guidance), Prompt Shields in Azure AI Content Safety (product documentation)

On source use: OWASP LLM01:2026 is the current classification for prompt injection. NIST AI 100-2e2025 is used only for terminology about adversarial machine learning and prompt injection; it is not a content-inspection standard. Microsoft's guidance on indirect prompt injection is vendor guidance that recommends a defense-in-depth strategy layering probabilistic and deterministic mitigations, listing prompt shields, spotlighting, plan drift detection, tool chain analysis, information flow control, least privilege and human-in-the-loop. Microsoft's Prompt Shields documentation describes one product that analyzes user prompt attacks and document attacks; it is cited as an example of product behavior within its documented scope, not as a general model.

Frequently Asked Questions

Does a clean inspection result mean content is safe?

No. It means no signal was raised on the inspected representation. Downstream controls must still assume some risky content gets through.

Does a detection prove an attack happened?

No. It indicates risk. Whether any model was influenced or any effect occurred has to be established separately.

Can a clean result grant permissions or lower a classification?

No. Authorization and flow control are independent and deterministic.

Which representation should be inspected?

Preferably the model-visible one, with a link to the raw representation for evidence and re-inspection.

Should user input and retrieved content be inspected the same way?

They need separate evaluation contexts. Instruction-like text is expected in a user turn but is a signal inside a data channel.

What should happen if the inspector is down?

The content is uninspected. The risk tier of the workflow decides whether to block, route or proceed with the gap recorded.

Is stripping suspicious text a safe default?

Not always. Removing spans can change meaning, so record every change and prefer quarantine or routing where meaning matters.

How does inspection relate to provenance?

Inspection may consume provenance as context but never writes it. Provenance says where content came from; inspection says what signals it raises.

Is this the same as prompt injection detection?

It is the content slice. Broader detection also considers behavior, plans, actions and telemetry.

Can a vendor feature solve prompt injection on its own?

No. Vendor guidance itself recommends layered defenses; a product inspector is one layer alongside human review, authorization and flow control.

References

  1. OWASP GenAI LLM Top 10 2026 (LLM01:2026 Prompt Injection)OWASP GenAI Security Project · GuidanceReviewed 2026-09-25
  2. Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations, NIST AI 100-2e2025NIST · Standard · 2025-03Reviewed 2026-09-25
  3. Defend against indirect prompt injection attacksMicrosoft Learn · GuidanceReviewed 2026-09-25
  4. Prompt Shields in Azure AI Content SafetyMicrosoft Learn · Technical documentationReviewed 2026-09-25