Software & SaaS

Five tenant isolation checks before you launch a SaaS product

One of the most damaging SaaS bugs shows one customer another customer’s data. Five checks a small team can run before launch.

Why this check comes first

In a SaaS product, many customers share one application and often one database. Each customer is a tenant. The promise every tenant relies on is that they see only their own records.

Breaking that promise is rarely a dramatic attack. It is usually one query that forgot to filter by customer. These five checks look for that mistake in the places it hides.

1. Change the ID in the request

Sign in as customer A, open a record and note its ID. Sign in as customer B and request that ID directly. The server should refuse.

Repeat for every type of record and for edit and delete requests, not only for viewing. IDs also travel in request bodies and API calls, so test those too. Then change the tenant named in the subdomain, header or token and confirm the server checks it against the signed-in session. Hiding a button in the interface is not a control.

2. Check lists, search and exports

Single-record pages are usually protected first. Lists, search results, reports and exports are added later and are where the filter gets missed.

Create a record with a distinctive name in one account and search for it from another. Run each export and look for rows that do not belong. Check that cached results are stored per customer.

3. Check background jobs and emails

Scheduled jobs and notification emails run without a signed-in user, so they do not pass through the same checks. Confirm each job works on one customer’s data at a time and that emails go only to that customer’s users.

5. Check what staff tools can see

Support and admin tools are built to cross customer boundaries. Limit who can use them, record each access and make sure a customer account cannot open staff tools or gain staff privileges.

Make the checks repeatable

Turn each check into an automated test with two test customers. A test that fails when a cross-customer request succeeds will catch that mistake on the endpoints it covers.

Sources and further reading

All insights

Discuss your project

Tell us which systems are involved and what you want to improve.