Menu

A Tenant Leak Does Not Throw an Error. It Just Returns the Wrong Rows.
πŸ“°

A Tenant Leak Does Not Throw an Error. It Just Returns the Wrong Rows.

DEV Community: postgresΒ·INNERLUXESΒ·28 days ago
#pZVqaHiX
#devtopostgresql#devto#dev#tenant#table
Long article (2318 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Most bugs announce themselves. A tenant leak does not. The query runs, the status code is 200, the page renders, and somebody in one company is looking at another company's payroll.

That is what makes multi-tenancy different from the rest of the work. There is no stack trace to grep for and no error rate to alert on. The system is behaving exactly as written. It was written wrong.

This is how we build isolation into multi-tenant products so that a mistake has to get past three independent layers before it reaches a user, and so that every build actively tries to break it.

The two ways tenant data actually escapes

In every leak we have looked at, the cause was one of two things.

The first is a missing filter . Somebody wrote a query without the tenant predicate. Usually it is not the obvious code. It is the admin export, the cron job, the "quick" reporting endpoint, the findById helper that takes a primary key and nothing else.

// Looks harmless. It is the whole bug.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.