General information, not a security guarantee. Apps that handle payments or health data should get a professional review.
The short version
Many apps built with AI tools keep their data in Supabase, an online database. Your app reaches it with a public key, and that key sits in every visitor’s browser on purpose. Supabase’s own page says anyone can read that key, so it reaches only what your access rules allow.
The access rules are a switch on each table, plus rules that say who may see or change which rows. Supabase calls them row-level security. If the switch is off, or a rule lets everyone in, a stranger can read the table. Nobody needs to log in to do it.
What goes wrong without it
Say your builder made a table of profiles, with each user’s email and name, and the switch was never turned on. A stranger copies your public key from your site and asks the database for the table. Every email comes back, and they can change people’s names too. On our test database, that is exactly what happened.
There are two more mistakes to watch for:
- The switch is on, but there are no rules. Then nobody gets in, including your own users, so your app shows nothing.
- A rule lets everyone in. A rule whose condition is just
truemeans “anyone”. The switch is on, and the table is still open.
The fix needs both parts together: the switch on, and a rule that lets each person reach only their own rows.
Find the open tables with Claude Code
Claude Code is Anthropic’s coding assistant. Run it in the folder that holds your app’s code. It reads your database files, called migrations, which are the saved list of every change made to your database. It does not look at your live database.
- Paste the prompt below. It asks Claude not to change anything yet. In our test, Claude was only allowed to read files, so we didn’t see whether it holds back when it can write.
- Read the answer. It should list each table, say whether a stranger can read or change it, and show the fix as one block of database code. A table meant to be public, such as a list of recipes, should stay readable.
- If the list looks right, ask Claude to save the fix as a new migration file. Then apply it, or ask your builder to. We did not test this step.
- Run the prompt again. It should now say every table is closed.
Check who can read and change my data. I am not an engineer, so use plain words.
1. Read every Supabase migration in supabase/migrations and work out, table by table, what a stranger who is not signed in could read or change. Say which tables are open.
2. Write the SQL for one new migration that fixes every problem, and show it to me in one block. Turn on row-level security for each private table and add policies so a signed-in person can only read, add, change and delete their own rows (match the owner column to auth.uid()). If you turn security on for a table that has no policies, add the policies in the same SQL, because otherwise my app shows nothing. If every table is already closed, say so and write no SQL.
3. Leave tables that are meant to be public readable by everyone but not changeable. Never use a policy whose condition is just true on a table with personal data.
4. Do not change any file yet. I will read your answer first.
5. Tell me which tables the fix changes and what to test by hand.A policy is one of the rules. SQL is the language databases use. auth.uid() is Supabase’s way of saying “the person who is signed in”.
In our test on Claude Code 2.1.329, a small made-up app had all three mistakes: a profiles table with the switch off, an orders table with an “anyone can read” rule, and a journal table with the switch on and no rules. In both runs, Claude named all three in plain words and left the public recipe list alone. We tried each fix it wrote on a test database. Strangers then got nothing from the three private tables, each user saw only their own rows, and the recipes still showed. On a copy that was already fixed, both runs said every table was closed and wrote no new code.
The prompt’s wording matters. When we changed it to ask for rules that let any signed-in person reach every row, Claude did just that, and on the test database one user could read another’s journal.
How to check it worked
Claude reads your files, not your live database. Someone may have changed the database by hand in Supabase’s dashboard, or a migration may never have been applied. So ask each table for data the way a stranger would.
Terminal is the app on your computer where you type commands. The command below uses curl, a small tool that asks a web address for data. Replace the two capital-letter parts.
- Your project address is in the Supabase dashboard under Integrations > Data API. It looks like
https://your-project.supabase.co/rest/v1/. - The public key is under Settings > API Keys. Use the publishable key, or the older one called
anon. Never use a secret orservice_rolekey: it skips every rule.
curl "https://YOUR-PROJECT.supabase.co/rest/v1/profiles?select=*" -H "apikey: YOUR-PUBLIC-KEY"An open table answers with rows. A closed table answers [], an empty list, or an error saying permission denied. Both mean a stranger got no rows. Do this for every table that holds personal data, putting its name in place of profiles. A public table, such as a recipe list, should still show its rows.
We ran our checks on a test database on our own computer, not on a Supabase project online, and we didn’t run this command for this guide. Try it on yours and trust what you see.
Then use your app. Sign in as yourself: you should see your own data. If you can, sign in as a second person too. You should see only their data, never yours.
The Supabase access rules review skill checks your migrations for these mistakes in Claude Code. If you haven’t yet, also check where your API keys are: a secret key in the browser skips every rule on this page.
Before you launch, check
- Every table of users' data has its access rules switched on
- Each private table has rules that let people reach only their own rows
- No rule on a private table is just true
- A request with no sign-in gets no rows from any private table
- A second user cannot see your data in the app