Authentication and Tenant Isolation
Derive tenant scope from trusted identity. Scope every retrieval, source fetch, cache hit, citation, conversation read, and background job. A user-supplied tenant ID is not authorization. Choose logical filters, namespaces, separate indexes, or dedicated deployments based on threat model. Test negative access cases deliberately.
Implementation example
async function searchForUser(query, auth) {
const filter = await authorizationService.buildDocumentFilter(auth);
return vectorStore.search({query, filter, limit:10});
}💡 The chosen store must enforce filters at the correct stage and every result must be scoped.
Key Takeaways
- Inspect the relevant pipeline stage instead of guessing.
- Preserve source provenance, versions, and access scope.
- Measure quality on representative queries.
Knowledge Check
What is the safest origin for tenant scope?