Design a Work Copilot That Never Leaks Data the User Can't Access
How to build a work copilot that shows each person only what they could already open, explained simply for your AI interview.
In short
A work copilot should check the asking user's own access at the moment it searches, and pass only text they may open to the model. Copied permission lists go stale, and shared caches can leak answers, so both need care.
12 min readAdvancedCommon ยท estimateFacts checked 27 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
A work copilot answers questions from company files, so it has to show each person only what that person could already open. My design checks the user's own access at search time, before any text reaches the model. I don't trust a copy of permissions made last month. I also key caches, logs and tools to the user. Then I test as users from every group, and as an attacker.
A work copilot reads company files and answers questions about them. The danger is simple. If it searches everything and only then decides what to show, one clever question can pull out a board memo meant for three people. So the permission check comes first, before ranking, before the model, and before anything reaches the screen.
I'd ask the source system the question, using the user's own sign-in. The source system already knows who can open what, so I'd check that at question time where the source supports it, and keep only what passes. I'd avoid copying access lists into my own index as the main check. A copy goes stale the day someone moves to another team. If I must keep a copy, I'd recheck it before the answer is built.
The wider paths matter too. A shared answer cache is a common leak. If the key is the question alone, the second person gets the first person's answer. So every cache key includes the user's groups. Logs follow the same rule, and each tool call runs with the user's own token, not a service account that can see everything.
Finally, I test it like an attacker. I ask the same questions as users from each group, then check that nothing hidden shows up in the answer or in its citations. I rerun those tests on every release.
What is a work copilot that respects permissions, in plain words?
A work copilot is an AI assistant that answers questions from a company's files, mail and chats. It finds the right passages and writes a clear answer. It is good at finding things, and that is the risk: it can find a file the person asking was never meant to open.
Permissions are the rules that say who may open each file. A copilot respects them when every answer uses only what the person could already open by hand. The model has no idea who is asking, so the check has to live in code around it.
Think of a bank teller who checks your ID before opening the safe deposit box you rented. The teller checks at the counter, every time, and doesn't rely on a list written last month. A copilot needs the same counter.
A sample question might be "What is the walk-away price?", typed by an analyst on a deal team. The copilot should answer only if that analyst may open the file that holds the number.
Key words
- Permission filter
- The check that removes files the user cannot open, before any text is read.
- Access control list (ACL)
- The list of users and groups allowed to open one file.
- Query time
- The moment a question is asked, as opposed to when the files were first loaded.
- Citation
- The source link shown under an answer, so a person can check it.
How does the copilot see only what you can see?
The copilot does four things, in this order. The order matters: the filter runs before ranking, and before the model reads a single word.
How a permission check travels
Priya's question
asked with her own sign-in
All company files
includes memos she cannot open
Permission filter
keeps only what she can open
Model
sees only the kept text
Answer with sources
cites only files she can open
- 1Her question carries her own sign-in.
- 2Every candidate file goes to the filter first.
- 3Only the passages she may open reach the model.
- 4The answer cites only files she can open.
- 1
Use the user's own sign-in
The question carries the person's identity, not a shared service account with rights to everything.
- 2
Ask the source who can open what
The search checks the file store's permissions right now, for this person.
- 3
Drop the rest before ranking
Passages the person cannot open are removed first, so the model never reads them.
- 4
Cite only what is kept
Every link under the answer points to a file the person could open alone.
Microsoft says Copilot only surfaces data each user has at least view permission for. It also says the tenant's permissions model can help ensure that data won't unintentionally leak between users, groups and tenants.
โMicrosoft Copilot only surfaces organizational data to which individual users have at least view permissions.โ
Microsoft, Copilot data and privacy
โA permission-aware vector database should be implemented to restrict access and ensure that only authorized groups can access their specific information.โ
OWASP, LLM08:2025
Here is the idea in a small Python program. The made-up deal room has three files. Its permission table is typed in by hand, which is the risky shortcut from the next section. In a real build, that table is replaced by a live check at the source. The HR file is all an HR user gets.
# A made-up deal-room copilot: the permission filter runs before the model sees any text.
DOCS = [
("memo-merger-terms", "Target price 41 per share, walk-away at 44", {"deal-team"}),
("board-minutes-q3", "Board discussed restructuring the EU unit", {"board"}),
("hr-policy-2026", "Remote work allows three office days a week", {"everyone"}),
]
def visible_to(groups):
return [d for d in DOCS if "everyone" in d[2] or d[2] & groups]
def build_prompt(question, groups):
lines = ["Context:"]
lines += ["[" + doc_id + "] " + text for doc_id, text, _ in visible_to(groups)]
lines.append("Question: " + question)
return "\n".join(lines)
print(build_prompt("What is the walk-away price?", {"deal-team"}))
print("---")
print(build_prompt("What is the walk-away price?", {"hr"}))Output
Context: [memo-merger-terms] Target price 41 per share, walk-away at 44 [hr-policy-2026] Remote work allows three office days a week Question: What is the walk-away price? --- Context: [hr-policy-2026] Remote work allows three office days a week Question: What is the walk-away price?
The filter is simple. Keeping its access data correct is the hard part, and that is the next section.
Why are copied access lists risky?
A quick build often copies each file's access list into the search index, then filters on that copy. It is fast. But the copy is a snapshot from the day the file was indexed. Someone moved off the deal team on Monday can still get the memo on Thursday if nobody refreshes the copy.
Copied access rules or a live check?
Copied when indexed
Copy access list
a snapshot, refreshed later
Asked on each question
Live check at the source
checks access for this question
Stale results
may show removed files
Current results
match today's access
- 1Its copy can be out of date once access changes.
- 2The source is asked again, so today's access decides.
- Index-time copy
Fast, but out of date
A removed user keeps seeing files until the copy is refreshed.
- Live check at the source
More work, but current
The source answers for today's access, so a removal should show at the next question.
Microsoft's Foundry IQ documentation lists five main approaches to enforce document-level permissions. Its SharePoint and ADLS Gen2 options copy permission metadata into the index and check it at query time. Its OneLake source option (preview) skips that copy. The security filter pattern trusts the identity the app passes in, and the docs note there's no authentication or authorization through that security principal. They also say a permission-related field name proves nothing by itself.
Tip
Asked how you would build the filter, name the source's own native option and the security filter pattern. Say when each fits. When you must copy access rules, say how often they refresh and who checks them.
What else can leak: caches, tools and logs?
Retrieval is only one door. A copilot can also leak through a cache, a tool, a log or a saved memory. Each one needs the same rule: the user's access, checked at the moment it is used.
- 1
Answer cache
Key each saved answer by the question and the user's groups, so answers never cross people.
- 2
Tools
Run each action with the user's own token, so a send or a file write cannot reach what that person could not open.
- 3
Logs and traces
Store questions and answers under the same access rules as the source documents.
- 4
Memory
Keep anything the copilot remembers scoped to one person or one team, never the whole company.
Here is the cache failure in a worked case. Priya on the deal team asks the walk-away question at 10:05. Sam in HR asks the same words at 10:20, and a shared cache hands him her answer.
- Shared cache key
Sam gets the memo
The key is the question text only, so Sam's question hits Priya's cached answer.
- Scoped cache key
Sam's question is checked
The key includes the groups, so Sam misses the cache and the search checks his access.
OWASP's 2025 list ranks sensitive information disclosure as LLM02. Its advice is least privilege: limit access to sensitive data to what each user or process needs. Exposure can mean unauthorized access, privacy violations and lost intellectual property.
Test it like an attacker would. Ask the same questions as a user from each group, then search every answer and citation for text from files that user cannot open. Rerun those tests on every release, and add any leak you find to the test set.
How would you handle access removed mid-day?
A deal-team analyst moves to another project at 9:00. At 9:30 she asks a question that the old deal room used to answer. What should happen, and what would you check?
- 1
The source decides
Her access is checked against the file store at 9:30, so the removed files drop out of search.
- 2
The cache follows
Answers cached under her old groups no longer match her key. In my design, cached answers also expire on a short timer and are dropped when a file's permissions change. A short timer still leaves a small window, and I'd say so.
- 3
The log tells the story
Earlier answers stay in the audit trail, so the team can review what she saw and when.
Tip
Say how fast removal works. A live check at the source removes access at the next question. A copied index waits for its next refresh, and Microsoft's docs say a refresh gives no immediate revocation. That gap is the honest answer to give.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: the copilot shows only what the person could already open.
- Where the check runs: at question time, before the model reads any text.
- Why copied access lists go stale, and the query-time alternative.
- Caches, tools, logs and memory each need the same rule.
- Testing as users from each group, plus an attacker's view.
- Honest limits: the permissions in the source system must stay correct.
Common traps
Trap"Filter the answer after the model writes it."
BetterToo late. The model has already read the hidden text and can repeat it in a summary. Filter before the model reads.
Trap"Copy each file's permissions into the index, and we're done."
BetterA copy goes stale. Check access at question time, or refresh and recheck the copy before answering.
Trap"One service account can read everything, so the app checks users."
BetterThen the app's own code is the only lock. Let the source check the user's own sign-in too.
Can you spot the leak?
Spot the leak
A copilot caches its answers. Which cache design leaks one user's answer to another?
Quick check
Which change stops a removed user from seeing a file in an answer?
Can you answer these from memory?
Flash cards ยท tap a card to flip it
What will they ask next?
Learn it in depth
Last updated on 27 November 2026
Building an assistant over your company's files?
I design and build AI products and agents, including the interface and the system behind it. Book a short call and tell me what you need.