The key in your front end is public. What stops a stranger using it?
Here’s the request to send to a freshly built app of your own, before anything else. Take the Supabase publishable key from your own front end, ask the REST endpoint for a single row of a table, and don’t sign in. If a row comes back, nothing else on your launch checklist matters until that’s fixed.
The project ref is the first part of your Supabase URL. The key is in your front end because it has to be: the browser needs it to talk to the database. Older projects call it the anon key. The limit=1 at the end means you only see whether any row comes back, and you don’t dump a table into your terminal. Use a test project or test data, and run it against your own project only.
It isn’t a trick. The Data API is built to be called straight from the browser, and Supabase’s documentation says publishable keys are safe to expose in a web page, a mobile app or source code. Tables and views exposed through the Data API without Row Level Security (RLS) can be accessed by any role with matching grants, which are the database permissions each role has been given.
So the launch question is what your database answers when a stranger holds that key. Every check below is a different way of asking it.
This applies when your Lovable app keeps its data in Supabase. Lovable’s own security documentation calls misconfigured Row Level Security (RLS) rules a common cause of data leaks and recommends reviewing policies before publishing and after changes to authentication or database structure. This article makes no claim about how many apps get this wrong. It lists what to check.
curl "https://<project_ref>.supabase.co/rest/v1/<table>?select=*&limit=1" \
-H "apikey: <publishable key, or legacy anon key, from your own front end>"If RLS is off, the table is open, whatever else you built
Row Level Security, RLS for short, is the Postgres feature that lets the database decide, row by row, who may read or change what. In Supabase the rules are policies you attach to each table. RLS on with no policies means nobody gets rows through the API. RLS off means the policies you wrote aren’t consulted at all.
Supabase’s guidance is one line: enable RLS on every table in an exposed schema. It’s also the first item under Database on Supabase’s production security checklist. RLS on with no policies fails closed, which is what you want. The dangerous state is the opposite one.
You don’t have to hunt for these by hand. Supabase’s database advisors flag ‘RLS disabled in public’ as an error: anyone with your project URL can read, edit and delete all data in that table. They also flag the quieter version, a policy that exists on a table where RLS was never turned on, so the policy has no effect.
Run the advisors and fix every error. Then don’t stop at a clean result. An advisor checks configuration. It can’t know that a table like notes is meant to be private to the user who owns each row, and that decides whether you leak data.
Here’s the smallest useful policy. It turns RLS on for a notes table and lets a signed-in user select only the rows whose user_id is their own. It covers reads only. Add insert, update and delete policies as the app needs them; with RLS on, anything without a policy is refused.
alter table public.notes enable row level security;
create policy "owner reads own notes"
on public.notes for select to authenticated
using ( (select auth.uid()) = user_id );A policy can exist and still say the wrong thing
The advisors list the shapes that cause trouble: an always-true condition such as USING (true), several permissive policies on one table that together grant more access than intended, and policies that reference user_metadata, which end users can freely modify.
The user_metadata case is easy to miss because a check like ‘is this user an admin’ reads naturally in a policy. Supabase’s RLS guide says raw_user_meta_data can be updated by the authenticated user and isn’t a good place to store authorization data, while raw_app_meta_data can’t be updated by the user. When you read a generated policy, search for user_metadata first.
Two clauses do the work, and the code block shows the difference. using decides which existing rows a user may touch. with check decides which new or changed values they may write. Select and delete policies use using, insert uses with check, and update combines both. An update also needs a matching select policy to work as expected. Test select, insert, update and delete separately, because a table that’s correctly locked for reading can still accept a write it should refuse.
One last detail from the same guide: auth.uid() returns null when nobody is signed in, so auth.uid() = user_id quietly evaluates to null and the row is never returned. That fails closed, which is fine. Supabase still suggests writing the null check explicitly so the intent is visible to whoever edits the policy next.
-- every row is visible to everyone
using ( true )
-- each user sees only their own rows
using ( (select auth.uid()) = user_id )Can account B read account A’s data?
This is the check a scanner can’t do for you, and the one not to skip. Do it in your own app, with test accounts and test records. Create two ordinary accounts. As account A, create a record. Signed in as account B, try to read it, change it and delete it by calling the API directly, not by clicking through the interface. The interface may hide the button. The API doesn’t care.
OWASP ranks Broken Access Control first in its Top 10:2025 and gives the classic scenario: an attacker modifies a parameter such as an account number and reaches someone else’s account. The OWASP API Security Top 10 calls the same failure Broken Object Level Authorization and notes that the check is usually implemented at the code level. In a Supabase app, much of that check lives in your policies instead, which is why the policies need the test.
Then repeat with no account at all, using only the publishable key, and with an ordinary user attempting an admin action. Anything that comes back and shouldn’t is a vulnerability, whatever the interface shows.
The OWASP API Security Top 10 also advises random, unpredictable record IDs. That’s useful hardening, and the ownership check remains the control that decides the outcome.
Where else can data leave without passing a policy?
Keys first. A secret key bypasses every RLS policy, so Supabase says to use it only in backend components and never in a browser, a shipped application or source control. The legacy service_role key is the older form of the same secret, and creating new keys doesn’t revoke the legacy ones. Search your repository and your built front end for both. Lovable’s documentation says the same from its side: API keys and other secrets can’t be stored safely in client-side code, so keep them in Secrets and call the API from server-side code.
Views are next. Supabase warns that views bypass RLS by default because they’re usually created by the postgres user. On Postgres 15 and later, setting security_invoker = true makes a view apply the policies of its underlying tables. The advisors flag security definer views, and views that expose auth.users, as errors.
Storage is the third door. It works through policies on storage.objects, and uploads are refused without one. A public bucket is different: it’s already publicly accessible, so check which buckets are public and what’s inside them. A service key bypasses Storage policies entirely, which brings you back to the first paragraph.
What a built-in scan and a clean advisor will not tell you
Use the scanners. Lovable includes two built-in security scans and Supabase has its advisors. Lovable’s documentation is open about the limits: its tools help identify common issues but can’t guarantee complete security, and it recommends an additional professional security review for apps that handle sensitive data or critical functions.
The gap is intent. A scan can see that a policy exists. It can’t know that refunds should need the admin role, that a webhook must verify who sent it, or that one customer must never see another customer’s invoice. Supabase’s production checklist includes the same instruction in one sentence: work out how an attacker could abuse your app, and mitigate each risk you find.
Two checks for payments and webhooks, in a test environment only. In your checkout request, change the amount to 1 and see whether the server accepts it. Send your webhook URL a POST with no signature and see whether it acts on it. If either works, the server is trusting the client.
The rest of that checklist is account and database hygiene, and it’s quick: SSL enforcement and network restrictions in the database settings, multi-factor authentication on your Supabase account, more than one owner on the organization, email confirmations enabled for sign-ups and test phone numbers removed. Tick them off, then spend your time on the ownership questions above.
The list, in the order to run it
Seven checks, one row each. The middle column says what a pass looks like. The last one says where the claim comes from.
| Check | What a pass looks like | Where it comes from |
|---|---|---|
| Row Level Security on every exposed table | The advisors show no ‘RLS disabled in public’ errors, and RLS is on for each table in an exposed schema. | Supabase RLS guide; database advisors |
| Policies tested per operation | Select, insert, update and delete each behave as intended, with no USING (true) and no user_metadata in a policy. | Supabase RLS guide; database advisors |
| Second-account test | Account B cannot read, change or delete account A’s records through the API, and an anonymous request gets nothing it should not. | OWASP Top 10:2025 A01; OWASP API1:2023 |
| Secret keys | No secret or service_role key in the browser, the built front end or the repository. | Supabase API keys guide; Lovable security overview |
| Views and Storage | Views apply the policies of their tables (security_invoker on Postgres 15 and later), and public buckets hold only public files. | Supabase RLS guide; Storage access control |
| Payment, webhook and admin flows | The server decides who may do what, instead of trusting a value sent by the client. | OWASP Top 10:2025 A01 |
| Account and database settings | SSL enforcement, network restrictions, MFA, email confirmations and a second owner are in place. | Supabase production security checklist |
When a second pair of attacker’s eyes helps
If you’d rather hand this list to someone who does it for a living, the security review for AI-built apps covers sign-up and login, who can read whose data in Supabase or Firebase, exposed keys, and payment, webhook and admin flows.
You get a fix list in order of risk with evidence for each issue, the exact code, configuration or prompt change for each fix, and a short call to walk through the results. I need the app URL, two test accounts with different roles and, if possible, read access to the repository and backend settings. Please don’t send production passwords by email. The review starts at $590.
A review reports on what was checked. It isn’t a certificate that nothing else is wrong, and I’ll say where the edges of the work were. If you run the seven checks above first, we spend the time on the questions only a person can answer.
Sources
- Supabase documentation: Row Level Security
- Supabase documentation: Securing your API
- Supabase documentation: Understanding API keys
- Supabase documentation: Storage access control
- Supabase documentation: Database advisors
- Supabase documentation: Production security checklist
- Supabase documentation: Data API overview (REST endpoint)
- Lovable documentation: Security overview
- OWASP Top 10:2025, A01 Broken Access Control
- OWASP API Security Top 10 2023, API1 Broken Object Level Authorization
Need this checked in your own product?
Security review for AI-built apps