Dev Tools · 1h ago
Fix multi-tenant leaks by deriving tenant from user, not request
A multi-tenant SaaS app was resolving the active tenant from the client-controlled request (subdomain/header) instead of the authenticated user's organization membership. This made the client the source of truth, risking data leaks. The fix derives the tenant from the user's organization in middleware, failing closed with a 403 if no org is found.
Meridian48 take
The article correctly identifies a common security anti-pattern, but the fix is a basic best practice that experienced developers should already know.
multi-tenantsecurity