Skip to main content
Sealgap

What is a two-user test?

A two-user test checks whether one signed-in user can reach data that belongs to another. It uses two test accounts, each with records of its own. Signed in as the first, it asks the database for the second account's records. If any come back, the access rules are too wide.

Why it is needed

The mistake it looks for is the most common serious one in web apps. In the OWASP API Security Top 10 it is the first entry, under the name broken object level authorization: the app checks that a user is signed in, but not that the record they ask for is theirs.

In apps built with AI app builders it is easy to miss, because the app looks right. Each user sees their own records on the screen, since the screen asks for them with a filter. The filter is in the browser. The database decides what is actually handed out, through Row Level Security policies, and a policy can be switched on and still let every signed-in user read every row.

How it works

  1. Create two ordinary accounts in the app, made for testing only. Never use a real customer's login or an administrator's.
  2. Sign in as each and create some data, so that each account owns a few records.
  3. Sign in as the first account and ask the database directly for records whose owner is the second. Do the same the other way round.
  4. Repeat the requests without signing in at all.

The requests go to the database with the app's public key, the same way the app itself talks to it. That matters: the question is not what the app's screens show, but what a person with the app's key and an account can get.

What a result means

If a record comes back that belongs to the other account, one customer can read another customer's data. That is a finding to fix the same day.

If nothing comes back, the tables that were tried kept the two accounts apart at the time of the test. It does not prove that every table is right, and it stops being current when the app changes. A new table added by a prompt gets whatever policy made the new screen work, so the test is worth repeating after every round of changes.

A test that only reads can be run against a live app without risk to the data, which is what makes it suitable as a nightly routine. The five policies that leave a table open are the usual causes when it fails.

Also known as

cross-account test horizontal access test IDOR test

Free check

See what one of your apps answers.

Certificate, browser protections and keys in public code. No account needed.

See what one of your own apps answers.

The free check looks at an app from the outside: whether it answers, its certificate, its browser protections and keys in its public code.