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
| Control | Question it answers | Relation to inspection |
|---|---|---|
| Input / content inspection | Does this content representation raise risk signals, and how is it classified | Owns content analysis, findings and their hand-off to disposition policy |
| Data provenance | Where did this content come from and how was it derived | Supplies source context that inspection may consume; inspection never writes provenance |
| Spotlighting / data marking | How can untrusted data be marked so its role is clearer to the model | Inspection may trigger marking but does not own the technique |
| Prompt injection detection | Do content, behavior, plans, actions and telemetry together indicate an attack | Broader runtime detection; inspection is its pre- and in-context content slice |
| Agent authorization | May this fully resolved action execute | Deterministic and independent; a clean inspection grants nothing |
| Information flow control | May data with these attributes move from source to sink | Deterministic and independent; a clean inspection never lowers a label |
| Human-in-the-loop | Does a selected consequential action need a human decision | Findings 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.
A clean result means the inspector raised no signal on the representation it saw. It does not make content trusted, benign or authorized.
A finding indicates risk. It does not prove malicious intent, and it does not show that any model was influenced or any effect occurred.
Inspection says something about content. Provenance says where content came from. Neither substitutes for the other.
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.
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
- 01User input
Before a user turn is added to the conversation context.
- 02Ingestion
When documents, messages or pages enter a store or index.
- 03Retrieval
When retrieved chunks or search results are selected for a request.
- 04Tool result
When a tool, connector or API response returns to the orchestrator.
- 05Agent handoff
When content passes between agents or workflow steps.
- 06Memory 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
| Representation | What it is | Why it matters |
|---|---|---|
| Raw | Original bytes or file as received | Evidence and re-inspection baseline |
| Parsed / extracted | Text and fields after format parsing | May omit or add content compared with raw |
| Normalized | After canonicalization such as decoding or whitespace handling | Removes some representation differences |
| Model-visible | Exactly what is placed into the context window | Closest 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
| Family | Strengths | Weaknesses |
|---|---|---|
| Signature and rule | Transparent, fast, easy to test and explain | Narrow; paraphrase and new phrasing avoid it |
| Heuristic | Captures structural cues cheaply | Noisy; thresholds drift with content mix |
| Classifier or model-based | Generalizes to paraphrase and context | Opaque; 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.
Attach the finding as metadata for downstream controls and telemetry.
Send the request to a restricted workflow with fewer tools or no side effects.
Hold content out of context pending review or re-inspection.
Remove specific spans. Stripping can change meaning and can itself be exploited, so apply it only where the loss is acceptable and record it.
Refuse to place the content into context for this request.
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
| Control | May use a finding to | Must not use a finding to |
|---|---|---|
| Spotlighting / data marking | Decide which content to mark | Treat unmarked content as trusted |
| Agent authorization | Log context for decisions | Grant or widen permission |
| Information flow control | Record risk attributes alongside labels | Lower a classification |
| Human-in-the-loop | Show reviewers the finding | Skip a required approval on a clean result |
| Data provenance | Correlate findings with lineage | Write 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 | Observation | Outcome |
|---|---|---|
| Provenance | Attachment recorded as customer-supplied, external author | Context for inspection; no decision |
| Inspection (user turn) | No signal on the user request | Proceeds; not a trust decision |
| Inspection (attachment) | Instruction-like signal in a data channel | Signal recorded with inspector version and span |
| Disposition policy | External content, send-capable workflow | Attachment quarantined from context; request routed read-only |
| Model proposal | Summary and draft reply only | Variable output |
| Authorization / IFC | No send without the user's explicit action; internal notes cannot flow to external recipients | Would 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.
| Measure | Numerator | Denominator |
|---|---|---|
| Inspection coverage rate | Content items inspected at their required points | Content items requiring inspection by policy |
| Detection recall | Labelled adversarial-style cases flagged | Labelled adversarial-style cases in the test corpus |
| False-positive rate | Benign cases flagged | Benign cases in the test corpus |
| Unknown / uninspected content rate | Items entering context without a completed inspection | Items entering context |
| Representation coverage | Items inspected in the model-visible representation, with raw linkage retained | Items inspected |
| Disposition coverage | Findings with a recorded disposition and policy version | Findings |
| Drift regression pass rate | Regression cases with expected result | Regression cases run |
| Containment rate (with downstream controls) | Adversarial-style cases with no disallowed effect, gates attributed | Adversarial-style cases executed end to end |
| Detection latency | Distribution (for example median and high percentiles) of inspection time | Inspected items |
| Benign task utility | Benign tasks completed acceptably | Benign tasks attempted |
Common Mistakes
- 01Clean as trusted
A clean result used to skip authorization or lower a label.
- 02Merged channels
External content concatenated into the user turn.
- 03Wrong representation
Raw bytes inspected while the model sees different extracted text.
- 04Silent failure
Inspector outage treated as a clean result.
- 05Unrecorded stripping
Spans removed without logging, changing meaning invisibly.
- 06Single 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
- OWASP GenAI LLM Top 10 2026 (LLM01:2026 Prompt Injection)OWASP GenAI Security Project · GuidanceReviewed 2026-09-25
- Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations, NIST AI 100-2e2025NIST · Standard · 2025-03Reviewed 2026-09-25
- Defend against indirect prompt injection attacksMicrosoft Learn · GuidanceReviewed 2026-09-25
- Prompt Shields in Azure AI Content SafetyMicrosoft Learn · Technical documentationReviewed 2026-09-25