8fc88ffc14
Build & Push / Pipeline Tests (push) Failing after 59s
Build & Push / Build & Push Docker Image (push) Has been skipped
Test / Type Check (all packages) (push) Failing after 51s
Test / API Unit Tests (push) Has been skipped
Test / Homepage Unit Tests (push) Has been skipped
Test / Carplace Unit Tests (push) Has been skipped
Test / Admin Unit Tests (push) Has been skipped
Test / Dashboard Unit Tests (push) Has been skipped
Test / API Integration Tests (push) Has been skipped
1.2 KiB
1.2 KiB
ADR-002 — Defer Postgres RLS until app-level isolation is proven
Status
Accepted (Phase 3) — RLS not enabled yet
Context
Phase 3 lists optional Postgres row-level security after app-level cross-tenant tests. The API already scopes queries with companyId from the authenticated session. Enabling RLS without a complete policy matrix and migration path risks breaking admin, workers, migrations, and reporting jobs that use elevated DB roles.
Decision
- Land and keep expanding the app-level suite (
apps/api/src/tests/integration/cross-tenant-isolation.test.ts). - Do not enable
FORCE ROW LEVEL SECURITYin production until:- Cross-tenant suite covers vehicles, customers, reservations, payments, team, billing reads
- Worker and migration DB roles are designed (
BYPASSRLSor dedicated policies) - A staging soak proves no latent
findManywithout tenant predicates
- Revisit RLS as a defense-in-depth layer in a dedicated change set — not as a gate to start Phase 3 assurance work.
Consequences
- Tenant safety remains an application responsibility in the near term.
- Pen-testers should still treat missing
companyIdfilters as Critical. - Future RLS work tracks under Phase 3 optional / post-GA hardening.