How do I stop one customer seeing another customer's data in my AI-built SaaS?
Plan and test tenant isolation in an AI-built SaaS app, including API access, database policies, private files, background work, and support access.
Key takeaways
- A separate dashboard does not establish customer-data isolation.
- Enforce tenant boundaries where data is read or changed.
- Test more than the main list, including files, exports, jobs, and support tools.
In this article
Prevent cross-customer access by enforcing tenant permissions wherever the app reads or changes data, then testing those boundaries with different customer accounts. Do not rely on a hidden menu or a filtered dashboard. Files, exports, background tasks, and support tools need appropriate boundaries too.
For applications using Supabase, its row-level security documentation explains a database mechanism for controlling row access. Whether a specific app is isolated depends on the policies, roles, and access paths actually configured.
What does a tenant mean in our app?
A tenant is usually a customer organization or workspace. Define whether a person can belong to more than one organization, how invitations work, and who may change that membership. Those business rules must be consistent with the implementation.
Write a simple role matrix before asking a coding agent to add permissions. For example, a workspace member might view orders, a manager might approve them, and a support user might have restricted diagnostic access. "Admin" should have a precise scope.
Avoid treating an organization identifier supplied by the browser as sufficient authority. The system needs to establish that the current identity can act for that organization.
Which paths are easy to overlook?
| Path | Question for the review |
|---|---|
| Record detail | Can another tenant's record ID be requested directly? |
| File storage | Does a copied download link expose a private document? |
| Search and exports | Are results limited to the authorized organization? |
| Background jobs | Does the job retain and enforce the correct tenant context? |
| Support tools | Is cross-tenant access deliberate, limited, and reviewable? |
An app can correctly filter its main table while leaking information through one of these other routes. Test each route that exists in the release.
What should a practical test look like?
Create two test organizations with distinct records and users. Verify legitimate access first, then attempt the relevant cross-organization reads and changes in the authorized test environment. Check both the response and the resulting stored data.
For an illustrative supplier portal, organization A should not be able to read organization B's quote, attach a document to it, or approve it. Include an account that loses membership after a session has already started.
Keep expected results and evidence with the test case. When the app gains a new export or automation later, add a check for that new path rather than assuming the original boundary automatically extends to it.
Who should review database and service credentials?
Ask which credentials the frontend, server, and background workers use. Elevated access can bypass ordinary policies in some architectures, so its use needs particular attention. The developer should explain why each component needs its access and where the relevant checks happen.
Keep customer isolation part of future change review. A new administrator screen or integration can create another path across records even when the existing database policies remain unchanged.
For a business owner, the useful deliverable is a documented model and evidence for the actual app, not a statement that the chosen database "supports multi-tenancy."
Check isolation before onboarding more organizations
Bring the role matrix and examples of the records each customer should access. Arrange a SaaS app review to inspect the boundaries and prioritize any corrections before the next rollout.
Frequently asked questions
Is adding a tenant_id column enough?
No. The application needs rules that use tenant identity correctly on every relevant access path. The presence of a field does not establish that those rules are enforced.
Can a user belong to two customer organizations?
Yes, if the product requires it. Define how the active organization is selected and how membership and roles are checked for each action.
Do we need a separate database for every customer?
That is an architectural decision based on requirements and operating constraints. Either shared or separate arrangements still require correct identity, access, configuration, and testing.
Estimate your project cost, token budget, and automation ROI
We built free, production-calibrated tools to help engineering leaders forecast token consumption, compare build vs buy scenarios, and audit code security.
Work with us on this
Build a focused first version of your product with AI-assisted development, engineering review, and a clear release scope.
Vibe code to productionReview an AI-built prototype, fix the important gaps, and prepare a release your team can maintain.
SaaS DevelopmentExpert SaaS Development services by FoundrySoft. We build scalable, secure, and modern solutions tailored to your business needs.
Related reading
Compare vibe-coding agencies by their review process, defined scope, evidence, account ownership, handover, and ongoing support instead of demo speed alone.
Review mobile layouts, form labels, keyboard access, focus, errors, and motion in an AI-built app using real journeys instead of screenshots alone.
Understand prompt injection in AI-powered business apps and review the data, tools, credentials, and approval boundaries around the model.
Let's build something great.
Have a project in mind? We are an elite software and AI development studio ready to bring your ideas to production. Let's talk about your roadmap.