Defense control

Spotlighting / Data Marking

How system-controlled marking, delimiting, transformation and channel separation make the role of untrusted external content more salient to a model. A representation-layer mitigation for indirect prompt injection: one defense layer, not a trust upgrade and not an authorization boundary.

By Norbert HofmannPublished: 2026-09-25Last reviewed: 2026-09-25Level: AdvancedAudience: Security Engineers, Developers, AI Engineers
Control family
Context and representation
Control type
Probabilistic, model-facing mitigation
Core question
Can the model tell which parts of its context are external data rather than instructions
Level
Advanced
Table of contents

Security Objective

Data marking changes how untrusted external content is represented in a model's context so that its source and role are easier for the model to recognize. System components add boundaries, labels, continuous marks, transformations or separate message channels to content that came from documents, web pages, email, retrieval or tools.

The objective is to reduce the chance that instruction-like text inside that content is treated as an instruction. It is a mitigation for indirect prompt injection, applied before or during context assembly, and it works only through the model's interpretation.

Threat Model

An attacker controls some content that a system later places into model context: a shared document, a web page, an email body, an indexed record or a tool response. The attacker cannot change the system prompt or the application code, but can write text that looks like instructions. The risk is that the model follows that text because, once concatenated, it looks like any other part of the prompt.

Marking assumes the attacker may know that marking exists and may try to imitate or disrupt it. It does not address a malicious user typing into their own session, which is direct prompt injection and needs other controls.

Ownership Boundaries

What data marking owns and what neighbouring controls own
ControlQuestion it answersRelation to marking
Spotlighting / data markingHow is untrusted content represented so its role is salient to the modelOwns the marking and transformation of model-visible representations
Data provenanceWhere did this content come from and how was it derivedSupplies the authoritative metadata that decides what gets marked
Input / content inspectionDoes this content raise risk signalsMay inform marking policy; a clean result never skips required marking
Prompt injection detectionDo content, behavior and actions together indicate an attackSeparate runtime detection; marking detects nothing
Information flow controlMay data with these attributes reach this sinkDeterministic and independent; marked content cannot lower its own label
Agent authorizationMay this fully resolved action executeDeterministic and independent; marked content cannot authorize itself
Output validationIs this output well-formed and within the structural and format constraints of its sinkSeparate sink-side structural and format control

Data provenance decides what content is and where it came from. Input / content inspection produces probabilistic signals about it. Marking only changes how it is presented to the model.

Marking Is Not Trust

01
RuleSystem-transformed is not trusted payload

A trusted component applied the marking. The marked content is still variable, untrusted content.

02
RuleA marker is not a security boundary

A delimiter, label, special marker or encoding is a signal to the model, not an enforcement point.

03
RuleReduced influence is not prevention

Marking may make the model less likely to follow embedded instructions. It does not make that impossible.

04
RuleNo formal isolation

Marking provides no noninterference property and no deterministic separation between data and instructions inside the model.

Trust Model

The marking component and its output are separate objects. The component runs under system control; the representation it produces carries attacker-influenced text and stays variable.

External content through marking to enforcement
Variable trustExternal / retrieved content
SystemAuthoritative provenance / role metadata
SystemMarking / transformation component
Variable trustMarked representation
SystemContext assembly
SystemModel / planner
Variable trustProposal
SystemAuthorization / IFC
Variable trustEffect

The model and planner run as system processes, but what they produce is a variable proposal. Authorization and information flow control decide whether it has any effect, independently of how the input was marked.

Why Concatenated Text Blurs Source Roles

A language model receives one sequence of tokens. When system instructions, a user request and a retrieved document are joined into that sequence without clear separation, nothing inherent in the text tells the model which part carries authority. Instruction-like text inside the document can then compete with the real instructions. Marking aims to restore some of that lost role information in a form the model can use.

Provenance Signal Versus Provenance Truth

A mark is a signal about provenance, not the provenance itself. The system must decide what to mark from authoritative metadata recorded outside the payload, never from labels or claims inside the content. A document that declares itself trusted is still external content and is marked as such.

