Before sharing a RAG assistant, test its document permissions
A fictional research-library exercise for checking who can retrieve documents, what happens after access is revoked, and which audit evidence to retain.
A shared research assistant can return an accurate answer from a document the person asking was never allowed to read. For a team library, that is a separate problem from hallucination: the answer may be correct while the access decision is wrong.
Before inviting colleagues into a private retrieval-augmented generation (RAG) system, write down who may read each document and test those decisions with fictional material. Start with permission boundaries you can inspect, then repeat the checks against the actual application. Running a model on your own computer does not establish that a shared service separates its users.
Separate relevance, support and permission
Retrieval asks which passages help answer a question. A support check asks whether those passages justify the answer. Authorization asks whether this person may receive those passages at all. A useful evaluation records all three decisions separately.
Our retrieval comparison guide helps examine the first question. The permission review below asks a different one: can someone obtain restricted content through search, an answer, a citation or an export?
OWASP's authorization guidance recommends denying access unless permitted and validating permissions on every request. For this exercise, make the document owner responsible for approving the expected decisions. A developer should not have to infer a research team's sharing policy from folder names.
Build a tiny fictional library
Imagine a small evaluation team with two test identities: an analyst and a project owner. Create three harmless files. A methods note is available to both. A project planning note is available only to the owner. A third file has no permission assignment and should be unavailable to both. These are invented examples, not client documents or results from a deployed system.
Put a distinctive, meaningless marker in each file: for example, “The fictional project code is CEDAR-27.” Keep the restricted marker out of public test questions and expected-answer descriptions shown to the assistant. Ask a question that requires reading the file, such as “What is the project code?” The marker helps identify which source contributed content without exposing real information.
Write the reference decisions before running anything:
- Analyst, shared methods note: allow.
- Analyst, owner-only planning note: deny.
- Project owner, owner-only planning note: allow.
- Either identity, unassigned file: deny.
- Unrecognized identity, any file: deny.
Two roles keep the example readable. A real research project may also need project membership, organization boundaries, consent restrictions or document-specific grants. Confirm those requirements before treating a role label as sufficient.
Follow the document through the application
A document may become several searchable chunks, each with an embedding and source reference. OWASP's RAG security guidance calls for access metadata to follow those chunks and for checks when retrieval occurs. It also warns against relying on the language model to enforce access.
For the proposed test, inspect the passages supplied to the answering model. A refusal in the final answer does not demonstrate that restricted text stayed outside the model's input. Agree who may inspect this diagnostic record and use only synthetic content while developing the check.
Repeat each permission case through every available route: ordinary questions, passage previews, citation links, direct document requests and exports. An application may protect its search page while leaving a download route open. The OWASP direct-object reference guidance explains why knowing an object's identifier must not substitute for authorization.
Capture the request route, test identity, expected decision and observed content at each boundary. If the interface hides a denied source, also check whether its title or snippet appears elsewhere. Decide with the document owner whether even those details are restricted.
Change a permission after a successful request
First, allow the analyst to retrieve a shared test note. Then revoke that grant in the authoritative permission source. Repeat the question in the existing session and a fresh session. Try the previous citation or export link as well.
For this proposed acceptance check, the next protected request must not return the revoked content. Define when a permission change becomes effective and how the application handles a permission-service failure. Document any delay instead of describing revocation as immediate when it is not.
Test an answer previously produced for the owner when the analyst asks the same question. Then change the document version and repeat. These cases examine whether cached answers, cached passages and source references still respect the current user and grants. A cache hit should not be treated as permission to disclose content.
Already viewed or downloaded content cannot simply be recalled from a person's possession. The test concerns subsequent application access, not a promise to erase knowledge or copies someone previously received.
Record the decision without copying the library
An audit record should help a reviewer reconstruct a permission decision. For this fictional exercise, propose an event time, request identifier, application boundary, test actor ID, document/version ID, policy version, allow-or-deny outcome and reason code. Compare each record with the known answer.
OWASP's logging guidance discusses event context, sensitive-data exclusions and protection of logs. A practical starting point here is to omit raw question text, document bodies and credentials. Even actor and document identifiers can be sensitive, so the log needs its own access rules and retention plan.
Ask who reviews denials, who can change records, what happens if logging fails, and how deletion or retention is handled. A JSON object in a test proves neither durable storage nor protection against alteration. Those are separate implementation requirements.
Use the result as a gate, not a certificate
For a small agreed sample, require every expected allow and deny decision to match, with no unauthorized content returned. Keep a count of allowed cases too: a system that denies everything has not demonstrated a useful permission implementation. Preserve failures and rerun the same cases after changes.
We prepared a local synthetic policy harness alongside the proposed pilot. Its 14 deterministic checks cover fixture decisions, a revocation recheck and a minimal audit shape. They do not authenticate a person, query a vector database, exercise a real cache or protect an endpoint. Labels such as “export” describe a modeled decision, not a tested export implementation.
A passing reference harness helps establish expected behavior. It cannot establish security of a client deployment. The next gate is the actual integration: trusted server identity, authoritative grants, all content-return paths, failure handling and independent security review. No production leakage rate or security guarantee is reported here.
Start with one permission matrix
Bring the IT owner and a document owner together. Choose one repository, identify the budget decision maker and agree a small permission matrix before changing the software. List the routes that can return content, freeze the synthetic examples and decide what evidence would block wider use.
If your team needs help defining that boundary, our proposed document-access and audit pilot describes a bounded scope and its limitations. An initial inquiry needs a description of the system, not documents or credentials. Keep the technical review separate from any decision to authorize a paid project.