Technical Guide

Spotlighting and Delimiting Untrusted Content as a Prompt Injection Defense

Spotlighting and delimiting lower the likelihood that a model treats untrusted content as instructions, but they are probabilistic and model-dependent, so they are not a security boundary. Use them as one layer, and rely on deterministic controls outside the model to limit impact: least-privilege permissions, tool-call policy enforcement, human approval for sensitive actions, and audit logging.

How spotlighting and delimiting work

Spotlighting and delimiting mark untrusted content as data before it enters the prompt, so the model is less likely to treat it as instructions. Three techniques are covered here: delimiters, datamarking and encoding.

Three techniques compared

Delimiters, datamarking and encoding all mark content as data. They share the same basic property: their effect is probabilistic.

Prompt-level separation techniques
TechniqueRoleNature of the defense
DelimitersMark content as dataProbabilistic, model-dependent
DatamarkingMark content as dataProbabilistic, model-dependent
EncodingMark content as dataProbabilistic, model-dependent

What they mitigate and where they fail

What they mitigate

These techniques lower the likelihood that a model treats untrusted content as instructions.

Where they fail

Because the defense is probabilistic and model-dependent, it can be bypassed. It should be tested against adaptive attackers, not only static injection sets.

Layered defense for agents that ingest untrusted content

Defense layers and what each one does
LayerWhat it doesWhere it operates
Prompt-level separationDelimiters, datamarking and encoding mark content as data. Probabilistic.Inside the prompt
Least-privilege permissionsLimits what a compromised agent could ever do.Outside the model
Tool-call policy enforcementChecks each action against rules outside the model.Outside the model
Human approvalRequires approval for sensitive actions.Outside the model
Audit loggingRecords requests, decisions and approvals for investigation.Outside the model

Deterministic controls that contain a successful injection

Least-privilege permissions, tool-call policy enforcement, human approval for sensitive actions and audit logging are deterministic controls outside the model. They limit the impact of an injection that gets past prompt-level separation.

Questions to answer before relying on prompt-level separation

  1. Which untrusted sources reach the model, and is each one marked or delimited before it enters the prompt?
  2. Has the defense been tested against adaptive attackers, not only static injection sets?
  3. If an injection succeeds, what is the maximum action the agent can take with its current permissions and tool access?
  4. Are tool calls checked against a deterministic policy outside the model, with human approval for sensitive actions?
  5. Are tool-call requests, policy decisions and approvals logged in a form that supports audit and incident investigation?

Contain the impact of a successful injection

Review how runtime policy enforcement, agent permissions and audit logging apply to the tool calls your agents make.

Explore Runtime Governance