Marking Points

Where marking can be applied
  1. 01
    Ingestion

    Record role metadata when content enters a store; apply marks later.

  2. 02
    Retrieval

    Mark selected chunks or search results before they join the context.

  3. 03
    Context assembly

    Place external content in its own marked region or channel.

  4. 04
    Tool results

    Mark tool and connector responses before the model reads them.

  5. 05
    Agent handoffs

    Keep or reapply marks when content passes between agents.

Marking at context assembly sees the final representation and is usually the most reliable point. Marks stored at ingestion can be lost or altered by later transformations.

Marking Strategies

Approaches fall into a few conceptual categories. They can be combined, and none is a security boundary on its own. This page describes categories only and does not publish specific strings, token formats or encoded samples.

Conceptual categories
CategoryIdeaMain trade-off
Channel and role separationPut external content in a distinct message role or fieldDepends on model and API support for roles
DelimitingSurround external content with boundary markersBoundary can be imitated or lost
DatamarkingInterleave a mark throughout external contentChanges text; can affect task quality
Encoding / transformationRepresent external content in a different formToken cost, model compatibility, utility
Structured envelopesWrap content in fields with metadata outside the payloadMetadata must stay outside attacker-editable text

Delimiting

Delimiting places boundary markers around external content and tells the model, in system-level instructions, that text between them is data. It is simple and cheap. Its weakness is that it signals only at the edges: if a boundary can be predicted, reproduced inside the content or lost during truncation, the signal weakens. Boundaries chosen by the system per request are harder to imitate than fixed ones.

Datamarking

Datamarking spreads a mark throughout external content rather than only at its edges, giving the model a continuous signal about which text is data. Because the signal persists across the whole span, it can survive partial truncation better than edge boundaries. The cost is that the text the model sees differs from the original, which can affect tasks that depend on exact wording.

Encoding and Transformation

Encoding represents external content in a different form, so it is visibly separated from natural-language instructions. The model must still be able to read the transformed form, which depends on model capability. Encoding usually increases token count, can push long content past input limits, and can reduce quality on tasks that need close reading. It changes representation, not meaning.

Structured Envelopes, Message Roles and Field Boundaries

Where an API supports distinct message roles or structured inputs, external content can be passed in a channel that is separate from system and user instructions. Structured envelopes can carry role and source metadata in fields that the content cannot edit. The metadata comes from provenance; the payload inside the envelope remains untrusted however it is wrapped.

Content Types

Where marking applies
SourceWhat gets markedNote
Web pagesExtracted page textExtraction may add or drop hidden content
EmailBodies, quoted threads, attachmentsForwarded text can mix several authors
DocumentsParsed text and metadata fieldsMark the representation the model sees
RAGRetrieved chunksEach chunk needs its own mark
Tool outputFree-text fields in responsesSchema-valid fields can still carry language
MultimodalOCR, captions, transcriptsOnly derived text can be marked

See website, email, document, RAG, tool output and multimodal prompt injection for the entry paths.

Model-Visible Representation and Transformation Lineage

What matters is the representation that actually reaches the model. Record which marking method and version produced it, and keep a link to the unmarked source. Without that lineage an investigator cannot tell whether a mark was applied, lost or altered before the model saw the content.

Interaction with Input / Content Inspection

Inspection and marking are independent. A policy may choose stronger marking for content with risk signals, but a clean inspection result is never a reason to skip marking that policy requires, because not detected does not mean safe. Inspection should analyze the same representation the model will see, which may be the marked one.

Interaction with Data Provenance

Marking consumes provenance and never establishes it. The decision to mark content as external comes from authoritative metadata about its entry path and source. Marking itself should be recorded as a transformation in the lineage so derived artifacts can be traced back.

Marking Policy

A policy outside the model decides which content is marked, with which method, at which point. Typical inputs are entry path, source type, workflow risk tier and model capability. External content in workflows with tools or side effects is the usual default for marking. The policy should be versioned so results can be tied to the rules in force.

Marker Integrity

