Skip to main content

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

Answer it out loud in the mock interview about 2 min

Follow-ups to expect

Common mistakes

Learn it

Permission-aware RAG

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.