Skip to content

Access control

Supabase service-role key used in client-side codeaccess.supabase-service-role-in-client

The service-role key bypasses Row Level Security entirely. Referenced from a "use client" component it ships to every browser, giving any visitor full read/write access to your whole database.

  • In force Rule access.supabase-service-role-in-client
  • 3 clauses

At a glance

access.supabase-service-role-in-client
Severitycritical
CertaintyObserved — the code as written is the problem
Looks atyour source code
When it runsRuns on every scan

How to fix it

Use the service-role key only in server code (route handlers, server actions, edge functions). In the browser use the anon/publishable key with RLS.

Check your own app

Run npx scanlyfix scan in your project. Every finding gets an id; after fixing, npx scanlyfix verify <id> proves it is gone.

If it is a false positive in your project, silence that one line with // scanlyfix-ignore-next-line access.supabase-service-role-in-client -- <why>.

All rules

Your code stays
on your machine

Only findings are uploaded, and only to your own dashboard.