Marks lose value if content can imitate them, if they collide with legitimate text, or if content can cause them to be removed. Conceptually: markers should be chosen by the system, not predictable from outside, applied after any content-controlled processing, and verified in the final representation. This page intentionally does not describe how markers can be bypassed.

Preservation Through Transformations

Transformations that can lose marks
  1. 01
    Summarization

    A summary of marked content is new text and may carry no mark.

  2. 02
    Truncation and chunking

    Edge boundaries can be cut off.

  3. 03
    Translation

    Marks may be dropped or translated as content.

  4. 04
    OCR and extraction

    Marks must be applied to derived text, not to the image.

  5. 05
    Agent handoffs

    Receiving agents may re-wrap content without the original mark.

Derived content that re-enters context should be marked again based on the provenance of its inputs, not on whether the derived text still looks marked.

Trade-Offs

Marking can reduce utility on tasks that need exact text, increases tokens and latency for some methods, depends on the model's ability to interpret the chosen representation, and can confuse users if the model mentions the marking. Measure these costs for your models and tasks rather than assuming them.

Limitations and Failure Modes

Ways marking fails
  1. 01
    Model ignores the signal

    The model follows embedded text despite correct marking.

  2. 02
    Mark lost

    A transformation removed or broke the mark before the model saw it.

  3. 03
    Mark forged

    Content imitated a marker or role label.

  4. 04
    Wrong source marked

    Marking relied on content claims instead of provenance.

  5. 05
    Model mismatch

    A new model interprets the representation differently.

Worked Scenario

Synthetic example. A support assistant summarizes a ticket and can draft and send replies. Retrieval adds a customer-provided document whose text contains synthetic instruction-like content asking to forward internal notes externally. No payload text is shown here.

Gate-by-gate attribution
GateObservationOutcome
ProvenanceDocument recorded as customer-supplied, externalDetermines that marking applies
Marking policyExternal content in a send-capable workflowDocument marked and placed in a separate context region
ModelMay or may not be influenced by the embedded textVariable proposal
Authorization / IFCInternal notes cannot flow to an external recipient without the user's actionDeny regardless of marking outcome

In a controlled test, the same synthetic case runs with and without marking on the same model and task, and the rate of influenced proposals is recorded for each. Both numbers are reported, together with benign task quality.

What the Scenario Proves and Does Not Prove

It shows where marking sits, how its effect can be measured against a matched control, and that the harmful effect is prevented by authorization and flow control. It does not show that marking prevents influence in general, that results carry over to other models or content, or that marked content became trustworthy.

Telemetry and Evidence

Record per request

  • Content items marked, with provenance reference
  • Marking method, version and policy version
  • Link from marked representation to unmarked source
  • Verification that marks were present in the final context
  • Items that could not be marked and why
  • Correlation ID linking context, proposal and enforcement decision

Incident Response

When marking fails or is bypassed

  • Preserve the raw and the marked representations together with the transformation version
  • Identify where marks or role separation were lost, altered or forged in the chain
  • Trace affected requests and derived artifacts through provenance
  • Contain the faulty transformation path, for example by routing affected content to a restricted workflow
  • Check whether downstream authorization and flow control held
  • After remediation, regression-test the same transformation chain with synthetic cases

Controlled Testing

Use synthetic markers in bounded, labelled test sets. Compare matched marked and unmarked runs on the same model, task and content. Test every transformation path where marks can be lost. Re-run tests when models, marking methods or context assembly change. Do not maintain a reusable attack payload library.

Metrics

Each measure keeps its own denominator. There is no composite score. Marking detects nothing, so no detection metric is attributed to it.

Marking metrics with explicit denominators
MeasureNumeratorDenominator
Marking coverage rateExternal items marked as policy requiresExternal items requiring marking
Model-visible marking preservation rateMarked items whose marks are intact in the final contextMarked items
Boundary / role preservation rateItems keeping role separation across a transformationItems passing through that transformation
Influence rate, markedMarked test cases producing an influenced proposalMarked test cases run
Influence rate, matched unmarked controlUnmarked test cases producing an influenced proposalMatched unmarked test cases run
Downstream unauthorized action rate (full stack)Test cases with a disallowed effectTest cases executed end to end
Marking failure / unknown representation rateItems entering context with failed or unknown markingItems requiring marking
Transformation integrity rateMarked outputs matching the expected transformationMarked outputs checked
Token and latency overheadDistribution of added tokens and timeMarked requests
Benign task utilityBenign tasks completed acceptablyBenign tasks attempted

