# How internal AI assistants leak data through permissions

> Source: <https://discuss.huggingface.co/t/how-internal-ai-assistants-leak-data-through-permissions/192110#post_2>
> Published: 2026-11-18 23:15:59+00:00

**Recommendation:** Enforce row-level security at the vector search phase, filtering embeddings by user permissions before retrieval results enter the context window, rather than relying on OS-level file access controls.
More in the playbook "Retrieval and RAG": <https://wpnews.pro/playbooks/rag-retrieval>

[@Vivekwritesdaily](https://discuss.huggingface.co/u/vivekwritesdaily) The core failure isn’t just the admin token; it’s the retrieval layer merging documents with different sensitivity levels into a single context window before the LLM processes them. Even if you restrict file access at the OS level, a vector search that aggregates results from a ‘policies’ and ‘compensation’ index into one query response bypasses those boundaries entirely. The model sees a unified context and has no way to distinguish that a specific chunk belongs to a sensitive tier. You must enforce row-level security at the vector search phase, filtering embeddings by user permissions before they ever enter the context window. Aggregating at the ingestion level is brittle for dynamic queries, but failing to filter results at search time guarantees leakage when a query like ‘summarize all policies’ triggers a retrieval of mixed-sensitivity data.
