Permissions in an AI knowledge base: how staff receive only authorized answers
Enterprise AI security starts with which document a particular employee may see. Hiding a button or checking chat sign-in is not enough. Check access to the source document, retrieved passage, answer and log separately. Start with synthetic documents and pre-labeled negative tests.
Define the access boundary before configuring search
Write down roles, groups and the documents each role may read. Name the result the system should return and the information it must not reveal.
- Role matrix
- For each role list permitted collections, document types and operations. A user may read a team procedure but not an HR or finance folder.
- Document and passage
- Do not check only the file card. A retrieved passage, citation and source link need the same authorization as the original document.
- Answer and action
- An answer may be visible while changing a record, sending a message or exporting a file needs separate permission. A supported answer is not permission to act.
- Logs
- Logs help investigate access but must not become a copy of private text. Agree which events are retained and who can read them.
Make negative examples part of the matrix: a user from another group, expired access, a document without ACL and a request for another person’s record.
Filter sources before passing context to the model
Authorization must happen during retrieval or before passages are sent to the model. Filtering only the final answer does not prove that private text stayed out of context.
- User identity
- The server obtains a verified identity and group. Do not accept a group from a form field or prompt text.
- Permission beside the document
- The index stores permitted users or groups. Update it with the document and keep a clear version.
- Filter every query
- Every search applies the access filter. One safe route does not make another endpoint safe if it returns the same index without a filter.
- Stale permissions
- After removing a user or group, repeat the old query. Index update and propagation delay need an observable status.
Microsoft documents document-level access control and security filters that exclude documents by user identity [S1]. The mechanism depends on the source and service version.
Run negative tests at every layer
A positive test shows that an authorized employee receives a document. A negative test checks that another document is absent from results, context, answer and logs.
- Another group
- A sales user searches for an internal finance document. Expect an empty result or a clear refusal without the private file name or passage.
- Direct identifier
- The request contains a known ID of another document. The ID must not bypass the filter.
- Role change
- After a role is removed, the employee repeats the query. A stale context, cache or citation must not reveal the private content.
- Mixed answer
- A question includes an allowed and a forbidden document. The answer keeps allowed facts and does not explain missing content by revealing the private file.
Treat any authorization check failure as an unknown outcome until its cause is understood. It may be an access bug, incomplete synchronization or a correct restriction.
A controlled simulation on synthetic documents
The Python 3 archive reads three synthetic documents, a role matrix and 12 static ID queries. It checks document existence and role membership for that ID. Models, search, context, caches, answers and logs are not implemented. Results are compared with a separately specified expected output.
- 12 queries
- Three roles and three documents. Queries repeat authorized and other-role IDs. Five static checks should allow access and seven should deny it. These are not role-revocation or mixed-answer scenarios.
- Success condition
- An existing document ID is allowed only for a role whose permission list contains that ID. This checks an identifier matrix. Document text is not passed to a model or composed into an answer.
- Run result
- 5 queries received expected access and 7 were correctly restricted. This is a synthetic matrix result, not a production security score.
- Sensitivity check
- Remove sales-doc from sales permissions in roles.json and run the program. Expect RECONCILIATION_FAILED. Restore the file. Removing the document from documents.json must also break reconciliation.
The archive checks only document existence and static permission for an ID. Revocation, model context, cache, answer and log checks require separate implementation and acceptance.
Agree acceptance beyond the chat screen
Acceptance criteria must cover source, context, answer, log and permission changes. Use questions that were not used during tuning.
- Source
- Check that the permitted document is retrieved and the forbidden one is absent from the source set.
- Context
- Check the actual text sent to the model. A hidden button is not this control.
- Answer
- Check citations, absence of private facts and a clear refusal when authorized sources are insufficient.
- Permission change
- Check granting and revoking a role, cache, repeated search and recovery after synchronization.
For consequential workflows add a data-owner decision and a separate stop control. OWASP recommends testable authorization controls and logging violations so their causes can be investigated [S2].
What to prepare for an initial discussion
The initial discussion is free. A full audit, pilot, implementation and support have separately agreed scope and price.
- Inputs
- Name roles, sources, document types, permission lifetime and the action following an answer. Do not send passwords or private files through the form.
- Deliverable
- An access matrix, negative tests, refusal rules, log events and a decision on the next phase.
- What changes scope
- Several catalogs, inherited groups, scans, frequent permission changes, caching and external actions need separate assessment.
Start with one role, three synthetic documents and one question that must be denied. That set already shows where authorization is checked.
Review one access boundary
Describe a role, document and question that must be denied. A fictional example is enough for an initial discussion. Agree the transfer of real materials separately.
Official sources
Checked 15 November 2026. The synthetic matrix and validation rules were prepared for this guide.