The Risk of Application-Only Tenant Filtering
In traditional multi-tenant apps, tenant isolation relies on every developer remembering to append WHERE company_id = ? to every query and report. A single missed filter in a new endpoint or export can leak data across companies.
How PostgreSQL FORCE ROW LEVEL SECURITY Works
In LAR ERP, tenant boundaries are enforced directly by the PostgreSQL engine through four coordinated safeguards:
- Non-Privileged Runtime Role (app_erp_rw): Runs without SUPERUSER or BYPASSRLS privileges, making policy bypass impossible at runtime.
- Transaction-Scoped Tenant Context: Every database transaction binds app.company_id via SET LOCAL before executing any business query.
- USING & WITH CHECK Policies: PostgreSQL filters reads and blocks cross-tenant writes automatically at the row level.
- Defense in Depth: AES-256-GCM encryption for signing keys, SHA-256 hashed API tokens, HttpOnly session cookies, and append-only audit logs.
Practical Takeaway: When auditing any cloud ERP vendor, ask directly whether tenant isolation is enforced inside the database engine (RLS) or only in application code, and how signing keys are encrypted at rest.
Read our Privacy Policy and Technical Documentation to learn more about LAR ERP security controls.