Search docs
Docs searchValidation rule
Back to Rule CatalogAP-DQR-001Data & Query RiskMissing tenant filter evidence in multi-tenant SQL
Flags query paths where multi-tenant SQL lacks clear tenant-filter evidence.
warningviolationNo auto-fix
How to fix
- Add an explicit tenant filter to the query.
- Pass tenant context through repository/service boundaries.
- Document intentional shared queries and add tests that prove tenant isolation.
What it means
A query appears to touch tenant-scoped data without an obvious tenant filter.
Why it matters
Missing tenant filters can expose or mix data across tenants.
Common causes
- Raw SQL omits tenant_id.
- Tenant scoping is hidden behind an abstraction ArchPilot cannot identify.
- A test fixture or report query was copied into production code.
Example bad pattern
SELECT * FROM invoices WHERE status = 'open'Example good pattern
SELECT id, status FROM invoices WHERE tenant_id = $1 AND status = 'open'Related files/config
apps/api/srcdb/sqlpackages/db/prisma/schema.prisma
Related CLI commands
archpilot validatearchpilot validate --ci