In a chat interface a person decides what to paste. In a retrieval pipeline the system decides, on every query, and it does not know what it is looking at. That single change is where most of these mistakes come from.
1. Embedding the raw document
The obvious step is to chunk the corpus and embed it. If your embedding model is an API, every chunk has been transmitted — the whole corpus, at once, before anybody asked a question.
Worse, the vector store now holds representations derived from text containing customer names. Embeddings are not encryption; work on inversion has shown that meaningful content can be recovered from them. Treat the vector store as containing what it was built from, because for risk purposes it does.
2. Chunks that cross a permission boundary
Retrieval is similarity, not authorisation. Unless you filter by the requesting user's permissions at query time, the pipeline will cheerfully return a chunk from a document that user cannot open — and the model will summarise it for them.
Similarity does not know who is asking.
This is the most common serious bug in internal RAG, and it fails quietly: nobody sees an access-denied error, they see a helpful answer containing something they should not have.
3. Redacting the question and not the context
Teams that have thought about privacy often redact the user's query. The retrieved chunks go into the same prompt unredacted, and they are the larger payload by a wide margin.
If the corpus contains identifying detail, redaction has to happen either at ingestion — before embedding — or at assembly, after retrieval and before the model. Both work; at ingestion is cheaper per query and coarser, at assembly is more precise and runs every time.
4. The traces
Observability tooling captures prompts, and a RAG prompt is your documents. A team can build a careful pipeline and then ship every retrieved chunk to a third-party tracing service, in full, with a user id attached.
- •Check what your tracing captures by default. Usually: everything.
- •Check your response cache. Keyed on the original text, it holds the original text.
- •Check your error reporting. A failed request often attaches the payload.
- •Check retries and dead-letter queues, which store the whole request by design.
What a safe shape looks like
- •Filter by permission at query time, not after retrieval.
- •Decide where redaction happens — ingestion or assembly — and write it down, because the failure mode is each engineer assuming the other layer does it.
- •Treat the vector store as holding the source content, and protect it accordingly.
- •Point your tracing at the redacted prompt, and verify it rather than assuming.
Our API is built for the assembly variant: pass the assembled context through it before the model call, get the stand-ins and a mapping back, and restore the real values in the response.
Try Secure AI free
Frontier AI chat — encrypted by default, with your identity stripped before any request reaches the provider.
Common questions
Do embeddings leak the original text?
Not literally, but research on embedding inversion has recovered substantial content from vectors. For risk assessment, treat a vector store as containing the material it was built from rather than as an anonymised derivative.
Where should redaction happen in a RAG pipeline?
Either at ingestion, before chunks are embedded, or at assembly, after retrieval and before the model call. Ingestion is cheaper per query and coarser; assembly is precise and runs every time. The dangerous answer is “both teams assumed the other one did it”.
Why do retrieval pipelines leak across permissions?
Because retrieval ranks by similarity and knows nothing about who is asking. Without a permission filter applied at query time, a chunk from a document the user cannot open can be retrieved and summarised for them — with no access error anywhere to notice.
What about tracing and logs?
They are the most commonly missed exposure. Tracing tools capture prompts by default, and a RAG prompt is your documents. The same applies to response caches, error reporting and retry queues, all of which store payloads by design.