Is Supabase Safe? Security Analysis

TL;DR

Supabase itself is secure and SOC 2 certified, but many Supabase projects are vulnerable because of misconfiguration. The #1 issue is missing Row Level Security (RLS). Tables you create in the dashboard get RLS switched on, but tables created with SQL or a migration (which is how AI builders make them) don't, and without it anyone holding your public key can read and modify the whole table. Supabase's own Security Advisor flags this for free, so run it before you launch.

What is Supabase?

Supabase is an open-source Firebase alternative providing a PostgreSQL database, authentication, realtime subscriptions, storage, and edge functions. It's popular for full-stack apps and is the default backend for many AI app builders like Lovable and Bolt.

Our Verdict

What's Good

  • PostgreSQL's mature security
  • Built-in Row Level Security
  • SOC 2 Type II certified
  • Auth with JWT tokens
  • Self-hosted option

What to Watch

  • RLS off for SQL-created tables
  • Public anon key exposed
  • AI tools often skip RLS
  • Complex policy writing
  • Easy to misconfigure

The RLS Problem

Row Level Security (RLS) is Supabase's key security feature. Whether a new table has it depends on how the table was made. Supabase's docs say tables created in the dashboard's Table Editor have RLS enabled by default, while tables created in the SQL Editor or by other tools need it enabled explicitly. AI app builders and migration files go through SQL, so their tables usually start with RLS off.

That matters because of a second default. On existing projects, every new table in public is granted to the anon and authenticated roles automatically, which makes it reachable through the Data API the moment it exists. In Supabase's words, "a table in an exposed schema without RLS is readable and writable by any role with a grant on it." Supabase has said it is changing the platform default so that exposure becomes opt-in, but projects created under the old default keep the grants until you change them.

Critical: Without RLS enabled, anyone who knows your Supabase URL and anon key (which are public in your frontend) can read, modify, and delete all data in that table. This is the most common security issue we see in Supabase projects.

Why This Happens

  • AI app builders create tables through SQL migrations, which skip the dashboard's RLS default
  • Quick prototypes skip security configuration
  • Developers may not understand the anon key exposure
  • Testing with RLS off and forgetting to enable it

How to Check

The fastest check is the one Supabase built. Open Advisors > Security Advisor in your project dashboard (or run supabase db advisors from the CLI). The lints worth reading first:

  • rls_disabled_in_public (error): a table in public is reachable through the API with no RLS at all
  • sensitive_columns_exposed (error): same problem, on a table whose column names look like emails, tokens or passwords
  • rls_references_user_metadata (error): a policy trusts user_metadata, which the signed-in user can edit themselves
  • permissive_rls_policy (warning): a policy like USING (true) that switches RLS on without restricting anything

If you'd rather ask the database directly, this lists every public table without RLS:

select tablename
from pg_tables
where schemaname = 'public'
  and rowsecurity = false;

An empty result is what you want, but it is not the finish line. A table with RLS on and a USING (true) policy passes this query and protects nothing, which is exactly the shape a hurried "fix RLS" prompt tends to produce. That is why the advisor check comes first.

Common Supabase Vulnerabilities

IssueRiskFix
RLS not enabledCriticalEnable RLS on all tables
Permissive RLS policiesHighReview and restrict policies
Service key in frontendCriticalOnly use in server-side code
Missing auth checksHighRequire auth in policies
Overly broad storage policiesMediumRestrict bucket access

Publishable, Secret, Anon and Service Role Keys

Supabase now issues two kinds of key, and most tutorials (and most AI-generated code) still use the older pair:

KeyLooks likeSafe in the browser?What it can do
Publishablesb_publishable_...YesWhatever your RLS policies allow
Secretsb_secret_...NoBypasses every RLS policy
anon (legacy)JWT starting eyJYesSame as publishable
service_role (legacy)JWT starting eyJNoSame as secret

Supabase says it is deprecating the legacy anon and service_role keys by the end of 2026, so expect AI tools to keep generating them for a while after that.

Never ship a secret or service_role key to the frontend. Supabase rejects a new sb_secret_ key with a 401 when the request looks like it came from a browser, but its docs are clear that this only stops accidents: anyone who copies the key out of your bundle can still use it from curl.

Two things trip people up when they migrate. Creating new keys does not revoke the legacy ones, so a leaked service_role JWT keeps working until you deactivate legacy keys in the dashboard as a separate step. And deleting a secret key can't be undone, so swap it everywhere it's used before you delete it.

Supabase Auth Security

Supabase Auth is generally secure when used correctly:

  • JWT tokens with short expiration
  • Secure password hashing (bcrypt)
  • Built-in MFA support
  • OAuth provider integration

Common Auth Mistakes

  • Not verifying email before allowing access
  • Weak password requirements
  • Missing rate limiting on auth endpoints
  • Not using HTTPS for redirects

Security Checklist

Before Going Live

  • Enable RLS on every table with data
  • Write restrictive RLS policies (deny by default)
  • Test policies from the browser (not admin)
  • Verify service key is not in frontend code
  • Configure storage bucket policies
  • Enable email verification
  • Set up rate limiting for functions

Is Supabase safe for production?

Yes, when properly configured. Supabase itself is SOC 2 certified and uses PostgreSQL's mature security model. The platform is safe; the risk is misconfiguration, especially missing RLS policies.

Why is my anon key public?

The anon key is designed to be public. It's meant for client-side use and works with RLS to control access. The key itself doesn't grant access to data; your RLS policies determine what's accessible.

Can I use Supabase without RLS?

For development, yes, but never for production with real user data. Without RLS, anyone with your publishable or anon key can read and change the table, signed in or not, because the key ships in your frontend. Even for internal tools, RLS is recommended.

Should I switch to the new Supabase publishable and secret keys?

Yes, before the end of 2026, when Supabase says the legacy anon and service_role keys are deprecated. The publishable key drops in where the anon key was. Put the secret key only in server code, then deactivate the legacy keys in the dashboard, because creating new keys does not turn the old ones off.

How do I write secure RLS policies?

Start with a deny-all approach and explicitly allow what's needed. The most common pattern is "users can only access their own data" using auth.uid() = user_id. Test policies by querying as a regular user, not admin.

Further Reading

Ready to secure your setup? Check out our hands-on guides.

Using Supabase?

Scan your project for missing RLS and other security issues.

Is It Safe?

Is Supabase Safe? Security Analysis