Architecture Note · Security & Compliance
Permission-Aware Federated Search: Pre-Retrieval RBAC, Drift Audits, and Owner Sign-Off Gates
Why post-filter enterprise RAG leaks payroll and HR records—and how pre-ranking SQL ACL isolation, 180-day SOP drift audits, and mandatory human sign-off gates eliminate cross-role exposure.
The Operational Problem: Fragmented Knowledge Across Permissive Search Boundaries
Engineering, IT, finance, and people operations teams distribute runbooks and policies across Confluence, Notion, Google Drive, Jira, Slack, and GitHub Docs. When an on-call engineer searches for an incident procedure or a vendor requests VPN onboarding steps, unified search saves hours per week—until an overly permissive index surfaces payroll cutoff schedules, executive compensation bands, or a 300-day-old deployment script. Treating enterprise knowledge as a flat corpus turns routine search into both an access-control breach and an operational reliability hazard.
Why Naive AI Search Wrappers Fail Enterprise Governance
Bolt-on AI search layers and generic RAG bots fail security and knowledge-stewardship audits along four predictable fault lines:
- Post-retrieval ACL leaks: Pulling top-k vector chunks globally and asking the prompt or UI layer to hide restricted rows allows sensitive payroll or HR calibration text to influence embeddings, rerankers, and model context windows before suppression occurs.
- Unbounded upload persistence and token sprawl: Ad-hoc ingestion pipelines retain raw multipart uploads indefinitely on shared disks and issue broad API keys without tenant, role, or rate-limit boundaries.
- Silent SOP drift and policy contradiction: Standard search treats a fresh Confluence policy and a 289-day-old Google Drive runbook as equal truth, surfacing contradictory MFA timeouts or deprecated failover scripts without flagging owners.
- Unverified synthesis and unsafe exports: Chatty Q&A wrappers blend chunks without paragraph-level provenance, fail to refuse restricted queries deterministically, and export raw CSV telemetry vulnerable to spreadsheet formula injection.
The Deterministic Architecture That Fixes It
Production federated search isolates access control, ingestion hygiene, and knowledge governance inside deterministic FastAPI and SQLite (WAL mode) boundaries before any synthesis occurs.
- Pre-ranking SQL ACL isolation and scoped invites:
POST /api/search/queryfilters documents and numbereddoc_paragraphsbytenant_idanddoc_acl_groupsinside SQLite prior to BM25/TF-IDF and semantic bigram scoring. RestrictedFINANCE_PAYROLLandHR_CONFIDENTIALscopes never enter candidate sets forEngineerorContractortokens, triggering an explicitRBAC_ACCESS_DENIEDrefusal state with zero leaked paragraphs and recordingzero_leakage_verifiedinacl_enforcement_logs. SHA-256 hashed invite tokens fromscripts/mint_invite.pybind every caller totenant_id,role,acl_groups, TTL, and sliding-window rate limits (HTTP 429withRetry-After), enforced by automated cross-role probes andpytestisolation suites. - Paragraph-level ingestion and 1-hour staging auto-wipe:
POST /api/docs/indexdecomposes multi-source JSON payloads and uploaded.md,.txt,.json, or.csvfiles into numbered paragraphs carryingsource_url,owner,updated_at, and ACL metadata. Multipart uploads stage with0600permissions inside a0700directory underDOC_TTL_SECONDS=3600and purge automatically via background cleanup sweeps orPOST /api/wipe. - Deterministic offline Q&A and exact citations: Grounded answers execute via
OfflineDeterministicAdapterby default (or a configured OpenAI-compatible endpoint), binding every claim to clickable paragraph references such asDOC-ENG-01 §1.1rather than unanchored summaries. - 180-day drift audits and mandatory human sign-off gates:
POST /api/docs/auditflags runbooks untouched beyond180days, ranks zero-hit search gaps, and pairs conflicting numeric or SLA clauses side by side across repositories—such as a 12-hour Confluence contractor VPN timeout contradicting a 4-hour Notion policy. Owner nudges route through Slack, Google Workspace, or the Official WhatsApp Business Cloud API. Resolving conflicts, archiving stale SOPs, or changing ACL visibility viaPOST /api/docs/audit/{finding_id}/resolverequireshuman_signoff=true(returningHTTP 409 Conflictotherwise) and writes a SHA-256 sign-off receipt. - Auditable metrics and formula-safe CSV export:
GET /api/metrics/searchandGET /api/metrics/search.csvexpose citation accuracy, zero-hit rates, ACL enforcement counts, and estimated hours saved, prefixing leading=,+,-,@, tab, or carriage-return characters to prevent CSV formula injection.
Operational Takeaway
Enterprise search earns trust when authorization is enforced in SQL before ranking, stale and conflicting SOPs require signed human owner resolution, and every synthesized answer cites an exact, role-permitted paragraph.