Two layers
Each business-owned row carries a business id. The database enforces access with row-level security, and the API independently checks membership and role on every request. Either layer alone would be one bug from a leak; together a single mistake is not enough.
For AI
The model never chooses which business to read. The system fixes the business from the authenticated session before any tool runs.
Test it
- Write a test that a user of business A cannot read or write business B.
- Test the negative path for every new table and endpoint.
Part of: Developer fundamentals
Next recommendedEvaluating an AI featureRelated
Last updated 2026-09-25. Something unclear or wrong? Tell us.