RAG retrieves material at inference time and places it in the model’s context to inform a response. Many implementations use embeddings — numerical representations of content — and vector stores for similarity search, although retrieval can also use other methods.
Security depends on both what enters the knowledge base and what each requester may retrieve. An authorized document can still contain hostile instructions, and relevant search results can include material the requester has no right to access.
Key points
Retrieval authorizationAccess decisions belong in enforced application and retrieval controls. Permissions for documents and retrieved excerpts, tenant boundaries, and permission changes must remain effective before content reaches model context.
Source integrityControlled ingestion, provenance records, restricted write access, and review reduce malicious document insertion. Retrieved text remains untrusted instruction content even when its source is approved.
Store and output protectionIndexes, embeddings, backups, and caches need access controls and isolation. Generated answers and tool calls require validation, while source deletion and access changes need propagation to derived copies.
Important limitationRetrieval can improve relevance without preventing prompt injection, incorrect answers, or disclosure. Embeddings are not anonymization, and output filtering cannot repair unauthorized retrieval that has already exposed content to the model.