Skip to content
Enterprise Tech Logic

Independent analysis for technology leaders

Data & AI

Prompt injection in retrieval: decide what a document is allowed to influence

A retrieved document can contain both useful evidence and hostile instructions. Keep its content from gaining authority over tools and data access.

By Enterprise Tech Logic

Enterprise technology, security and IT leadership

· 4 min read

Red illuminated circuit board

At a glance

  • Retrieved content is evidence, not permission.
  • Limit actions in application code and destination systems.
  • Test hostile documents alongside ordinary difficult questions.

A procurement assistant retrieves a supplier document to answer a legitimate question. The document also contains instructions telling the assistant to change its behaviour. The retrieval system has found relevant material; relevance has not made every sentence trustworthy.

This is the security boundary behind indirect prompt injection. For the enterprise AI lead, the design question is what a retrieved document is allowed to influence. It may inform an answer without being allowed to authorise a tool call, select a new data destination or expand the user’s access.

Retrieval quality and instruction authority are different problems

OWASP’s prompt-injection guidance identifies indirect injection through external material such as files and websites. It also explains that retrieval-augmented generation and fine-tuning do not fully remove the vulnerability. Better search can put the right document in context while also putting its malicious instructions in front of the model.

A source label helps the system and reader understand provenance. It does not prove that the model will always treat the labelled text only as evidence. A document can contain legitimate procedural instructions that the user wants summarised, misleading claims that require scrutiny and hostile instructions aimed at the assistant. The application needs a policy for those different roles.

Consider a hypothetical assistant comparing supplier proposals. The supplier may describe its own service and prices. It should not be able to instruct the assistant to ignore competing offers or send the buyer’s internal budget to another address. The boundary follows the buyer’s authorised task, not the document’s confidence or formatting.

Access control matters here too. A user may be entitled to read a document without being entitled to take every action it describes. Preserving document permissions is necessary, but it is not a complete defence against behaviour changes induced by content.

Reduce the consequence outside the model

Keep sensitive action checks in the application and destination service. A model proposing an operation should not be the only component deciding whether it is allowed. Limit the available tools, credentials and data destinations to those needed for the task, and validate parameters before execution.

For a read-only comparison assistant, an email-sending tool may be unnecessary. Removing that authority eliminates one consequence rather than asking the model to remember not to use it. Where a workflow genuinely requires a consequential action, require a specific approval at the point where it can still prevent the action.

The approval should show the intended target and meaningful changes. An instruction hidden in retrieved content must not count as the user’s consent. If the workflow changes the proposed recipient or content after approval, evaluate whether the original approval still applies.

Also control how the answer is rendered. A generated link, image or other active element can initiate a request or invite the user to disclose information. The interface should treat model output as untrusted content to validate and display, rather than as arbitrary executable application markup.

These controls do not establish that the model can never be influenced. They make an influence attempt less able to cross into a consequential system action.

Evaluate the boundary with evidence

Build a test collection containing ordinary relevant documents, conflicting legitimate sources and deliberately hostile material. Use authorised test data. Include attempts to redirect an answer, request unrelated information and induce an operation outside the task. The expected outcome should specify both answer behaviour and permitted system actions.

Measure false alarms as well as failures. A defence that rejects every document containing instructions may be unusable for a policy-search service. The task is to preserve useful reading while preventing source content from becoming authority.

Capture which material was retrieved, which action was proposed and which control allowed or refused it. Review only the sensitive content necessary for the investigation, with an appropriate retention policy. Re-run representative tests after changes to retrieval, prompts, models or available tools.

The design of enterprise AI search should therefore include permission enforcement, source freshness and instruction boundaries together. Approve the system against the harm it can cause and the controls demonstrated, not a promise that its prompt tells it to ignore malicious text.

Your next step

AI agent evaluation: make the purchase request fail halfway

Test hostile documents alongside ordinary difficult questions.

Read the guide

Keep reading

Related insights

Data & AI · Practical guide

Changing an embedding model is a search migration

Replacing an embedding model changes the representation behind search. Rebuild and evaluate the retrieval path before switching users.

Enterprise Tech Logic ·