cd /news/ai-safety/supabase-service-role-key-exposed-in… · home › topics › ai-safety › article
[ARTICLE · art-163732] src=dev.to ↗ pub= topic=ai-safety verified=true sentiment=↓ negative

Supabase service-role key exposed in the browser

A developer at Axonscape's Launchpad documented a common security flaw in AI-built apps: Supabase's service-role key, which bypasses all Row Level Security, is frequently placed in browser-side code by AI coding tools like Lovable, Bolt, v0, Replit and Cursor when RLS blocks a query, exposing the entire database to every visitor. The team published a fix prompt directing developers to move the key to server-side code, use the anon key in the browser, tighten RLS policies and rotate the key, alongside a free launch check that scans public GitHub repos or uploaded code to catch this and other pre-launch failures.

by read1 min views1 publishedNov 4, 2026

The service-role key skips every Row Level Security rule. Used in browser code, it's handed to every visitor, who can then read, change or delete your whole database.

Code that runs in the browser creates a Supabase client with SUPABASE_SERVICE_ROLE_KEY (or a key whose role is service_role).

AI tools reach for the service-role key when a query is blocked by RLS: it makes the error go away by switching security off. In browser code, the key ships to everyone.

Paste this into Lovable, Bolt, v0, Replit or Cursor:

The Supabase service-role key is used in code that runs in the browser. Move every use of it to server-side code (an API route or edge function), use the anon key in the browser, and make the RLS policies allow what the app needs. Then tell me to rotate the key in Supabase.

The full page, with the request ready to copy, is at launchpad.axonscape.com/fix/supabase-service-role-key-in-browser. I work on Launchpad by Axonscape, which runs a free launch check for apps built with AI tools: it finds this and the other things that break at launch, from a public GitHub repo or a .zip of the code, and keeps nothing.

── more in #ai-safety 4 stories · sorted by recency
── more on @supabase 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/supabase-service-rol…] indexed:0 read:1min 2026-11-04 · —