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.

  1. Pre-ranking SQL ACL isolation and scoped invites: POST /api/search/query filters documents and numbered doc_paragraphs by tenant_id and doc_acl_groups inside SQLite prior to BM25/TF-IDF and semantic bigram scoring. Restricted FINANCE_PAYROLL and HR_CONFIDENTIAL scopes never enter candidate sets for Engineer or Contractor tokens, triggering an explicit RBAC_ACCESS_DENIED refusal state with zero leaked paragraphs and recording zero_leakage_verified in acl_enforcement_logs. SHA-256 hashed invite tokens from scripts/mint_invite.py bind every caller to tenant_id, role, acl_groups, TTL, and sliding-window rate limits (HTTP 429 with Retry-After), enforced by automated cross-role probes and pytest isolation suites.
  2. Paragraph-level ingestion and 1-hour staging auto-wipe: POST /api/docs/index decomposes multi-source JSON payloads and uploaded .md, .txt, .json, or .csv files into numbered paragraphs carrying source_url, owner, updated_at, and ACL metadata. Multipart uploads stage with 0600 permissions inside a 0700 directory under DOC_TTL_SECONDS=3600 and purge automatically via background cleanup sweeps or POST /api/wipe.
  3. Deterministic offline Q&A and exact citations: Grounded answers execute via OfflineDeterministicAdapter by default (or a configured OpenAI-compatible endpoint), binding every claim to clickable paragraph references such as DOC-ENG-01 §1.1 rather than unanchored summaries.
  4. 180-day drift audits and mandatory human sign-off gates: POST /api/docs/audit flags runbooks untouched beyond 180 days, 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 via POST /api/docs/audit/{finding_id}/resolve requires human_signoff=true (returning HTTP 409 Conflict otherwise) and writes a SHA-256 sign-off receipt.
  5. Auditable metrics and formula-safe CSV export: GET /api/metrics/search and GET /api/metrics/search.csv expose 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.

Test permission-aware search on your own repositories

Start with a free 30-minute workflow check. Bring one internal knowledge workflow and leave with one concrete recommendation in writing within one business day.