← Back to articles
ragai securityai assistantsdata leakageaccess control

AI assistant on your company documents: how to stop data leaks

By · November 3, 2026 · 5 min read

Updated:

An AI assistant connected to company documents (RAG) can tell anyone what it reads. Permissions have to be applied at retrieval, before the model sees the chunk, not by redacting the answer. Includes an interactive exhibit.

File JG · DocumentBack to articles

AI assistant on your company documents: how to stop data leaks

Type
Article
Author
Date
Updated
Reading time
5 min read
Subjects
rag, ai security, ai assistants, data leakage, access control

Summary

An AI assistant connected to company documents (RAG) can tell anyone what it reads. Permissions have to be applied at retrieval, before the model sees the chunk, not by redacting the answer. Includes an interactive exhibit.

Connecting an AI assistant to your company's documents is one of the fastest ways to show value with AI. You ask how a machine is calibrated, what a supplier contract says or when a piece of equipment was last serviced, and it answers in seconds, citing the document. The problem shows up the day someone asks something they shouldn't know, and the assistant knows it.

When I build one of these assistants, the first question I ask isn't which model to use. It's who can read each document, and at what point that gets checked.

◢How does an AI assistant over documents (RAG) work?

The technique is called RAG, retrieval-augmented generation. The assistant doesn't learn your documents. It splits them into chunks, stores each chunk in a special search index (a vector database) and, every time someone asks, it looks up the chunks most similar to the question and hands them to the model along with it. The model writes the answer from what it has just read.

That middle step is the key to everything that follows: whatever enters the model's context is something the model can repeat.

◢Why can an assistant over documents leak data?

Because the search index doesn't know who is asking unless you tell it. If the public manual, internal reports and payroll all go into the same index, and retrieval doesn't filter by user, the intern and the CFO get the same chunks. The model will answer both with whatever it finds.

OWASP, the reference in application security, lists this as a weakness specific to RAG systems in its risks for language models: inadequate or misaligned access controls1 let people reach sensitive information through the stored chunks, and when several groups share the same database there is a risk of leakage between users.

No attack is needed. A normal question from someone without permission is enough.

◢Redact the answer or filter the search: try it yourself

There are two ways to apply a permission. The tempting one is to let the assistant read everything and redact afterwards what the user isn't allowed to see. The right one is for the search to never hand the model the chunks that user can't read.

In the exhibit below the question is always the same. Change the level of the person asking and where the permission is applied, and watch the list of chunks: those are the ones that reach the model.

Interactive exhibitWhat each level sees

An AI assistant answers from the company's documents (RAG). The question is the same; what changes is who asks and where the permission is applied. Fictional data.

Who is asking
Permission applied by
Question

Who signed off the last check of the line 2 brake tester, and what tolerance is it calibrated to?

Assistant's answer

The last check of the line 2 brake tester was on October 14. It was signed off by technician B. It's calibrated to a tolerance of ±2%, according to manual MT-23, chapter 4.

In case it helps: it's the same night-shift colleague who opened the September incident.

Leak by paraphrase. The name is redacted, but the fragment was in the context and the model describes it in other words.

Fragments the model reads
  • Public · in the contextManual MT-23, ch. 4. Brake tester calibration procedure.
  • Internal · in the contextInspection log. Content restricted to level internal.
  • Confidential · in the contextSign-off sheet. Content restricted to level confidential.
Finding: if a fragment gets into the context, the model can tell it in other words

With the permission applied at the end, the name is blacked out, but the model has already read the chunk. If it lets a hint slip through a paraphrase ("the night-shift colleague"), the redaction misses it, because it doesn't match the text that had to be hidden. With the permission applied at retrieval, that chunk never arrives and there is nothing left to slip out.

◢Is it enough to tell the assistant not to reveal confidential data?

No. An instruction like "don't reveal confidential information" is a request to the model, not a control. It can fail through a slip by the model itself and, above all, it can be bypassed by text crafted for that purpose, which is exactly what indirect prompt injection does. Any data that sits in the context should be treated as seen.

Security has to live outside the model, in the code that decides which chunks it receives. It's the same idea as with AI agents with too many permissions: the model should only have at hand what it needs for that person and that task.

◢What if I use Copilot or a commercial assistant?

Some commercial assistants already apply permissions at retrieval, and it's worth asking whether yours does. Microsoft, for example, explains that Copilot only surfaces the data each user has permission to view2 and reminds you that SharePoint and other service permissions need to be set correctly.

That moves the problem somewhere else: if half your staff can open the payroll folder because someone shared it with "everyone in the organisation" years ago, the assistant will respect that wrong permission. The risk used to be that someone would stumble on that folder. Now they only have to ask. So before switching on any assistant over documents, a permissions clean-up comes first.

◢What to do before connecting an assistant to your documents

If you're going to build or buy one, these are the questions I would ask:

  • ▹Does each chunk store who can read it? The permission has to travel with the piece of document, not stay behind on the original folder.
  • ▹Does retrieval filter by the user's real identity before anything is passed to the model? If the answer is "we filter at the end", that's the bad option from the exhibit.
  • ▹Are there separate indexes for what is truly sensitive? HR, management and customer data shouldn't share a search index with the onboarding handbook.
  • ▹Are permissions updated when someone changes role or leaves? An index copied once and never synced keeps access that no longer exists.
  • ▹Is there a log of what each user asked and which chunks they received? Without it there's no way to investigate a leak.

On the staff side, everyone should understand what the assistant sees and why they shouldn't upload internal documents to external AI tools on their own. I wrote a guide on what not to paste into ChatGPT.

◢A simple test before going live

Create a test user with the lowest access level and ask the assistant about things that user shouldn't know: a salary, an incident with a customer, the name of whoever signed something. Ask directly and also sideways ("who usually handles...?"). If any answer gives something away, the permission is in the wrong place.

If you want your team to understand these risks before they start using AI with company data, that's exactly what I cover in the AI training for teams.

Related documents

  1. News

    Crédit Mutuel Arkéa cyberattack: attackers came in through a vendor

    French bank Crédit Mutuel Arkéa suffered an attack that allowed fraudulent transfers from its own account. The attackers got in through a service provider's platform. What we know, what we don't and what to learn.

  2. Article

    Device code phishing: what it is and how to stop it

    Device code phishing tricks the victim into typing a code generated by the attacker into Microsoft’s real sign-in page. That gives the attacker access to their Microsoft 365 account without a password and without two-step verification getting in the way. Blocking that sign-in flow stops it.

  3. News

    Claude Code leaks keys on GitHub: the settings.local.json problem

    Claude Code's "don't ask again" option can save passwords and API keys in .claude/settings.local.json. Apiiro found 1,122 public copies on GitHub with secrets inside. What we know and what to do.

End of documentBack to articles