RAG Security Fundamentals
Following a document from intake to the answer

Illustrative practitioner walkthroughs based on the attachment

Follow the request

Retrieval-augmented generation, or RAG, lets a language model answer with documents found at the time of the request. In a walkthrough, I’d follow a question from the embedding model, which turns text into numbers, to the vector store and retriever, then check which passages the language model actually recieved.

Ingestion brings documents into the collection, embedding represents their meaning numerically, and similarity search ranks passages before the application adds them to the model’s context. When reviewing a shared drive or wiki feed, I’d trace the document’s author and approval status alongside its embedding, because numerical closeness cannot tell me whether a policy was ever aproved.

Where trust slips

Inference-time poisoning changes the material the model reads when answering, so its behaviour can shift while its trained weights stay the same. In a review, I’d distinguish misleading material already sitting in the knowledge base from content deliberately aimed at influencing retrieval, then look for the same suspect passage appearing across otherwise ordinary reuqests.

Context manipulation happens when a retrieved passage carries false information or text that the model interprets as instructions. If an answer reads smoothly but departs from approved guidance, I’d compare it with the passages that entered the context, since a log that says “relevant documents retrieved” gives me very little to work wtih.

Three cases from the attachment

The Microsoft 365 Copilot example shows how an ordinary query can bring email content into the model’s context. Reviewing that flow, I’d trace what came from the employee’s request and what came from the retrieved email, because an internal source can still carry unverified guidnace.

The ChatGPT plugins example moves the same problem outside the organisation, where a website or third-party API can supply instruction-like text. In a plugin review, I’d follow the external response all the way to the model’s context and check how the application keeps that content separate from system instrutions.

The stale-web-content example shows that retrieval can fail even when nobody is trying to manipulate it. When an assistant quotes a policy after the underlying page has changed, I’d compare the retrieved version with the current source and check when the older copy was supposed to leave the indx.

Put checks along the route

Ingestion validation establishes which sources are approved and tracks who owns each document and when it changed. In a review of an automated feed, I’d start with the approval record and update history, because investigating a questionable passage is easier before it joins the searchable colleciton.

Guardrails can limit how retrieved text enters the prompt, separate it from system instructions, and flag passages that read like commands. When reviewing that layer, I’d treat a pattern match as a cue for scrutiny, since a clean-looking passage can still lead the model in an unexpeced direction.

Monitoring looks for unusual retrieval patterns, repeated use of the same document, and gradual shifts in tone or recommendations, known as output drift. In an operational review, I’d compare answers across time with the documents used to generate them, because fluent wording is a poor substitute for a stable basline.

Layered defence combines intake validation, controls on how retrieved passages are used, and ongoing review of outputs. In a design review, I’d use the attachment’s map, measure, and manage sequence to identify knowledge sources, look at how they affect answers, and check for safeguards at each stage of the retrival pipeline.