AI security · 2026-10-12 · 6 min

AI chat over confidential documents: permissions before retrieval

An AI chat over a data room, HR file or knowledge base is quick to stand up: documents in a vector database, a language model behind it. The hard part is not the model. It is the question of who may see what, and what happens when an answer draws on several documents. This is what we learned in recent months building a data room for fund managers and a knowledge base with paid and internal content.

Filter before the search, not after

The obvious build: search the whole collection, take the ten best chunks and drop what the user may not open. It looks safe, but it makes the answer worse. An investor with access to three documents gets an answer built from two of the ten hits, or from nothing, because the best hits were in documents closed to them.

The fix is to pass permissions as a filter in the search query itself: per tenant, per group, published documents only. Then the ten best hits are the ten best of what this person may read. The model never sees text the user could not, and the answer gets better instead of thinner.

Search and suggestions leak too

The same holds outside the chat. A search result shows a snippet, so whoever can search paid content without being allowed to read it reads it anyway, one snippet at a time. Search over restricted content should only work for those who may see that content.

Suggested questions are a less obvious leak. "What are the key terms in [document name]?" reveals that the document exists. In our data room no titles and no ids leave the server: the screen only receives topics (fund size, strategy, team, fees) that a document this person may search is likely to answer.

PII masking: where, and what exactly

We mask person names at ingestion, before embedding. The stored chunk then reads [PERSON], and nothing further down the chain can restore it. That is the strict and safe default. After that comes a check on the model's answer.

Our first version of that check masked everything that looked like personal data. The result was answers like "The key persons are [PERSON] and ...". The reader was allowed to open the source document, and the name was right there. Masking what is literally in permitted sources protects nothing and makes the answer unreadable. The leak the check exists for is a name or number the model produces that is not in the sources it was given. That we now mask; the rest stays. Compare without whitespace: PDF extraction breaks lines inside names.

Output check leaves
+Names and amounts that appear verbatim in the answer's sources
+Fund, company and institution names
+Terms such as Net Asset Value or Internal Rate of Return
+Key persons in a key-person clause (a deliberate exception)
Does mask
–Names and numbers the model states that are not in the sources
–Contact details, IBAN and national ID numbers, at ingestion
–Personal data in the question, before it reaches the model
The output check catches what the model adds itself. What the reader was already allowed to see, it leaves alone.

A rule of thumb is not a policy

Rule-based name detection errs both ways. Ours treated any run of two or three capitalised words as a person: "Net Asset Value", "Call Notice", "Central Bank", "Cayman Islands". A pattern for Dutch surnames ("de", "van der" plus a capitalised word) had no word boundary in front and so caught the end of English words: "include Acme Health" became "inclu[PERSON] Health". Every English word ending in -de does it: provide, made, trade. Test such a detector on real documents in both languages, read the output, and keep the exception list short enough to check in full.

Some choices also shouldn't be left to a rule of thumb. A fund agreement names its key persons precisely because investors need to know who they are: if one leaves, the investment period is suspended. Masking those names made the clause an investor most needs unreadable. The exception, a name close to "key person" with contact details still masked, is an owner's decision. It is recorded with its date in the specification and is not quietly tuned by a developer or an AI.

Prove that it doesn't leak

"It doesn't leak" is a claim, not a test. Our knowledge base holds restricted text with made-up canary words that appear nowhere else. A leak test looks for those words in every answer, every search result and every bundle the browser loads. Citations run through codes the server hands out itself: the model picks from the permitted sources, and a code it invents is dropped. An answer can never point to a document the reader may not open.

Infrastructure counts too. Under load our vector database scaled out to several replicas that each started empty, so the same collection answered "already exists" and "not found" in the same second. The production configuration had drifted from what the infrastructure code declared. To a user, an AI chat that sometimes finds nothing is indistinguishable from one that holds something back.

PRODUCT
AxonVault

AxonVault is a data room for fund managers with AI Vault Chat: search within what a person may read, PII masking at ingestion and on the answer, and watermarked downloads with an audit trail.

View AxonVault →