Launch weekSIGSHIP is on Product Hunt and LiftOff. 50% off every plan with code LAUNCH50 until Sunday 6 December (Solo monthly has its own founder offer): Pro is $74.50 and Business $249.50, paid once.Launch week: 50% off · LAUNCH50See plans →Plans →
  1. Home
  2. The 30 checks
  3. Browser code uses the Supabase admin key
🔑 Keys & passwords · Fix now (SEV-1)

Browser code uses the Supabase admin key 

In plain English: Browser code uses Supabase's admin (service role) key, or calls supabase.auth.admin, which only works with that key. The admin key skips every row level security rule, and anything in browser code can be read by every visitor.

What happens if you ship it

Anyone who opens dev tools can read the key, then read, change or delete every row and every user account. No row level security policy applies to it.

How to fix it technical

Move this call to a server route or an edge function that checks the caller is an admin, and use the service role key only there. The browser keeps only the publishable (anon) key.

Let your AI tool fix it

Paste this into Lovable, Bolt, Cursor, Replit or Claude Code:

Prompt for your AI tool
Fix this problem in my project: Browser code uses the Supabase admin key. Move this call to a server route or an edge function that checks the caller is an admin, and use the service role key only there. The browser keeps only the publishable (anon) key. Change only what this fix needs, then tell me what you changed and anything I have to do myself.

Check your app

Run npx sigship in your project folder. It reports this problem as supabase-admin-in-browser, along with 29 other checks. Nothing leaves your computer. New to the terminal?

Questions

What is the difference between the anon key and the service role key?

The anon (publishable) key is meant for the browser and is limited by your row level security rules. The service role (secret) key ignores those rules and must only be used on a server.

How do I run admin actions, like deleting a user?

Put them in an edge function or server route that checks the caller is an admin, and call that from the browser. Keep the service role key in the server's environment only.

I removed the key from the code. Am I done?

Not yet. Rotate it in the Supabase dashboard, because it has already shipped to browsers. Then give the new key only to server code.

See every check · Jargon, explained