Blog/AI Security

Keeping private documents private in RAG and AI search tools

Make sure your AI search and RAG assistants only show each employee the documents they are already allowed to see.

By Sagar Makker · 5 min read · October 2026
In short
AI search can surface salary sheets or board papers to anyone who asks the right question.
Enforce the user's existing permissions at retrieval time, not just at the user interface.
Classify sensitive data, keep permissions in sync, filter outputs and audit what gets shown.
The problem

The new internal assistant can answer questions across Google Drive, SharePoint and the ticketing system. In the first week, a junior employee asks about bonus plans and gets a neat summary of a compensation file shared with leadership only. The document was never opened directly. The AI simply found it, read it and helpfully explained it.

This happens when documents are copied into an AI index without their access rules. The original system knew who could open each file, but the search layer does not. Over-shared folders, old links and stale permissions, which were mostly harmless before, become easy to find once an assistant can search everything in seconds.

Why it happens
01Documents indexed into a vector store without their access control lists
02Permission changes in the source system never reach the AI index
03Over-shared folders and public links that nobody has reviewed in years
04No classification, so payroll, legal and health data are indexed like any other file
How to fix it
1
Enforce permissions at retrieval
Store each document's access rules with its index entries and filter results by the signed-in user's identity before the model sees them. Never rely on the prompt to hide content.
2
Keep permissions in sync
Re-sync access rules from source systems frequently and remove documents from the index when they are deleted or restricted. Test with accounts at different access levels.
3
Classify and exclude sensitive data
Label payroll, HR, legal, health and customer identity documents. Exclude the most sensitive sets from general assistants, or serve them only through a restricted assistant with stronger controls.
4
Filter outputs and audit access
Scan answers for identifiers such as PAN, Aadhaar or bank details, log which documents informed each answer, and review access patterns for unusual queries or volumes.
Where an AI agent helps
Input
Employee questions plus documents from Drive, SharePoint and ticketing tools
Agent does
An agent on XDQ AgentOS retrieves only permitted documents, cites sources and masks identifiers
Human gate
Data owner approves adding new sensitive sources to the index
Outcome
Useful answers without exposing restricted documents
What to measure
Indexed documents with access rules attachedPermission sync lag from source systemsSensitive identifiers caught in outputsOver-shared folders found and fixed
Questions
Can we just tell the AI not to reveal confidential files?

No. Instructions in the prompt are not access control and can be bypassed or ignored. Restricted documents should be filtered out before the model ever receives them, based on the user's real permissions.

Should we clean up file sharing before launching AI search?

Yes. AI search makes existing over-sharing easy to discover. Review public links, all-company folders and old shares for sensitive content first, and fix them in the source system, not only in the index.

Is a vector database itself sensitive?

Yes. Embeddings and stored text chunks can reveal document content, so protect the index with the same access controls, encryption and retention rules as the original documents.

Keep reading
All posts →
AI Security
Prompt injection explained for business leaders, and how to reduce risk
5 min readRead →
AI Security
Securing AI agents that can take actions in your business systems
5 min readRead →
AI Security
A practical AI security checklist before you launch an AI feature
5 min readRead →

Want this fixed in your business?

Send the workflow. We reply with a scope and a fixed price in two working days.
Send a brief →