What does it mean when Supabase emails that your secret API key was leaked?
A Supabase secret key (sb_secret_…) was detected in a public GitHub repository through GitHub secret scanning, and Supabase revoked it automatically. Server code using it now fails. Create a new secret key in Settings → API Keys, update your servers, and remove the old key from the repo. Legacy service_role JWTs aren't auto-revoked, so check those yourself.
Last updated 2026-11-25 · Reviewed by ProofForge
The exact error
Supabase notifies the project owner by email that a secret API key was found in a public GitHub repository and has been revoked.
Server calls with the old key now fail with: Invalid API keyWhy it happens
- An
sb_secret_key was committed to a public repo (often in.env, a config file, or an Edge Function). - Supabase is a GitHub secret-scanning partner. GitHub reports the match and Supabase revokes it.
How to fix it
- In the Dashboard, go to Settings → API Keys and create a new secret key.
- Put it only in server-side env vars (Edge Function secrets, backend host). Redeploy.
- Remove the old key from the repo and its history, and add
.env*to.gitignore. - Check whether a legacy
service_roleJWT was in the same files. If so, rotate it too (that retires the legacy anon key as well, so move clients to a publishable key).
# confirm nothing secret is left in the repo
git log -p --all | grep -nE "sb_secret_|service_role"
# server env only
SUPABASE_SECRET_KEY=sb_secret_<new>Check it's fixed
Server calls succeed with the new key, and a ProofForge scan of your live app finds no sb_secret_ or service_role JWT in the frontend.
Check your live app
A free, read-only public-surface scan. It cannot diagnose private sessions or every cause described above.
FAQ
Was my data accessed?
The key bypasses RLS, so anyone who found it could read and write any table until it was revoked. Review logs for the exposure window.
Does this cover the old service_role key?
No. Auto-revocation covers the new sb_secret_ keys. Legacy service_role JWTs must be rotated by you.
Why did my app break?
Revocation is immediate. Every server still using the old key fails until you deploy the new one.