Implementing tenant isolation in shared application platforms
Implementing tenant isolation in shared application platforms connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding tenant isolation in shared application platforms helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Authorisation determines which resources and operations an established identity may use. It must be enforced where protected data is read or changed. User interface restrictions, obscure identifiers and documentation can help usability, but they do not replace the service's own permission decision.
Multi-tenant applications serve multiple customers (tenants) from a shared infrastructure, codebase, and often shared databases. This architecture is the foundation of modern SaaS platforms, offering cost efficiency and simplified operations.
However, multi-tenancy introduces critical security challenges: a single vulnerability can expose all tenants' data, misconfigurations can leak data across tenant boundaries, and resource contention can impact availability.
Why it matters
Consider a realistic failure: a shared service selects a tenant from untrusted request data without checking the caller's membership.
A missing check can expose another account's information or let an ordinary user perform a privileged action. The result should be described by the actual records and operations reached, including whether access crosses a customer or organisational boundary.
Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.
How penetration testers check for it
Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.
- Compare users with different roles and ownership relationships.
- Exercise read, change, delete and alternate access paths.
- Test nested resources, background processing and state changes.
- Confirm rejection as well as the legitimate successful journey.
How to fix it
Use the appropriate maintained mechanisms and verify the result in the actual production configuration.
- Choose identifiers appropriate to their exposure risk. Opaque, random identifiers can reduce enumeration, but they are not authorisation controls.
- Treat client-supplied tenant identifiers as selectors only. Verify that the authenticated principal is authorised to act in the selected tenant.
- Connect the normal application request path with a least-privileged role that is neither a superuser nor a BYPASSRLS role.
- Do not serve ordinary tenant-scoped requests through a privileged connection. A privileged job must explicitly authorize and constrain its tenant set or cross-tenant operation because RLS will not do so.
- Enforce permission checks at each protected operation.
- Maintain regression cases for unauthorised users and changed permissions.
A successful response alone does not prove unauthorised access. Establish whose resource was affected and what the caller was legitimately entitled to do.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Tenant isolation across shared API endpoints
- Tenant isolation and document permissions in RAG systems
- Auditing concurrency, shared state and race conditions
Read about our methodology or contact pentested.com to discuss secure development and code review.