Skip to content
Skills Library
Security · Learning & explanation

docs-tenant-isolation-explainer

/docs-tenant-isolation-explainer

Use when a customer's security team, DPO, or IT architect asks how Louis prevents one law firm's data from being accessible to another, or how the platform enforces data separation at the infrastructure level. Explains the multi-tenant architecture: per-tenant Postgres row-level security, dedicated KMS keys, no cross-tenant queries, and dual-control on admin tooling. Critical for enterprise procurement and regulated-sector deployments.

Licence
MIT
Last repository change
14.05.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 14.05.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when a customer's security team, DPO, or IT architect asks how Louis prevents one law firm's data from being accessible to another, or how the platform enforces data separation at the infrastructure level. Explains the multi-tenant architecture: per-tenant Postgres row-level security, dedicated KMS keys, no cross-tenant queries, and dual-control on admin tooling. Critical for enterprise procurement and regulated-sector deployments.

Original author description

Use when a customer's security team, DPO, or IT architect asks how Louis prevents one law firm's data from being accessible to another, or how the platform enforces data separation at the infrastructure level. Explains the multi-tenant architecture: per-tenant Postgres row-level security, dedicated KMS keys, no cross-tenant queries, and dual-control on admin tooling. Critical for enterprise procurement and regulated-sector deployments.

