Row-level security
Rules inside the database that decide which rows each signed-in user can read or change.
What it is
Row-level security (RLS) is a set of rules stored inside your database that decide which rows each person can see or change. A row is one record, like one invoice. A rule might say: you can read an invoice only if it belongs to you.
The database enforces these rules itself, not your app's screens. That matters because hiding a button in the interface doesn't stop someone from asking the database directly. Without RLS, any signed-in visitor, and sometimes any visitor at all, may be able to read a whole table.
Use it on every table that holds user data, and check it before you launch. If you hit an error like "new row violates row-level security policy", the rules are working but are missing a case, often a rule for adding rows.
RLS is not login. Authentication says who you are; RLS uses that answer to decide what you can touch.
How to ask for it
“Make sure people can only see their own stuff.”
“Turn on row-level security for the invoices table. Add policies so a signed-in user can read, edit, and delete only the rows that belong to them, admins can read all rows, and anonymous visitors get no access.”
"Only see their own stuff" could be done by hiding things in the screen, while "row-level security" puts the rule in the database and the prompt says who gets which access.
You've seen this in
- YYour Amazon order history showing only your orders, never someone else's
- GGoogle Drive listing only the files you own or that were shared with you
- TThe "new row violates row-level security policy" error that Supabase-backed apps built with Lovable show when a rule is missing