Day 1 of 24

Test your access rules by signing in as two different users

Rules that are switched on can still show one user the records of another.

What goes wrong

The reliable test of your access rules is to sign in as two different users and try to open each other’s records. Row-level security (RLS) is a set of rules inside the database that decides which rows each signed-in user may read or change. The dashboard shows whether RLS is switched on, and says nothing about whether each rule is correct.

How to check

  1. Create two test users in two separate accounts, plus a second member inside one of them.
  2. Sign in as the first user and write down the address of one private record.
  3. Sign in as the second user and open that same address directly.
  4. Repeat for every kind of private record, and try editing as well as reading.

How to fix

Once RLS is on, Supabase refuses every request that no policy allows. Write a separate policy for reading, adding, changing and deleting, each naming exactly who it lets in: the owner of the row, or a member of the account it belongs to. Keep the two test users and rerun the steps after every change to the rules.

What good looks like: The second user gets an error or an empty result for every private record, in lists and by direct address.

Source: Supabase: Row Level Security

What we saw in an audit

In one audit, a member saw 0 rows in a private list and could still open each of those records by its ID.

Sample report based on a real audit. Client details and figures changed.

Rather have someone run this check for you?

Have your Supabase rules tested
Test your access rules by signing in as two different users