What can someone do with your Supabase anon key?
Someone with your Supabase anon key can do exactly what your Row Level Security policies allow the anon role, and no more. Supabase's docs put it this way: the publishable key "is taped to the front door, and it only opens the lobby" (read December 4, 2026).
What the lobby holds is up to your tables:
- RLS off on a public table: "anyone with the project's URL can CREATE/READ/UPDATE/DELETE" its rows (Security Advisor lint 0013).
- RLS on, no policy: "no data will be selectable via Supabase APIs". Safe, and often not what you meant.
- A policy of
USING (true): every row is open to the roles it names (lint 0024). - A view: views bypass RLS by default, because Postgres creates them as security definer (lint 0010).
Anyone can read the key from your web page or app bundle, so treat it as public. Supabase lists what it doesn't protect against: code analysis, the browser's network inspector, cross-site request forgery, cross-site scripting, phishing and man-in-the-middle attacks.
Which Supabase key must never leave the server?
The secret key and the legacy service_role key must never leave the server: both map to the service_role Postgres role, which has the BYPASSRLS attribute and "skips every Row Level Security policy you attach" (Supabase docs, read December 4, 2026).
| Key | Looks like | Safe in the browser? | Bypasses RLS? | Postgres role |
|---|---|---|---|---|
| Publishable | sb_publishable_... | Yes, with RLS on every table | No | anon |
| Secret | sb_secret_... | No: Supabase answers HTTP 401 to a browser | Yes | service_role |
| anon (legacy) | a long JWT starting eyJ | Yes, with RLS on every table | No | anon |
| service_role (legacy) | a long JWT starting eyJ | No | Yes | service_role |
From Supabase's API keys docs, read December 4, 2026. A publishable key used by a signed-in user runs as authenticated. As a CSV: supabase-api-keys-2026-12-04.csv.
A secret key sent from a browser gets HTTP 401, because Supabase checks the User-Agent header. That stops mistakes, not attackers: Supabase says "an attacker can still use the key from other tools". A secret key also bypasses RLS only when the request carries no user access token.
How do you check every table has RLS on?
Open the Security Advisor in the Supabase dashboard: it runs deterministic lints that ship with the platform, and 10 of them bound what the anon key can reach. In SQL, select tablename, rowsecurity from pg_tables where schemaname = 'public'; lists any table still at false (PostgreSQL docs).
| Lint | What it flags | What the anon key can do |
|---|---|---|
0013_rls_disabled_in_public | RLS is off on a table in the public schema | Anyone with the project's URL can create, read, update and delete its rows |
0007_policy_exists_rls_disabled | A policy exists but RLS is off on its table | The policy has no effect |
0024_permissive_rls_policy | A policy uses an always-true condition such as USING (true) | Every row is open to the roles the policy names |
0015_rls_references_user_metadata | A policy reads user_metadata | End users can change their own user_metadata and pass the check |
0010_security_definer_view | A view in the public schema runs with elevated privileges | The view ignores RLS and can expose more rows than intended |
0023_sensitive_columns_exposed | A table reachable through the API, with RLS off, has columns that look sensitive, such as passwords or API keys | Anyone with the project URL can read them |
0028_anon_security_definer_function_executable | A SECURITY DEFINER function is callable without signing in | Anyone with the anon key can call it, and it runs with its owner's rights |
0012_auth_allow_anonymous_sign_ins | Anonymous sign-ins are on | Anonymous users share the authenticated role, so existing policies may let them in |
0025_public_bucket_allows_listing | A public bucket has a broad SELECT policy | Clients can list every file in it |
0008_rls_enabled_no_policy | RLS is on with no policy | No data is selectable through Supabase APIs |
From Supabase's Advisors docs, read December 4, 2026. As a CSV: supabase-security-advisor-lints-2026-12-04.csv. Supabase: "Review each finding carefully before you dismiss it."
App builders run their own version of this check. Lovable's automatic Database security check runs before publish, and Bolt's database check runs on all plans: the vibe coding security checklist compares 6 builder scans.
What changes with publishable and secret keys?
Publishable and secret keys replace anon and service_role: Supabase is deprecating the legacy keys in early 2027 (read December 4, 2026). The new keys are short strings, not JWTs, and both systems work at the same time until you disable the legacy keys in Settings, API Keys.
- Spot an old tutorial: "If a tool, tutorial, or AI assistant tells you to copy a long key that begins with eyJ, it was written for the legacy keys."
- Send them on the
apikeyheader, notAuthorization: Bearer: they aren't JWTs, so JWT checks fail on them. - Use a separate secret key for each backend component, so a leak means rotating one key.
How do you stop a secret key reaching the repo?
Keep the secret key in an environment variable without a public prefix, and run a secret scanner before code lands. Supabase's own example warns: "Never prefix these, or your bundler will ship the key" (read December 4, 2026).
- On the laptop: Gitleaks as a pre-commit hook, free and open source.
- At the push: GitHub push protection, on by default for your pushes to public repos.
- Across every repo: IonCipher reads each repo with secret rules; secrets it finds are named, located and fingerprinted, never shown in full, and its Free plan scans 10 private repos nightly. IonCipher doesn't read RLS policies: the Security Advisor does.
If a secret or service_role key already shipped, rotate it first, then clean the git history. Back to vibe coding security for the other 7 checks.
How was this page checked?
Every key type, role and lint above was read from Supabase's docs on December 4, 2026; tools from their own docs the same day. We didn't test a live project.
- Supabase: API keys: key types, roles, 401 in a browser, deprecation in early 2027, eyJ, apikey header
- Supabase: Row Level Security: tables without RLS, views, bypassing RLS
- Supabase: Advisors: the 10 lints
- PostgreSQL: pg_tables: rowsecurity column
- Lovable: Security overview: Database security check
- Bolt: Check your project's security: database check
- Gitleaks on GitHub: pre-commit hook
- GitHub: Push protection: push protection for users
- IonCipher security page: secrets named, located and fingerprinted
- IonCipher pricing: Free plan