vibecodingsecurity.appChecks for apps built with AI

Supabase anon key: is it safe in the browser, and what can it reach?

Yes, the Supabase anon key is safe in a browser or mobile app: it reaches only what Row Level Security allows.

The danger is a table with RLS off, which anyone with the key can read and write, or a service_role key in client code, which bypasses RLS. Supabase deprecates both legacy keys in early 2027.

Published December 4, 2026 · Updated December 4, 2026. Read from Supabase's API keys, RLS and Advisors docs on December 4, 2026.

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).

KeyLooks likeSafe in the browser?Bypasses RLS?Postgres role
Publishablesb_publishable_...Yes, with RLS on every tableNoanon
Secretsb_secret_...No: Supabase answers HTTP 401 to a browserYesservice_role
anon (legacy)a long JWT starting eyJYes, with RLS on every tableNoanon
service_role (legacy)a long JWT starting eyJNoYesservice_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).

LintWhat it flagsWhat the anon key can do
0013_rls_disabled_in_publicRLS is off on a table in the public schemaAnyone with the project's URL can create, read, update and delete its rows
0007_policy_exists_rls_disabledA policy exists but RLS is off on its tableThe policy has no effect
0024_permissive_rls_policyA policy uses an always-true condition such as USING (true)Every row is open to the roles the policy names
0015_rls_references_user_metadataA policy reads user_metadataEnd users can change their own user_metadata and pass the check
0010_security_definer_viewA view in the public schema runs with elevated privilegesThe view ignores RLS and can expose more rows than intended
0023_sensitive_columns_exposedA table reachable through the API, with RLS off, has columns that look sensitive, such as passwords or API keysAnyone with the project URL can read them
0028_anon_security_definer_function_executableA SECURITY DEFINER function is callable without signing inAnyone with the anon key can call it, and it runs with its owner's rights
0012_auth_allow_anonymous_sign_insAnonymous sign-ins are onAnonymous users share the authenticated role, so existing policies may let them in
0025_public_bucket_allows_listingA public bucket has a broad SELECT policyClients can list every file in it
0008_rls_enabled_no_policyRLS is on with no policyNo 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 apikey header, not Authorization: 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.

  1. Supabase: API keys: key types, roles, 401 in a browser, deprecation in early 2027, eyJ, apikey header
  2. Supabase: Row Level Security: tables without RLS, views, bypassing RLS
  3. Supabase: Advisors: the 10 lints
  4. PostgreSQL: pg_tables: rowsecurity column
  5. Lovable: Security overview: Database security check
  6. Bolt: Check your project's security: database check
  7. Gitleaks on GitHub: pre-commit hook
  8. GitHub: Push protection: push protection for users
  9. IonCipher security page: secrets named, located and fingerprinted
  10. IonCipher pricing: Free plan