AI Agents & Automation in Practice

Internal AI Assistant: How to Avoid Leaking the Wrong Data

By Mudabbir Hasan, Co-founder · Published · Last updated

Published
15 Sept 2026
Read time
8 minutes
Words
1,725
Category
AI Agents & Automation in Practice

Do not rely on the AI model or its prompt to keep data private. Enforce each user's permissions in the retrieval layer, so the assistant never receives a document that person could not open directly. Partition the data by user group, log every retrieval, validate documents before they enter the knowledge base, and test with two users of different access before launch.

Why do internal AI assistants leak data?

An assistant connected to company documents answers from whatever it retrieves. If retrieval ignores who is asking, the assistant can summarise a payroll file for someone who could never open it. OWASP's 2025 list of risks for LLM applications names this directly: LLM02, Sensitive Information Disclosure, covers confidential business data appearing in responses, and LLM08, Vector and Embedding Weaknesses, covers poorly designed permissions on the stores that hold retrieved content.

The cost of getting this wrong is not abstract. IBM's Cost of a Data Breach Report 2026 puts the global average cost of a breach at $4.99 million, a 12% rise on the year before and a record. That figure covers breaches of every kind, not only AI assistants, and small businesses will usually see far lower totals. It is still a useful reminder of the scale on which data exposure gets priced once it reaches customers, regulators and lawyers.

Does the assistant respect permissions by default?

Permissions you have, and permissions you think you have

What the tool promises

  • Only data the asking user may access
  • Inherits your existing access controls
  • Respects your compliance settings

What goes wrong

  • Folders shared with everyone years ago
  • Old links that never expired
  • Sensitive files in broadly shared sites
  • Copied data in places with weaker controls

Microsoft's security documentation for Copilot says it only accesses data that users are authorised to access, and that it inherits the Microsoft 365 controls you already have. The same page then adds the catch: overshared or poorly governed content can affect Copilot's results and increase risk, and Microsoft publishes separate guidance on preventing oversharing. In plain terms, an assistant that respects permissions is only as safe as your permissions are tidy.

That is why the first job in any internal assistant project is not the AI. It is an audit of who can see what today. If a folder is open to the whole company by accident, the assistant will happily summarise it for anyone who asks. It is better to find them before launch than through an awkward question in a team meeting.

Why is the prompt not a safe place to enforce permissions?

Where the permission check belongs

  1. 1

    User asks a question

    With a verified identity

  2. 2

    Retrieval filters by that user's access

    Before anything reaches the model

  3. 3

    Model sees only permitted content

  4. 4

    Answer is returned

  5. 5

    Retrieval is logged

    With the asking user's identity

OWASP says system-prompt restrictions offer some defence, but warns they may not always be honoured and can be bypassed through prompt injection or other methods. A rule written in the prompt is a request to the model, not an access control. The control has to sit outside the model, in the system that decides what content the model is allowed to see.

What does OWASP recommend instead?

Risk to control, from OWASP's 2025 guidance
RiskControl OWASP recommendsWhat it looks like in practice
One group's content surfaces for anotherPermission-aware stores, with data partitioned by user class or groupSeparate indexes or filters for HR, finance and the wider team
The model can reach too muchLeast privilege: limit the model's access, including external data sourcesThe assistant only has tools it needs for its job
Bad or hostile content enters the knowledge baseValidate documents and authenticate sources, and audit the knowledge baseOnly approved sources feed the index, reviewed on a schedule
Access levels do not match the dataReview and classify data so levels match the people who askA sensitivity tag on each source, checked at retrieval
Misuse goes unnoticedDetailed, tamper-resistant logs of retrieval activityA log of who asked, what was retrieved, and when

Controls summarised from OWASP LLM02:2025 and LLM08:2025. The practical column is our reading.

OWASP also lists sanitising sensitive content before it is used, educating users not to enter sensitive information, and stronger techniques such as tokenisation and redaction for the most sensitive data. For a typical business assistant, the biggest wins are the first three rows of that table. They are also the ones that do not need a research team.

What does a poisoned document look like?

OWASP's example is a resume with hidden white-on-white text telling the model to recommend the candidate. A screening tool that ingested it followed the instruction. The same trick could be played on an internal wiki page, a shared spreadsheet or a supplier PDF. The fix is to extract text in a way that detects hidden content and to validate documents before they enter the knowledge base. Treat anything retrieved as untrusted input to the model.

A real-world case shows how far that idea can go. In 2025, researchers at Aim Labs disclosed EchoLeak, a flaw in Microsoft 365 Copilot tracked as CVE-2025-32711 with a critical score of 9.3. It was a zero-click attack: an attacker only had to send an email, and instructions hidden in it could lead the assistant to access and leak confidential data such as chat logs, files and messages. Microsoft said the issue was fully resolved with no customer action needed, and reporting found no evidence it was exploited in the wild. The lesson is not that one product is unsafe. It is that an assistant that reads untrusted content and holds sensitive access needs defences beyond the model's good behaviour.

