Guide

Supabase's master key looks exactly like its public key. It's in 41,000 public GitHub files.

Seventeen months ago, an AI app builder's bot committed a key to a public GitHub repo. The key unlocks that app's entire database. It is still there, and it doesn't expire until 2035. It isn't the only one: search public GitHub for one pattern and you get about 41,800 files, each holding a Supabase service_role key, the key that ignores every row level security rule and can read and change the whole database.

Updated 6 min read

Where 41,800 comes from

A legacy Supabase key is a JWT. Its middle part is base64 text that says who issued it, which project it belongs to and what role it has. For a real project's master key, part of that text is always the same. I searched public GitHub code for exactly that part. GitHub reports about 41,800 files, and 41,300 leaving out forks (read on 10 November 2026).

The search can't match the public anon key, and it can't match the demo key that every local supabase start project shares: their text is different at that spot. It counts files, not projects, and GitHub's count is approximate. I didn't use or test a single key, so some will be rotated or belong to projects that no longer exist. I'm not publishing the search itself.

A closer look: 1,453 AI-built repos

To see what these look like up close, I scanned a sample I could check by hand: 1,453 public repos that carry an AI-tool marker (a CLAUDE.md, an AGENTS.md, Cursor rules, or Lovable's README or package), mention Supabase and had a push in the last three months.

Seventeen had a real master key committed, about 1 in 85. I decoded each one to be sure. The median had been public for about 7 months. All seventeen are long-lived keys that expire in 2035 or 2036.

I emailed the owners I could reach before publishing this, and told Supabase's security team on 10 November.

Only one was in the app

This is the part I didn't expect. Sixteen of the seventeen keys were not in the app's own code. They were in the glue around it:

  • One-off scripts, in 10: check the users, import the data, reset one person's password. In the repo root, or in scratch/ and scripts/ folders.
  • Committed env files, in 3: two .env, and one .env.local.example, the file that exists to be copied with placeholder values.
  • Database migrations, in 2: a database function with the key in a variable, so it can call an API. In both, the commit's author is an AI app builder's own GitHub bot, not a person.
  • A CI workflow, in 1: it reads the key from GitHub secrets and, if the secret is empty, falls back to the real key typed into the file.

The one inside the app was in four server functions, first committed by an account named "Cursor Agent". For most of the others I can't tell who wrote the line, and it doesn't change the pattern: a task needs admin access once, row level security blocks the public key, and the fastest way to make the script run is to paste in the other key.

Why nobody notices

A Supabase project using the legacy keys has two, and they look the same: long strings starting with eyJ. One is the public key, meant to be shipped to the browser. The other is the master key. Everyone who works on a Supabase app learns to see an eyJ... string and think "that's the public one". Reviewers skip it. So do AI coders, which have read thousands of repos where that string really was fine.

The only difference is inside. Decode the middle part and one says "role":"anon", the other "role":"service_role".

GitHub doesn't catch it either. Its list of supported secret scanning patterns covers Supabase's access tokens and the newer sb_secret_ keys, but not the legacy service_role JWT. So these files sit there without a warning to anyone.

Check yours in ten seconds

Run this in your repo. It prints the role of every Supabase-style key that git tracks, never the key itself:

Terminal
git grep -hoE "eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+" | sort -u | node -e '
require("readline").createInterface({input:process.stdin}).on("line",t=>{try{
const p=JSON.parse(Buffer.from(t.split(".")[1],"base64url"));console.log(p.role,p.iss,p.ref||"")}catch{}})'
It printsWhat it means
anon supabase <ref>The public key. Fine.
service_role supabase-demoThe key every local supabase start project shares. Fine: it opens a database on your laptop and nothing else.
service_role supabase <ref>A real master key. Rotate it today.

The 29 that looked just as bad

Twenty-nine more repos in the sample set off the same alarm and were innocent: they held only the local demo key. One was Supabase's own client library, in its tests. That's more false alarms than real keys. The Corvis scanner flagged them all as critical too, until I fixed it this week. A tool that cries wolf on the demo key teaches you to ignore eyJ strings, which is how the real ones get through.

The softer numbers

Treat these as worth a look, not as leaks:

  • 256 of the 1,453 repos (18%) had an env file committed (.env, .env.production and so on). I didn't open them, so this counts files, not secrets.
  • 322 of the 948 repos with a `supabase/` folder (34%) had SQL that creates a table without turning row level security on, or a policy that lets anyone read and change every row. Row level security can also be switched on in the dashboard, which a repo scan can't see.

If an AI writes your code

Put this in your CLAUDE.md, AGENTS.md or Cursor rules. It costs nothing:

Text
Never write a key, token or password into any file, including scripts, tests, migrations and CI.
Read it from the environment. If a script needs the Supabase service_role key, read
process.env.SUPABASE_SERVICE_ROLE_KEY and stop with a clear error when it is missing.
Never add a hardcoded fallback for a missing secret.

How this was done

  • The 41,800: a GitHub code search on 10 November 2026 for the fixed text a legacy Supabase key's payload has when it says iss: supabase, names a project and has role: service_role. Approximate, and limited to the code GitHub indexes.
  • The sample: public repos with an AI-tool marker that mention Supabase, pushed in the last three months, no forks or archived repos. 1,455 matched, 1,453 scanned.
  • A real key: its own payload says role: service_role and names a project, not supabase-demo. All 17 decoded and the files read by hand.
  • Not done: using any key, opening env files, or touching anyone's database.
  • Limits: a search-found sample of public repos. It says nothing certain about private ones and isn't a fair comparison between tools.

Where Corvis fits

I build Corvis, which is how this scan was run. It checks a repo for keys like these, open database rules and unprotected routes, and grades it from A to F. The hosted version keeps watching every push after that, so the next pasted key is caught the day it lands, not seventeen months later.

To run the same check on a whole repo, git history included, without installing anything: npx @usecorvis/cli. It runs on your machine and never uploads your code.

Sources

Checked against these pages on 15 November 2026. Providers change their dashboards; if a step looks different, the source has the current version.

  1. Supabase docs: Understanding API keys (opens in a new tab)
  2. Supabase docs: Row Level Security (opens in a new tab)
  3. GitHub docs: Supported secret scanning patterns (opens in a new tab)

Is your repo leaking right now?

The free scan checks a public GitHub repo for leaked keys and risky code, and grades it from A to F.

Scan a repo free