Tenant isolation in the database
- Every company-owned table carries the company identifier and a PostgreSQL row-level security policy
- The application connects as a database role that cannot bypass those policies
- The company is set on each database connection from the signed-in token and cleared when the connection is returned
- A query that forgets a company filter still cannot read another company's rows