How it works

  1. Why this matters for legal AI
  2. Layer 1 — Logical database isolation via Row-Level Security (RLS)
  3. Layer 2 — Dedicated KMS encryption keys per tenant
  4. Layer 3 — Application-layer tenant context enforcement
  5. Layer 4 — No cross-tenant admin operations without dual control
  6. Layer 5 — AI model isolation
  7. What "logically isolated" means (and doesn't mean)
  8. Compliance alignment
  9. Related skills
Original SKILL.md headings · 85 lines, 750 words
SKILL.md preview
---
name: docs-tenant-isolation-explainer
description: Use when a customer's security team, DPO, or IT architect asks how Louis prevents one law firm's data from being accessible to another, or how the platform enforces data separation at the infrastructure level. Explains the multi-tenant architecture: per-tenant Postgres row-level security, dedicated KMS keys, no cross-tenant queries, and dual-control on admin tooling. Critical for enterprise procurement and regulated-sector deployments.
license: MIT
metadata:
  id: docs.tenant-isolation-explainer
  category: docs
  jurisdictions: [__multi__]
  priority: P2
  intent: [tenant isolation, data separation, multi-tenant, security architecture, RLS]
  related: [docs-security-overview, docs-team-roles-permissions, docs-sso-saml-setup]
  source: Louis — HAQQ Legal AI (github.com/sboghossian/mini-claude-for-legal)
  version: "1.0"
---

# Tenant Isolation Architecture

## Why this matters for legal AI

Legal documents contain some of the most sensitive data in existence: M&A strategies, litigation positions, client secrets, regulatory filings. A multi-tenant legal AI platform must provide ironclad guarantees that a leak across tenants — even through a software bug, misconfiguration, or insider threat — is architecturally prevented, not just policy-prevented.

Louis's tenant isolation is defense-in-depth: multiple independent technical controls must all fail simultaneously for cross-tenant access to occur.

## Layer 1 — Logical database isolation via Row-Level Security (RLS)

Every table in the Louis Postgres database that holds tenant data carries a `tenant_id` column. PostgreSQL Row-Level Security (RLS) policies are attached to every such table:

```sql
-- Example RLS policy (illustrative)
CREATE POLICY tenant_isolation ON documents
  USING (tenant_id = current_setting('app.current_tenant_id')::uuid);
```

This means:
- Every database connection operates within a tenant context (set at session start).
- A `SELECT * FROM documents` query, even if executed by a bug in the application, **physically cannot return rows from another tenant** — the database engine filters them out before returning results.
- RLS policies are enforced by the database, not by application code, so they cannot be bypassed by application-layer flaws.

Periodic automated tests verify that cross-tenant queries return zero rows.

## Layer 2 — Dedicated KMS encryption keys per tenant

Each tenant is provisioned with its own encryption key in the Key Management Service (KMS):

- Documents at rest are encrypted with the tenant's key.
- Backups are encrypted with the tenant's key.
- Even if an attacker obtained the raw database bytes for another tenant's rows, decryption would require that tenant's key — which is cryptographically isolated.
- Key rotation can be performed per tenant without affecting others.
- On Enterprise tier, **Bring Your Own Key (BYOK)** is available: the tenant holds the master key in their own KMS (AWS KMS, Azure Key Vault, or GCP Cloud KMS), and Louis never has access to it.

## Layer 3 — Application-layer tenant context enforcement

The application sets tenant context at the start of every request:

1. JWT/session token is validated.
2. The `tenant_id` embedded in the token is extracted.
3. The database session variable `app.current_tenant_id` is set to that value.
4. All queries for the request duration are scoped to that tenant.

Tenant context is never passed as a user-supplied parameter — it comes only from the validated token.

## Layer 4 — No cross-tenant admin operations without dual control

Administrative operations that could potentially access multiple tenants (e.g., a bulk data export, a support engineer reviewing logs) require:

1. A request logged in the admin audit system with stated justification.
2. Approval from a second authorized administrator (dual-control).
3. All actions taken in the admin context are logged immutably with actor, timestamp, tenant accessed, and operation performed.

Support engineers never have standing access to tenant data. Access is granted on a time-limited, purpose-bound basis with full audit trail.

## Layer 5 — AI model isolation

- Prompts and documents submitted to the AI model are processed in isolated request contexts.
- No document content from one tenant is ever included in the context window of a request from another tenant.
- Model fine-tuning or learning from tenant data does not occur by default (no-training policy — see [[docs-security-overview]]).
- If a tenant uses a custom model fine-tuned on their own data, that model is not shared with any other tenant.

## What "logically isolated" means (and doesn't mean)

**Logical isolation** means tenants share the same underlying database infrastructure and servers, but technical controls ensure their data is completely separated. This is the industry-standard approach for SaaS at scale and is equivalent to the isolation provided by AWS RDS, Google Cloud SQL multi-tenancy, and similar managed services.

**Physical isolation** (dedicated servers, dedicated database instances) is available on Enterprise tier upon request. This provides the strongest possible guarantee and may be required by certain regulated entities (DFSA-regulated firms, Saudi SAMA-supervised institutions, etc.).

## Compliance alignment

| Requirement | How tenant isolation addresses it |
|---|---|
| GDPR Art. 25 (data protection by design) | RLS + KMS ensures data minimization at the technical layer |
| UAE PDPL data security obligations | Encryption + access control + audit logs |
| DFSA / ADGM operational resilience | Logical isolation + backup + incident response |
| Professional secrecy (LB Bar, UAE Bar) | No cross-tenant access means client data never mingles |

## Related skills

- [[docs-security-overview]]
- [[docs-team-roles-permissions]]
- [[docs-sso-saml-setup]]

Versions

The database has no other skills named docs-tenant-isolation-explainer.

Database snapshot: 13.11.2026 · package version 69566a950cba (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90nestjs-security-isolation
    Enforce multi-tenant isolation and PostgreSQL Row Level Security in NestJS. Use when enforcing tenant isolation or PostgreSQL RLS in NestJS multi-tenant apps.
  • 100safety-client-confidentiality-cross-tenant
    Use when verifying or explaining the cross-tenant data isolation guarantees that prevent one law-firm tenant's client data, documents, embeddings, and learned patterns from leaking to any other tenant. Covers the architectural implementation (storage-layer partitioning,…
  • 95multitenancy-rls-isolation
    Use this capability whenever multi-tenancy, tenant isolation, Row-Level Security, shared-schema SaaS, organization-scoped data, tenant_id, database policies, cross-tenant access, or tenant-aware caching appears. Trigger even if the user only says \u201corgs\u201d,…
  • 90docs-security-overview
    Use when a prospect, customer, IT/security team, or procurement evaluator asks about Louis's security posture, data handling practices, compliance certifications, or infrastructure protections. Covers encryption standards, tenant isolation, access controls, certification roadmap…
  • 100cross-tenant-data-leak-tests
    Use when designing or adding tenant isolation tests to a multi-tenant app, adding a CI leak gate, or investigating a leak. Inventories tenant-bearing surfaces, then tests read-by-ID, list leaks, spoofed tenant IDs, JWT replay, storage IDOR, search, jobs and caches, plus Postgres row-level security.
  • 100rls-multi-tenant
    Builds tenant isolation on Azure SQL Database that a test can prove, with a row level security policy whose filter predicate and block predicate are written together, because a filter alone still accepts a cross-tenant write and hides the row from the app that made it. Use when…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.