LogicTrail
  • Trails
  • Check my app
  • Pricing
  • Sign in
  1. Trails
  2. /
  3. Teams and sharing
  4. · 4 minutes · Pro

The export with everyone's data

A customer clicked 'Export orders to CSV'. The file had 40,000 rows. Their team has 300 orders. The rest belong to your other customers.

This answers: Does the Supabase service role bypass RLS? No coding needed. 3 quick decisions.

  • Who may see what
  • Keys and secrets
  • Where your data lives

Checking your access…

Does the Supabase service role bypass RLS?

Yes. The service role key bypasses every policy by design, so any server code using it must check permissions itself. Leaks happen when that code also takes the team or user id from the URL or request body. Query with the signed-in user's client so RLS applies, and derive the team from their session.

Trail of the bug
  1. Browser
  2. Your server
  3. Database

Breaks at Your server: Service role key, team taken from the URL

Why AI tools write this bug

When a query fails because of , AI tools often switch to the service role key, which makes the error disappear along with the protection.

How to fix it

  1. Find every use of the service role key.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock

Common questions

Is the service role key ever okay to use?
Yes, for trusted server jobs like webhooks or admin tasks. Keep it out of the browser and never let a caller choose whose data it touches.

Related scenarios

  • The table anyone can readPro · 5 min
  • One field, a million creditsPro · 4 min
  • Permission denied for tablePro · 4 min

More on this trail

Teams and sharing: Removed members who keep access, invites anyone can use, exports that leak other customers, guessable share links.

Want someone to look?

We check AI-built apps for this and three other common leaks, in plain English.

Check my app
Sign in

Sign in to walk this one

3 decisions, about 4 minutes, and a prompt to check your own app for the same problem.

Sign in No password. We email you a link.

How to fix it

  1. Find every use of the service role key.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock