Supabase RLS, explained for people who do not write code

Published 2026-11-16 by Nordik. Written with AI from the sources listed at the end.

  1. The one-sentence version
  2. Why your app needs it
  3. The roles you will see
  4. What a healthy setup looks like
  5. Five mistakes worth knowing by name
  6. How to check your tables
  7. Why AI builders get this wrong
  8. A worked example in plain words
  9. What to do when you are unsure

If your app was built with Lovable or Bolt, there is a good chance its data lives in Supabase, a service that keeps your app's data in a database. And if you have read anything about app security lately, you have met three letters: RLS. This post explains what they mean, why they matter to you as an owner, and how to check yours in about twenty minutes.

The one-sentence version

Row Level Security is a rule system inside your database that decides, row by row, who may read or change what. A row is one record, such as one order, and a table is a list of them. The Supabase documentation describes each policy (one rule) as acting like an extra condition added to every request to that table. Without such a condition, a request is limited only by what the database role (a set of permissions) is allowed to do.

Why your app needs it

Your app runs in the visitor's browser, which is the program people use to open websites, such as Chrome or Safari. That means the address of your database and your public key are visible to anyone who looks at the page. A public key is a long password made to be seen by everyone. This is normal and by design: Supabase says the publishable key is meant to be used in web pages. The safety comes from RLS. The key opens the front door; RLS decides which rooms the visitor can enter.

So when RLS is off on a table in the public schema, the table is open to whoever holds that public key, which is anybody. When RLS is on but there are no policies, the Supabase documentation says the API (the address programs call to get your data) returns no data for the publishable key until you write policies. That fails safe, even if it makes your app look empty.

The roles you will see

  • anon: a visitor who is not signed in.
  • authenticated: a visitor who is signed in.
  • service_role (the secret key): a trusted server, which is the part of your app that runs on the service's computers, where visitors cannot look. It bypasses RLS completely and opens everything, so its key must never reach a browser.

What a healthy setup looks like

For a table of user-owned things, such as notes or orders, a healthy policy says in effect: a signed-in user may see and change only the rows that belong to them. For public things, such as a product list, a policy may allow everyone to read, and only your own server to write.

A useful habit is to write each policy as a sentence before you trust it. "Signed-in users can read their own orders." "Anyone can read published posts." "Only the server can create invoices." If you cannot say it in one sentence, the rule is probably doing more than you intended.

Five mistakes worth knowing by name

  • RLS turned off on a table that holds personal data.
  • A policy that allows everyone to read ("true") on a table that is not meant to be public.
  • A policy that compares the user's ID to a column, forgetting that for a signed-out visitor the ID is empty. The Supabase documentation recommends an explicit not-null check, which means a rule that says the ID must exist.
  • Using user_metadata for permissions. The documentation warns that signed-in users can edit that field; app_metadata cannot be changed by them. Both are extra details stored with each account.
  • Database views, which are saved lookups that combine tables. The documentation says views skip RLS by default because they run as their owner, and it describes setting security_invoker on newer Postgres versions (Postgres is the database software Supabase uses) so they follow the underlying policies.

How to check your tables

Open the Supabase dashboard, find the Table Editor, and look at each table. A table with RLS on shows a note to that effect, and the Authentication section lists policies. For each table, ask three questions. Does it hold personal or private data? Is RLS on? Can I explain every policy in one plain sentence?

Then test from the outside. Sign out, open your app, and try to reach pages that show private data. Create two test accounts and confirm neither can see the other's records. This is the same access-control failure that OWASP, a nonprofit that lists common security problems, ranks first in its 2021 list.

Why AI builders get this wrong

An AI builder's goal is a working app. A table with no rules, or a loose rule, makes the app work immediately, and nothing on the screen warns you. Lovable's documentation says misconfigured policies are a common cause of data leaks and recommends reviewing them before publishing and after auth or schema changes. (Auth is sign-in, and a schema is the layout of your tables.) That is the right rhythm: review after every change that touches sign-in or tables.

A worked example in plain words

Imagine a notes app. The table has a column for the note text and a column for the owner. A healthy rule says: a signed-in user may read a note if the owner column matches their own ID. A user who is not signed in has no ID, so they match nothing and see nothing. When you test with two accounts, account A sees A's notes, account B sees B's, and a signed-out visitor sees an empty page. That is RLS doing its job.

What to do when you are unsure

Do not guess. If a policy reads like code you cannot follow, ask the tool you built with to explain it in plain language, then test the explanation with two accounts. If the table holds anything sensitive, get a second opinion before launch.

Nordik App Audit is an AI-performed audit of your app's code. It explains what it found in plain words and gives you a fix instruction for each finding. It is not a pentest (a test that tries to break into the running app), and like any review it can miss things. It supports every platform: any app can order, whatever it is built with. The current price and terms are on the Nordik home page. Reading your database rules is one of the first things it does. The free scan accepts apps from any platform and points you at where to look first. It is a starting point, not a verdict.

Sources

Each source below was read on 2026-11-16. Documentation changes over time, so check the source for the current wording.

  • Supabase documentation, Row Level Security, accessed 2026-11-16
  • Supabase documentation, API keys, accessed 2026-11-16
  • OWASP Top 10:2021, A01 Broken Access Control, accessed 2026-11-16
  • Lovable documentation, Security, accessed 2026-11-16