Exposed Supabase service_role key: what to do now
If your service_role JWT is in the browser bundle, treat the database as compromised. Rotation and cleanup steps.
Check your live site
Run the free ShipLatch scan on your own site without leaving this page.
Uses 1 of your 3 free scans today; a site scanned in the last 24 hours answers from that scan. Passive and read-only: we only look at what any browser can see. Only check sites you own or may test.
What the free scan checks
- Leaked keys in your live JavaScript (AI, payment and cloud keys), including a Supabase
service_rolekey - Files that should never be public, like
/.envand/.git - Supabase and Firebase secrets in the browser: an
sb_secret_key, a Supabase access token or a Firebase service-account file - HTTPS and security headers (CSP, HSTS, clickjacking protection)
It only reads what any visitor's browser can see. It doesn't log in, read your tables or check App Check.
Related free check: Is your Supabase app exposing more than it should?
The Supabase service_role key bypasses RLS entirely. It belongs only on a trusted server (Edge Functions, a backend you control). If it appears in your JS bundle, assume an attacker already has it.
Do this immediately
- Rotate. Supabase → Project Settings → API → reset the JWT secret / rotate service_role (and update any legitimate server that used the old key).
- Remove it from client code and redeploy. Search the repo for
service_roleandSUPABASE_SERVICE. - Audit data. Check for unexpected rows, new users, or modified storage objects since the key was public.
- Enable RLS on every table if it is not already on — rotation alone is not enough if policies are missing.
Escape.tech's vibe-coded apps study found hundreds of exposed secrets across public apps, with misconfigured Supabase permissions as a primary cause (State of Security of Vibe Coded Apps).
CRITICAL: remove every use of the Supabase service_role key from client/frontend code. Use the anon key in the browser. Move privileged operations into a Supabase Edge Function that reads the service role from server secrets. Enable RLS on all tables with auth.uid() policies.
Related: Enable RLS · Is my Lovable app secure?
Scan your app free
Paste your URL. ShipLatch checks for leaked keys, exposed /.env and /.git, and flags Supabase/Firebase so you know what to lock down. The free scan finds the issues; the $29 Fix Pack gives you fix prompts written for your app and re-scans that prove each fix worked.
Want the whole pre-launch process in one place? See what's inside App Security for Vibe Coders, our $9 PDF playbook, or go straight to checkout.