How do you restrict Supabase rows to their owner?

Being logged in does not authorize access to every row. Use an RLS policy that compares the row’s owner with the authenticated user. Test reads and writes separately.

How to check it

  1. Verify the ownership column and user identifier type.
  2. Query user A’s record as A, B and an anonymous session.
  3. Test that a write cannot transfer ownership to another user.

Concrete example

Example: A can read their note, but B cannot read it even with its record identifier. Hiding it in the interface is insufficient; direct API access must also be denied.

Avoid a false conclusion

Do not disable RLS or hand a service credential to the browser. Find which policy condition rejected the operation.

Reference

Official reference

VCT Editorial

All answers