How do you make sure users only get answers from documents they are allowed to see?
RAG · Pro 1
Short answer
Enforce permissions at retrieval time, in code, not in the prompt. Store access control data, such as allowed users or groups, with every chunk, sync it from the source system, and filter the search by the signed-in user's identity before anything reaches the model. Also check caches and logs, test with two users who have different access, and audit regularly.
Deeper answer
If a forbidden chunk ever reaches the model, it can appear in an answer, so post-filtering the answer is too late. Mirror the source system's permissions, such as SharePoint groups, and handle changes quickly: when someone loses access, their next query must reflect it.
Shared caches are a common leak: a cached answer for one user can be served to another. Key caches by permission set or user.
What a strong answer covers
- Enforces access at retrieval time in code
- Stores access lists with chunks
- Syncs permissions from the source system
- Uses the signed-in user's identity
- Tests with different users; checks caches and audits
Answer it out loud in the mock interview about 2 min
Follow-ups to expect
- How would you handle a permission change in SharePoint?
- Why is filtering in the prompt not enough?
Common mistakes
- Relying on the prompt to hide documents
- Sharing a cache across users
Learn it
- How do you choose a chunk size for RAG?
- Your RAG app gives wrong answers. How do you find the cause?
- Design a RAG system that lets a law firm search and ask questions about 50,000 contracts.
- How would you detect hallucinations in a production RAG application?
- What are embeddings, and how are they used in search?
- How do you make a RAG system cite sources and stay grounded?
- What are hybrid search and reranking, and when do they help?
- How do you keep a RAG index up to date as documents change?
- How do metadata filters improve retrieval?
- How would you build RAG over documents full of charts and images?
- Your RAG system must handle scanned PDFs, tables and slides. How do you ingest them?
- What are query rewriting and HyDE, and when do they help?
- Your HR assistant keeps quoting last year's leave policy. How do you fix it?
- Tell me about a RAG system you built and how you measured whether it worked.
- Can you do retrieval for long documents without a vector database?
- What is RAG, and why would you use it?
- When would you use graph RAG instead of standard vector RAG?