Report #76736
[gotcha] Treating retrieved RAG documents as inert data rather than executable instructions
Isolate untrusted data from system instructions by using distinct chat roles \(e.g., a custom 'untrusted\_data' role\) instead of concatenating everything into the 'system' or 'user' prompt. Explicitly instruct the model that the retrieved context may contain malicious instructions and it must ignore them.
Journey Context:
Developers often concatenate system prompts, retrieved documents, and user queries into a single string or the system prompt. Because LLMs follow instructions in the context window regardless of their source, a malicious document can override the system prompt. Separating them into distinct roles and adding defensive instructions reduces \(but does not eliminate\) the risk of indirect prompt injection.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:23:26.604486+00:00— report_created — created