How to Stop AI Assistants Exposing Data Users Should Not See
Design permission-aware enterprise retrieval so AI assistants respect identity, document ACLs, least privilege and auditable access decisions.
What is actually going wrong?
An AI assistant can unintentionally bypass the access boundaries users expect if retrieval runs with a broad service identity and does not enforce the caller's permissions on every result.
Symptoms teams commonly notice
- A user receives content from a restricted document
- Different users get identical answers despite different access rights
- The retrieval service uses one broad shared credential
- Access revocation does not take effect in the assistant
Why this problem happens
Use evidence to narrow the failure domain before applying a fix.
Explore the system flow
Select a stage to see what should happen and what evidence to inspect.
User identity
Authenticate and resolve group claims
How to solve it reliably
A production solution should address the root cause, make failures observable and support safe recovery.
- 01Authenticate the user and propagate a verifiable identity context to the retrieval service.
- 02Enforce document-level ACL filters before content reaches the language model; never rely on prompt wording to hide restricted data.
- 03Use least-privilege service identities and separate administrative indexing from user-time retrieval.
- 04Define how permission changes and revocations invalidate cached results and indexed ACL metadata.
- 05Log user identity, retrieved document IDs, policy decisions and access-denial events without unnecessarily logging sensitive content.
# Illustrative retrieval guard: enforce ACL before building LLM context
principal = authenticate_request(token)
allowed_doc_ids = acl_service.allowed_documents(principal.id)
results = vector_store.search(
query=user_question,
filter={"document_id": {"$in": allowed_doc_ids}}
)
# Only authorised passages may be passed to the model.
context = build_context(results)Illustrative starting point. Validate identifiers, data types, security and platform-specific syntax in your environment before production use.
Find the likely failure area
Choose the symptom closest to what you observe. This guided diagnostic suggests where to investigate first; it does not replace environment-specific testing.
Restricted content appears in an answer
Trace retrieved document IDs and ACL filtering before generation.
Turn the fix into an operating practice
Follow the stages in order. Each step creates evidence for the next one.
Map identity and permissions
Document users, groups, source ACLs and trust boundaries.
Keep the problem from returning
- Map identity and permissions: Document users, groups, source ACLs and trust boundaries.
- Enforce before generation: Filter retrieval candidates using authoritative permissions.
- Handle change and revocation: Synchronise ACL updates and invalidate affected caches.
- Test adversarial access cases: Verify allowed, denied, revoked and cross-tenant scenarios.
Where we can help
Dealing with this challenge in your environment?
Share the symptoms, constraints and outcome you need. We can help scope a practical technical approach.