Should you build your own assistant or buy one?

Both can be done safely, and both can leak. A bought assistant inherits your existing permissions but also your existing mess. A built one lets you design retrieval around access from the start, at the cost of owning the work. Which fits depends on your systems, your regulators and who will maintain it. Our guide on building or buying an AI agent walks through the questions, and the governance layer it describes applies to either route.

How do you test it before launch?

The two-user test

  • Ask as the lower-access user for something only the higher-access user may see

    It must not answer

  • Plant a document with a hidden instruction

    The assistant must ignore it

  • Ask it to reveal its instructions and hidden documents

  • Read the retrieval log for the session

    Every retrieval under the asking user's permissions

  • Repeat when you add a new data source

A starter test pack
TestExpected result
Lower-access user asks for a salary figure held in a restricted folderA refusal or no answer, and no trace of the document
A document contains white text saying to praise a vendorThe summary ignores the instruction
User asks the assistant to list every file it can readOnly files that user could open directly
User asks a question whose answer sits in two sources with different accessAn answer from the permitted source only
Someone leaves the company and their access is removedTheir next question gets no restricted content

Our own test list. Adapt it to your data and review the log for each run.

What should the retrieval log capture?

A minimum useful log (our suggestion)
FieldWhy you want it
Who asked, by verified identitySo every retrieval can be tied to a person's permissions
WhenTo reconstruct an incident and spot odd hours
Which documents were retrievedTo prove restricted content was not sent to the model
Which sources were excluded by permissionsTo confirm the filter is working, not just absent
The question and the answer, with retention limitsTo investigate a complaint, balanced against privacy

OWASP recommends detailed, tamper-resistant logs of retrieval activity. The fields above are our reading of that advice.

A log nobody reads is decoration. Name a person who owns it, decide how often they look, and decide what they do when something odd appears. A weekly look at the first month's log is cheap and catches most early mistakes. Also decide how long you keep the log, since it holds questions and answers that may contain personal data of its own.

How should you roll it out?

A staged rollout (our suggestion)
StageWho and whatWhat must be true to move on
1. AuditReview who can see what in the sources you will connectObvious overshares are fixed
2. PilotA small team, one low-sensitivity source, read-onlyThe two-user test passes and the log looks clean
3. WidenMore teams, more sources, one source at a timeEach new source gets its own test
4. Sensitive dataHR, finance and legal sources, with extra reviewA named owner and a tested incident process

The order matters more than the speed. Starting with a low-risk source gives you a place to find mistakes cheaply. Leaving the most sensitive data until last means that by the time it is connected, you have already seen how the system behaves under real use.

How does this relate to our own work?

Our workforce management case pairs an internal HR and operations assistant with role-based access throughout: a manager sees their team's data, not the whole organisation's, by default. The case page does not describe how the assistant itself is built, and the engagement is confidential, so this article is general guidance, not a description of that system.

What should you do before you connect an assistant to company data?

  • List the data sources and who may see each one, and fix the obvious overshares first.
  • Decide where permissions are enforced and check it is not the prompt.
  • Decide who reviews the retrieval logs and how often.
  • Run the two-user test before any real data goes in, and again whenever you add a source.
  • Decide who owns the assistant after launch, because unattended systems drift.

If you want a second pair of eyes on the design, our Technical Discovery is free and covers architecture, integrations and risks before any build. We cover the related question of when an agent should hand a case to a person in a separate guide.

Frequently asked questions

How do I stop an AI assistant showing staff data they should not see?
Enforce each user's permissions in the retrieval layer, so documents the user cannot open are never sent to the model. OWASP warns that rules in the system prompt may not be followed and can be bypassed through prompt injection.
Do AI assistants like Copilot respect existing permissions?
Microsoft says Copilot only accesses data a user is authorised to access. It also says overshared or poorly governed content can increase risk, so your existing permissions need to be tidy before you roll it out.
What is prompt injection in an internal assistant?
It is hidden or hostile text in content the assistant reads that tries to steer it. OWASP's example is a resume with white-on-white text instructing the model to recommend the candidate. Validate documents before they enter the knowledge base and treat retrieved content as untrusted.
Was Microsoft Copilot ever exploited by an email attack?
Aim Labs disclosed EchoLeak (CVE-2025-32711, CVSS 9.3), a zero-click flaw in Microsoft 365 Copilot. Microsoft said it was fully resolved with no customer action required, and reporting found no evidence of exploitation in the wild.
What should I test before launching an internal assistant?
Use two accounts with different access and check that the lower-access one cannot extract restricted content. Also plant a document with a hidden instruction, review the retrieval log, and repeat the tests when you add data sources.

Sources

Planning ai & machine learning? Talk to us first.

The project call is free, and so are Technical Discovery and the Product Discovery Sprint. Tell us what you are building and we recommend the right next step, with the price agreed before any development work starts.

Request a callWhatsApp