Common Mistakes

Failure patterns
  1. 01
    Marking as permission

    Treating marked content as safe or letting it lower a label.

  2. 02
    Content-chosen markers

    Letting content claims decide how it is marked.

  3. 03
    Skipping on clean scan

    Omitting required marking because inspection raised no signal.

  4. 04
    Unverified marks

    Assuming marks survived later transformations.

  5. 05
    Single layer

    Relying on marking without authorization and flow control.

Standards, Research and Vendor Context

Sources referenced

OWASP
LLM01:2026 Prompt Injection
Microsoft Research
Defending Against Indirect Prompt Injection Attacks With Spotlighting (research)
Microsoft
Defend against indirect prompt injection attacks (vendor guidance), How Microsoft defends against indirect prompt injection attacks (vendor blog), Prompt Shields in Microsoft Foundry: Spotlighting (preview) (product documentation)

On source use: OWASP LLM01:2026 is the current classification for prompt injection. Microsoft Research introduced spotlighting as a family of prompt engineering techniques that use transformations of input to give a continuous signal of its provenance, and reported it as an effective defense with limited impact on task quality in its evaluated GPT-family setups; those findings are specific to the configurations tested. Microsoft Learn's guidance on indirect prompt injection is vendor guidance that lists spotlighting, using data marking and metaprompting, as one layer in a defense-in-depth strategy. Microsoft's security response blog describes delimiting, datamarking and encoding modes at a conceptual level. Microsoft Foundry documents a product feature named Spotlighting (preview) that transforms document content for document-attack protection, with documented token cost, API scope and default-off behavior; that is one product's current behavior, not a description of the general technique.

Frequently Asked Questions

Does marking make external content trusted?

No. A system component applied the mark, but the content stays untrusted and variable.

Is a delimiter a security boundary?

No. It is a signal to the model. Enforcement belongs to authorization and flow control.

Will a marked prompt stop injection?

It may reduce influence. It cannot guarantee the model ignores embedded instructions.

Who decides what gets marked?

A policy based on authoritative provenance, never on labels inside the content.

Can content fake its own marker?

It may try. Markers should be chosen and verified by the system, and marking should never be treated as authorization.

Should marking be skipped if inspection finds nothing?

No. A clean inspection result does not mean safe, so required marking still applies.

Is every structured prompt Spotlighting?

No. Spotlighting is Microsoft Research's name for a specific family of techniques within the broader idea of role marking.

Does Foundry's Spotlighting preview describe the technique in general?

No. It documents one product's current preview behavior and limits.

Do marks survive summarization?

Often not. Re-mark derived content based on the provenance of its inputs.

How should effectiveness be measured?

Against a matched unmarked control on the same model and task, reporting both rates and benign utility separately.

References

  1. OWASP GenAI LLM Top 10 2026 (LLM01:2026 Prompt Injection)OWASP GenAI Security Project · GuidanceReviewed 2026-09-25
  2. Defending Against Indirect Prompt Injection Attacks With SpotlightingMicrosoft Research · Research publication · 2024Reviewed 2026-09-25
  3. Defending Against Indirect Prompt Injection Attacks With Spotlighting (arXiv:2403.14720)arXiv · Research paper · 2024-03Reviewed 2026-09-25
  4. Defend against indirect prompt injection attacksMicrosoft Learn · GuidanceReviewed 2026-09-25
  5. How Microsoft defends against indirect prompt injection attacksMicrosoft Security Response Center · Guidance · 2025-07Reviewed 2026-09-25
  6. Prompt Shields in Microsoft FoundryMicrosoft Learn · Technical documentationReviewed 2026-09-25