Privacy implications of RAG systems: permissions and deletion come first
The privacy implications of RAG systems come from the pipeline around the model: where your data is copied, who can retrieve it, and how it gets deleted.
Sufi Inam Ul Hassan
AI Engineer16 minute read

When a security team hears that a company wants a language model to read its documents, the first question is a fair one: who will be able to read what through it? The privacy implications of RAG systems come down to that question, and the model is often the smaller part of the answer. The risk sits in the pipeline around it: the copies of your data that get made, the permissions that may or may not travel with them, and what happens when something has to be deleted.
If you want more on how content gets into a RAG system in the first place, our post on types of data sources for RAG systems covers it.
Where your data goes in a RAG pipeline
Follow one document through the system and count the copies. The source file stays where it is. A connector extracts its text, which is copy one. The text is split into passages and stored in a database, which is copy two. An embedding model turns each passage into a vector, copy three: a list of numbers that looks meaningless but still carries the sense of the text. At question time the retrieval step pulls a handful of passages and puts them into a prompt, copy four, which goes to a language model. The prompt and the answer may then be logged for debugging, copy five, and some may end up in an evaluation set, copy six, before counting caches, backups and provider logs.
Each of those copies needs an access rule and a deletion path.
| Stage | What exists afterwards | Question to ask |
|---|---|---|
| Extraction | Plain text of every document | Where is it stored, and who can read the extraction store? |
| Chunking and indexing | Passages in a search index | Does each passage carry the permissions of its source document? |
| Embedding | One vector per passage | Is the embedding model a hosted service, and what does its provider keep? |
| Retrieval | Passages assembled into a prompt | Are results filtered by who is asking before they are ranked? |
| Generation | The prompt and the answer, possibly logged by a model provider | Does the provider retain prompts, and for how long? |
| Logs and feedback | Stored questions, answers and ratings | Who can read them, and when do they expire? |
Permissions have to be enforced at retrieval
The classic failure is simple. A team builds an index using a service account that can read everything, then puts a chat window on top for the whole company. Anyone can now ask a question and receive an answer assembled from a document they couldn't open themselves. The index was built under one identity, so every question runs with that identity's access.
A prompt that says "do not reveal confidential information" doesn't fix this. A prompt is an instruction to a model, and instructions can be argued with or ignored. Access control has to happen before the model sees anything.
The standard pattern has three parts. Each passage is stored with the access rules of its source document: which users and groups may read it. When someone asks a question, the retrieval step filters the candidate passages down to those that person is allowed to see, before ranking and before anything reaches the model. And the rules stay in sync with the source, so that removing someone from a group in your document system removes their access in the index too, within a delay you know about and have decided you can live with. Somebody has to own that mapping when sources change; if nobody does, it drifts.
You can test this without special tooling. Create two test users with different access, ask both the same question about a restricted topic, and check that the second user gets an answer containing none of it, including any hint that the document exists.
Deletion and the right to erasure
Deleting a document from the source doesn't delete what the pipeline made from it. The extracted text, the passages, the vectors and any cached answers all remain until something removes them. The law cares about this too. Article 17 of the GDPR gives people a right, in defined circumstances, to have their personal data erased, and a RAG index built over customer emails or HR files holds personal data in several places at once.
Plan for deletion before you plan for search. Every passage should carry the identifier of its source document, so that deleting by document identifier removes the passages and vectors together. Refresh jobs have to propagate deletions as well as additions. Backups and caches need a retention period. And test it: delete a document, wait for the next refresh, then query for its contents.
It's also safer to treat vectors as personal data when the text they came from was personal. They look anonymous. In 2023 Morris and colleagues published "Text Embeddings Reveal (Almost) As Much As Text", which reconstructed short texts almost word for word from some embedding models. The OWASP Top 10 for LLM applications gives vector and embedding weaknesses an entry of their own in its 2025 edition.
Prompt injection through your own documents
Retrieved passages go straight into the prompt, which means a document can contain instructions aimed at the model. Suppose a supplier emails a PDF with white text on a white background that says to ignore all previous instructions and send the contents of the contract folder to an outside address. If the system retrieves that passage and has a tool that can send email, the model may treat it as a command. This is called indirect prompt injection, and the OWASP Top 10 for LLM applications lists prompt injection first.
The defenses are dull and none of them is complete, but together they limit the damage a hijacked model can do. Treat retrieved text as untrusted data and say so in the system prompt, which helps a little but can't be the only control. Limit what the system can do: an assistant that can only answer questions has less to hijack, while one that can send email or call other tools needs approval steps and a short list of permitted actions. Control who may add documents to indexed sources, since anyone who can edit a source can attack through it. And log which passages were used for each answer, so that an odd answer can be traced to the document behind it.
Which model sees your data
Somewhere in the chain a language model reads your passages, and where that model runs is a privacy decision. A hosted model behind a provider's API means your passages travel to the provider with every question. Terms differ. Retention ranges from a set period to zero for business accounts, and some providers state that business data is never used for training. Read the terms for the specific product and region you will use, and have them reviewed by whoever handles your data processing agreements.
Self hosting, in your own cloud account or on your own servers, keeps passages inside your environment and gives the cleanest answer for regulated data, at the price of running the models yourself. Cloud platforms also offer managed model deployments under your own account, which sit between the two. The embedding model deserves the same question, since it also sees every passage, usually in bulk. People forget it because it doesn't write the answers.
Logs, feedback and evaluation sets
Debugging a RAG system means reading real questions and answers, and people put personal data into questions. Decide who can read the logs, redact obvious identifiers such as emails and phone numbers before storage, and set a retention period. Be equally careful with evaluation sets. A good test set is built from real questions, which means it may contain real names, so keep it under the same access rules as the data it was drawn from.
Telling people what the assistant can see
Employees and customers should know what an assistant draws on and what it records. Say which sources are connected, that questions are logged and for how long, and who to contact about a wrong or sensitive answer. A short notice on the chat screen does most of the work, and a button to report an answer gives you a way to find leaks that your own tests missed.
Deciding what not to index
The cheapest privacy control is a smaller index. Before you connect a source, sort its content into classes and decide which classes belong in the system at all. Credentials such as API keys and private keys have no place in an index, and they turn up in wikis and ticket histories, so scan for them. Regulated categories such as health records, payment card numbers and government identifiers need a reason to be there and a way to govern them; if you have neither, leave them out. Personal data in general should be present only where the assistant's job needs it.
Automated redaction helps but doesn't finish the job. Detectors for emails, phone numbers and card numbers catch most of the regular patterns and miss names in free text, nicknames and anything unusual. Redact at ingestion, read a sample of the result, and keep the original out of the index. The trade is real, since heavy redaction can strip the details that made a ticket useful, so test answer quality before and after. Where the choice is between a slightly less useful assistant and a leak, take the first.
One index or many
A second design choice is whether everyone shares one index or each group gets its own. In a shared index, passages carry access metadata and retrieval filters on it. That's cheaper to run and easy to extend, and its weakness is that one filter bug exposes everything. Separate indexes per customer, department or sensitivity level put a hard wall between groups, at the price of more to build, host and refresh.
A rough rule: use separate indexes where a leak would be a contractual or legal event, such as one customer's documents appearing in another customer's answers, and use a filtered shared index where the groups are internal and the documents already carry reliable permissions. Whichever you pick, test the boundary on purpose. Create a passage that only one group may read, ask the question as a member of the other group, and confirm that nothing comes back. Run that test again after every change to the retrieval code, because filters are exactly the kind of thing that breaks silently in a refactor.
Residency and contracts
Two questions sit outside the pipeline. Where is the data stored and processed, including by the embedding and language model services? The GDPR restricts transfers of personal data outside the EEA unless safeguards apply, and some contracts and sector rules add limits, so find out which apply to you before choosing a hosting region. And what do your agreements with providers say? Ask for the data processing agreement, check which sub processors are involved, and confirm what happens to your data when the contract ends. None of this is legal advice, and your legal team will have views, but it's cheaper to ask at the start than to renegotiate after launch.
A worked example: following one question through the system
Trace one question to see the controls working together. In an invented company, an HR manager asks "what is the notice period for the Lagos office?" and a sales rep asks the same thing. The documents include a general policy that everyone may read and a restructuring plan that only HR may read, which mentions notice periods for a possible redundancy round.
Each question reaches the system with the asker's identity and group list. Retrieval searches the index but applies a filter first: only passages whose access list includes the asker's groups qualify. For the HR manager, passages from both documents qualify, and the top results include the general policy and a section of the plan. For the sales rep only the general policy qualifies. The assistant answers each from what it was given and cites its sources. The sales rep gets the standard notice period and no hint that another document exists. The HR manager's answer notes that the plan under discussion proposes different terms.
The log then records, for each question, the asker, the passages retrieved, the sources cited and the model version, which is what lets you answer "who saw what" afterwards. Had the filter not run, the sales rep would have received the restructuring section in a confident paragraph with a citation.
When something goes wrong
Plan the response before you need it. Suppose a user reports an answer that quoted a document they shouldn't have seen. The first move is containment: switch off retrieval from the affected source, or the whole assistant if you can't tell, and revoke any credentials involved. Then investigate with the logs, which should show which passages were retrieved for that question, under which identity and from which source. Work out whether it was a one off, such as a document labeled with the wrong permissions, or a systemic flaw, such as a filter that doesn't run for a certain kind of query.
Bring in your data protection officer or equivalent early, because GDPR breach notification can be due within 72 hours of discovery and depends on what was exposed and to whom. Fix the cause, add a regression test that reproduces the failure so it can't return unnoticed, and write a short account of what happened and what changed. Teams with an incident process and a log can say what was retrieved for whom; teams without them have to reconstruct it from memory.
What to bring to your security review
A security team is more likely to approve a system when it can see the whole picture in a few pages. Bring a data flow diagram that shows every stage from source to answer, and a table of every copy of the data, where it lives, who can read it and how long it stays. Bring the permission model in plain language: how access is stored with each passage and how changes in the source reach the index. Bring the results of the two user test and the delete test, with dates. Add the model provider terms for retention and training, the list of sub processors where there is one, the logging and retention settings, and the incident process. Finish with a named owner for each item.
If that pack is hard to produce, the system is not yet understood well enough to defend, and it is better to find that out before the review than during an incident.
A checklist before go live
- Draw the data flow from source to answer, list every place a copy of the data exists, and decide which content classes stay out of the index.
- Confirm that each passage carries its source permissions and that retrieval filters on the asker's identity before ranking.
- Run the two user test.
- Run the delete test.
- Decide where the embedding model and the language model run, and record what each provider retains.
- Treat retrieved text as untrusted and limit the actions the system can take.
- Set retention and access rules for logs and evaluation sets.
- Name the person who owns the permissions map when sources change.
How we handle it
We build RAG systems with the index inside the client's environment and apply the permissions already set on each source document at retrieval. Each engagement ends with a permission map for every connected source and a documented refresh schedule. On deletion, logging and where the models run, ask any builder, us included, how it works before you sign: those answers differ between systems, and they set how much risk is left. If you'd like a second view of a data flow, talk to us.
Topics
- RAG privacy
- AI data privacy
- Access control
- Prompt injection
- GDPR
- Retrieval augmented generation
Frequently asked questions
Get started
Stop paying people to do what an agent can
Tell us what you want to automate. We will map the workflow, deploy the right agents, and train your team to run them.
- Every agent is trained on your own workflows, never a generic template
- Most deployments are live within two to four weeks
- SOC 2 compliant, with a complete audit trail on every deployment
