Check Tenant Isolation in Your Lovable SaaS Before the Next Feature
2026-11-07 · 7 min read
Your first customer can sign in, invite a colleague and open a dashboard. Before you add the next feature, check a different journey: can someone from another company reach that customer's records or files? A working login authenticates an account; it does not establish which company’s data that account may access. Tenant isolation means each company can reach only the data and actions you intended to share with it.
For a Lovable app backed by Supabase, start with a written access model, two fictional organizations and tests that cover both allowed and denied actions. Include membership changes and file access. An enabled RLS switch or a hidden button is not evidence that every path follows that model.
1. Write down what each person should be able to do
Imagine a shared project app with two organizations, Cedar and Harbor. Cedar has an owner, Alex, and a member, Sam. Harbor has its own owner, Robin. For this example, members can read and update their organization's projects, but only owners can invite people or change roles. No organization shares projects with the other.
| Person | Allowed | Denied |
|---|---|---|
| Alex, Cedar owner | Manage Cedar projects and memberships | Read Harbor projects or files |
| Sam, Cedar member | Read and update Cedar projects | Change roles or invite members |
| Robin, Harbor owner | Manage Harbor projects and memberships | Read or change Cedar data |
| Signed-out visitor | Open the public landing page | Read private projects or files |
Change this model to match your product before testing. Some products intentionally support guests, shared links or people in several organizations. Write those exceptions explicitly, including who can create a share and how it is revoked. Otherwise, a tester cannot distinguish an intended feature from an access failure.
2. Check the data rules behind the interface
Supabase separates table privileges from row policies: grants permit operations; RLS policies restrict rows. Review both for each exposed table. An organization ID in a request must not grant membership by itself. See the Supabase RLS guide for the platform's implementation guidance.
Ask the engineer to trace one project from the browser through every server route to the database. Include exports, search and background jobs. Privileged service-role access can bypass RLS, so server code using it needs its own authorization checks. Keep those credentials out of browser code. Do not test with an administrator credential and treat its result as an ordinary user's access.
3. Test the same record from the wrong account
Create a clearly labelled test project in Cedar. Open separate browser profiles for Sam and Robin so sessions stay distinct. Ask an engineer to repeat the underlying requests with those ordinary test sessions, rather than checking only which buttons appear. Include a valid action first: a policy that denies everybody can look safe while breaking the product.
| Test in the fictional app | Expected result |
|---|---|
| Sam reads and updates Cedar's test project | Allowed, with the intended change saved |
| Robin opens that project's URL or requests its ID | No Cedar record returned |
| Robin tries to change or delete Cedar's project | Denied; Cedar's record stays unchanged |
| Sam changes a new project's organization ID to Harbor | Denied; no Harbor project created |
| Sam calls the role-change or invitation action | Denied; memberships stay unchanged |
| Signed-out session requests the private project | No private record returned |
Check the stored result as well as the response. A failed screen does not establish that a write was rejected. Repeat the cases for related records such as comments, attachments and activity entries. Ask for automated regression coverage of the agreed allow/deny cases so a later feature does not silently reopen the same path.
4. Repeat after a role or membership changes
Remove Sam from Cedar and retry the private project from Sam's existing session. Also test an owner downgraded to member and a person switching between two permitted organizations. Decide how quickly revoked access must take effect, then test against that requirement.
If authorization uses JWT claims, Supabase notes that membership changes in app metadata are not reflected until token refresh. User-editable metadata must not determine permissions. Review the JWT guidance in the RLS reference and session lifecycle with your engineer; do not assume signing out one browser instantly revokes every token.
5. Treat files as another access boundary
Attach a synthetic file to Cedar's test project. Try listing, downloading, replacing and deleting it as Sam, Robin and a signed-out visitor. Use an obviously fictional file that contains no customer information. Confirm that denied writes leave the original intact.
Supabase Storage has its own operation-specific access policies. A database policy protecting a project row does not establish file protection. Inventory public buckets and issued download links separately, and agree how long shared access should last. Use the Storage access-control documentation when reviewing the implementation.
6. Keep a small record of what actually passed
For each case, save the app revision, test account and role, synthetic record ID, expected result, actual response and stored outcome. Record pass, fail or not tested. Redact tokens and credentials from screenshots and request logs. Assign each failure an owner and repeat the same case after its fix.
Lovable's security guidance describes automated checks as support for, rather than a replacement for, a thorough review. Use their findings alongside the access model and observed results. The useful deliverable is evidence of which boundaries were checked and which still need work.
Need help tracing the boundary?
Bring the app link, your access model and the failed synthetic case to a free MVP security review. Scope and access are agreed first; private rules and code require appropriate access. If repairs are needed, they are scoped separately through app rescue. For the broader release rehearsal, use the Lovable launch checklist.
Sources checked 2026-11-07
- Supabase: Row Level Security and JWT claims
- Supabase: Storage access control
- Supabase: User sessions
- Lovable: Security overview
Platform behaviour and plan limits change. Recheck these first-party sources before relying on this guidance.