All patterns
P-02 · Patterns

Permission-aware RAG

Retrieval filters by who is asking before ranking, so the model never sees what the user is not allowed to see.

rag-com-permissoes.archClick a component in the diagram
Access filter · Restricts search to the chunks this user may see.
Problem

A plain RAG indexes everything together. The assistant answers with chunks from documents that user could never open.

Solution

Each chunk carries the access metadata of its source. Search applies the identity filter first and only then ranks and assembles context.

When to use
  • →Documents with different access levels
  • →Internal enterprise assistants
  • →Privacy or confidentiality requirements
## Trade-offs
  • +Prevents leaks through the assistant itself
  • +Audit trail of what was retrieved per user
  • −Keeping permissions in sync with the source takes work
  • −Larger indexes and costlier queries