# Leaked Supabase Secret Key? Delete It and Check Your Data

> Supabase secret API key exposed in a repo or front-end build? It bypasses row-level security. Delete it, check data and auth users now.

Source: https://leakwatch.net/secrets/supabase-secret-api-key

---

[LeakWatch](/)

[Product](/product)[Live feed](/leaks)[Guides](/secrets)[Blog](/blog)[Free scan](/)

1.  [Home](/)
2.  [Secrets](/secrets)
3.  Supabase Secret API Key

Databases & keys · Secret guide

# Leaked Supabase Secret API Key: what to do in the first hour

Critical severityDetected onlyLast verified November 5, 2026 · 4 min read

A Supabase secret API key is the server-side key for a Supabase project. It replaces the older `service_role` key and gives full access to the project’s database, which means it bypasses the row-level security policies that normally limit what each user can read and write. Whoever holds it can read or change every table, call the storage and auth administration APIs, and create accounts. This is one of the most serious leaks for an application backend, because it is the key to the whole project. Revoke it first, then check the data.

[Check your GitHub account for leaked secrets — free](/)

Provider

Supabase

Severity

Critical

Impact

Cloud infrastructure access

Checked live by LeakWatch

No

<!--live-stats-->

**Seen in the wild.** In the 30 days to 11 November 2026, LeakWatch detected 19 exposed Supabase Secret API Key credentials in public code. These counts cover only what LeakWatch's rules detect. See [live leak trends](/leaks/trends).

<!--/live-stats-->

## What a Supabase Secret API Key looks like

Supabase secret keys start with `sb_secret_`, followed by a block of letters, digits, underscores and hyphens. The whole value is a single string:

```text
sb_secret_…   Supabase secret API key (masked)
```

The distinction from the publishable key is essential. Supabase issues a publishable key with the prefix `sb_publishable_`, which is designed to ship in browser and mobile code and is not covered by this rule. The secret key must never appear in any of those places. Older projects may still use the legacy `service_role` JWT, which carries the same power but is not matched by this prefix, so check your environment variables for it as well.

## How Supabase Secret API Keys get leaked

-   **Front-end environment variables.** A secret key stored with a public prefix in a web framework, so the build embeds it into the JavaScript that every visitor downloads.
-   **Environment files.** A `.env` file with the secret key committed next to the project URL.
-   **Edge and serverless functions.** A function configuration that writes the key into a file in the repository.
-   **Logs.** A server that prints its environment when a request fails, or a debug statement that logs the request headers.
-   **Pasted examples.** A snippet posted in a forum or a chat while debugging a permissions error.

## What to do in the first hour

1.  **Delete the key.** Open the account settings for your Supabase project, go to the API keys area and delete the secret key that leaked. Deleting is irreversible, so first confirm that your services have the replacement. If you cannot switch yet, rotate the legacy key and plan the change.
2.  **Create a replacement** secret key, and store it in your hosting provider’s secret settings or a server-side environment. Keep it out of anything that is built for the browser.
3.  **Review the data.** Check recent changes to the main tables, especially those that hold user accounts, permissions and payments. Look for rows you did not expect.
4.  **Check the auth users.** Review the list of accounts for new users, new admin roles and password resets you did not trigger.
5.  **Check storage.** Look at the storage buckets for new or deleted files, and check whether any bucket is public when it should not be.
6.  **Review the logs.** Check the API and database logs for the period since the exposure, and look for requests from unfamiliar addresses.
7.  **Look at other secrets** in the same file, such as database passwords and third-party keys. See [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github) for the order of steps.
8.  **Clean the code.** Remove the key from the front end and from the repository, and confirm the publishable key is the only one the browser receives.

Not sure what else leaked? [Run a free scan](/).

[Not sure what else leaked? Run a free scan.](/)

## Revoke it at Supabase

Keys are listed in the API keys section of the project’s settings. Open account settings, select the project, and delete the secret key that leaked, after your services have the new one. Supabase’s documentation says that the secret key adds checks to prevent misuse, and that deleting it cannot be undone, so make sure the replacement is deployed first. Check that you are in the correct project, since projects in the same account have separate keys.

## How LeakWatch detects it

The rule is called Supabase Secret API Key. It looks for the prefix `sb_secret_` followed by 31 letters, digits, underscores or hyphens, with a boundary, a line break or a quote after it. Publishable keys with the `sb_publishable_` prefix are not matched, and the older `service_role` JWT is handled by its own rule. The severity is **critical**, with the impact class for infrastructure and cloud access. This type is not checked live: LeakWatch does not send a request to Supabase with the value it found.

LeakWatch detects this format but does **not** check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

## FAQ

Is the publishable key also a secret?

No. It is designed to be public and is used in the browser. The secret key is the one that bypasses row-level security, and it must stay on the server.

Why does the secret key matter if I have row-level security?

Because the secret key bypasses those policies. Row-level security protects data from ordinary users, but it does not stop a holder of the secret key.

Can I keep the legacy key running for now?

Only as a short transition. Both the legacy and new keys carry similar power, so revoke the leaked one and move your services as quickly as possible.

## Related

-   [Database Connection String](/secrets/database-connection-string)
-   [PlanetScale API Token](/secrets/planetscale-api-token)
-   [ClickHouse Cloud API Key](/secrets/clickhouse-cloud-api-key)
-   [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github)
-   [Which vendors leak most this week](/leaks/trends)
-   [All secret guides](/secrets)

[Get alerted next time a secret leaks — create a free account](/)

LeakWatch is not affiliated with Supabase.

![Gabriel Diyan, founder of LeakWatch](/brand/Photo-Gabriel-Diyan.webp)

Gabriel Diyan (0xCr0c0)

Cybersecurity student, founder of LeakWatch. I built and run the scanner described here — the detection patterns, the false-positive classifier and the provider validators are mine. [More about who I am](/about).

[GitHub](https://github.com/Leakwatch-Scan) · [X](https://x.com/LeakwatchScan) · [LinkedIn](https://www.linkedin.com/in/gabriel-diyan-80a378375) · [GitHub (personal)](https://github.com/crocogab)

LeakWatch

Secrets leak into public commits every minute. This watches the forges for yours. Built and run by [Gabriel Diyan](/about), a cybersecurity student — [why LeakWatch exists](/about).

Scan

-   [Product](/product)
-   [Live feed](/leaks)
-   [Trends](/leaks/trends)
-   [API docs](/docs)
-   [CI/CD](/docs?tab=ci)

Read

-   [Blog](/blog)
-   [Secret guides](/secrets)
-   [Changelog](/changelog)
-   [About](/about)

Verify

-   [Security](/security)
-   [Privacy](/privacy)
-   [Terms](/terms)
-   [Legal](/legal)
-   [Contact](/contact)
-   [Status](https://status.leakwatch.net)

© 2026 LeakWatch

[GitHub](https://github.com/Leakwatch-Scan)[X](https://x.com/LeakwatchScan)
