← Leakproof

The security checklist for apps built with Lovable

Lovable projects are Vite apps that usually talk straight to Supabase from the browser. That means the anon key is public by design and a few settings decide whether your data is safe. Here are five checks, about ten minutes.

1. Row Level Security

Run this in the Supabase SQL editor. Every row returned is a table that the anon key can read and write through the REST API, whatever your UI shows:

select schemaname, tablename
from pg_tables
where schemaname = 'public' and rowsecurity = false;

Fix each one, then add only the access you need:

alter table public.<table> enable row level security;

Also look for policies that let everyone in; using (true) on anything per-user is a leak:

select tablename, policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'public'
  and (qual = 'true' or with_check = 'true');

2. Secrets behind VITE_

Anything starting with VITE_ is copied into the browser bundle at build time. Fine to be public: the Supabase URL and anon key, Stripe publishable keys (pk_…). Never public: OpenAI, Anthropic or other AI keys, Stripe secret keys (sk_…), the Supabase service_role key, database URLs. Find them in your code:

grep -rnE "(NEXT_PUBLIC|VITE|EXPO_PUBLIC|REACT_APP)_[A-Z0-9_]*(SECRET|SERVICE_ROLE|PRIVATE|OPENAI|ANTHROPIC|DATABASE_URL|WEBHOOK)" \
  --exclude-dir=node_modules --exclude-dir=.git .

3. Edge Functions for API keys

Vite apps have no server of their own: put the call in a Supabase Edge Function, read the key there with Deno.env.get('OPENAI_API_KEY'), and set it with supabase secrets set OPENAI_API_KEY=…. Check the user is signed in and rate-limit them in the function, before spending money. If a key was ever public, create a new one in the provider's dashboard, deploy with it, then delete the old one.

4. Storage buckets

select id, public from storage.buckets;

A public bucket serves any file to anyone with its URL, with no policy check. Fine for avatars; not for invoices, uploads or exports. Make those private and use createSignedUrl().

5. Prove it from the outside

Policies are easy to misread. Test with the same key an attacker has (your anon key, from your site's JS):

curl "https://<project>.supabase.co/rest/v1/<table>?select=*&limit=5" \
  -H "apikey: <anon key>"

Signed-out, this should return [] or an error for any private table. Then sign in as test user A and confirm you can't see user B's rows.

Check your repo automatically. Leakproof's free scanner flags tables without RLS, allow-all policies, secrets behind public prefixes, committed .env files and more. It runs locally:
npx github:beingRealFrank/leakproof
Want someone to go through all of this, plus your live project, and send fix PRs? See the fixed-price audits.

More checklists: Supabase RLS · Firebase rules · Secret keys in your frontend · Bolt.new