# Leaked Stripe Publishable Key? What Actually Matters

> Stripe publishable key exposed on GitHub? It is meant to be public, but check for secret keys beside it. Step-by-step guide.

Source: https://leakwatch.net/secrets/stripe-publishable-key

---

[LeakWatch](/)

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

1.  [Home](/)
2.  [Secrets](/secrets)
3.  Stripe Publishable Key

Payments · Secret guide

# Leaked Stripe Publishable Key: what to do in the first hour

Low severityChecked liveLast verified October 30, 2026 · 5 min read

A Stripe publishable key is designed to be public. It goes into web pages and mobile apps so that card details can be sent straight to Stripe without crossing your server, and it can only create tokens and payment methods, not charge a card, read customers or move money. Finding one in a repository is therefore low risk by itself, which is why it is rated low. The real question is what was committed with it: a secret key next to a publishable key is the usual accident, and that one is serious. Check for secret keys first, then decide whether you want to replace the publishable key at all.

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

Provider

Stripe

Severity

Low

Impact

Limited impact

Checked live by LeakWatch

Yes

<!--live-stats-->

**Seen in the wild.** In the 30 days to 11 November 2026, LeakWatch detected 24 exposed Stripe Publishable Key credentials in public code. Of the 24 it tested against Stripe, 4 (17%) were still live at the last check. These counts cover only what LeakWatch's rules detect. See [live leak trends](/leaks/trends).

<!--/live-stats-->

## What a Stripe publishable key looks like

A publishable key starts with `pk_`, then the mode, then an underscore and a body of letters and digits:

```text
pk_live_XXXX…XXXX   Stripe publishable key, live mode (masked)
pk_test_XXXX…XXXX   Stripe publishable key, test mode (masked)
```

The `pk_` prefix is what separates it from the secret key, which starts with `sk_`, and from the restricted key, which starts with `rk_`. Mixing them up is the main source of panic and of real leaks. A `pk_` key appears in front-end code on purpose: in the call that initializes Stripe.js, in a mobile app configuration, or in variables such as `STRIPE_PUBLISHABLE_KEY`, `NEXT_PUBLIC_STRIPE_KEY` or `VITE_STRIPE_PK`. Seeing it in a public bundle is normal. Seeing it in a file together with a `sk_` value is not.

## How Stripe publishable keys get leaked

Strictly speaking they are not meant to stay secret, so this is about how they end up in a repository next to something that is.

-   **Front-end source.** A checkout page or mobile app that includes the key in its code, which is expected and harmless on its own.
-   **Environment files.** A `.env` where `STRIPE_PUBLISHABLE_KEY` and `STRIPE_SECRET_KEY` sit on adjacent lines and the whole file is committed.
-   **Sample projects.** A tutorial repository with both keys of a real account in the configuration.
-   **Documentation and READMEs.** Setup instructions that show a real pair of keys instead of placeholders.
-   **Build logs.** A CI step that prints all variables, including the secret one.

## What to do in the first hour

1.  **Look at what is around the key.** Search the same file, the commit and the history for `sk_live_`, `sk_test_`, `rk_live_` and `rk_test_`. A secret key found there is the real incident, and you should follow the guide for it: [Stripe secret key](/secrets/stripe-secret-key).
2.  **Confirm the key type.** Check that the string really begins with `pk_` and not `sk_`. If it begins with `sk_`, stop and roll it at once.
3.  **Decide whether to replace it.** A publishable key can be replaced from the Stripe Dashboard, but it is already visible in every page that uses it, so replacing it protects very little. Do it if you want clean hygiene or if the account was targeted, and expect to redeploy every front end and mobile build that uses it.
4.  **Check the logs.** In the Stripe Dashboard, look at the request logs and the list of recent payments for activity you did not expect, such as many failed card attempts, which is the typical misuse of a publishable key (card testing).
5.  **Add protection against card testing.** Consider Stripe’s fraud tools, rate limiting on your checkout endpoint, and a captcha on forms that create payment methods.
6.  **Check restricted and secret keys** in the Dashboard for any you do not recognize.
7.  **Clean up the code** so that only the publishable key is in front-end code, and secrets stay on the server. See [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github).

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

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

## Revoke it at Stripe

Stripe keys are managed from the API keys page of the Stripe Dashboard, after you sign in with a user allowed to manage them. The page lists the publishable and secret keys of each mode, test and live, separately. If you decide to replace the publishable key, look for the option to roll it there, and note that a new publishable key must be deployed to every front end that uses the old one. The Stripe documentation on [API keys](https://docs.stripe.com/keys) describes the key types and how they should be handled. A person has not confirmed the exact menu wording for this guide, and the interface can change, so if what you see differs, look for the page where keys are listed and follow Stripe’s documentation.

## How LeakWatch detects it

This guide covers two rules. The rule called Stripe Publishable Key (live) matches `pk_live_` followed by exactly 24 letters or digits. The rule called Stripe Publishable Key (test) matches `pk_test_` followed by exactly 24 letters or digits. Neither requires a word boundary, so a longer body is cut at 24 characters and still reported, and a shorter one is refused. Both are case-sensitive and need no variable name nearby. The severity of both is **low**, because a publishable key is not a secret.

LeakWatch can check whether a detected key is still active with a read-only request to Stripe. It never reads your data or spends your credits.

**This type is checked live.** LeakWatch applies the same check to every Stripe key type: one read-only request to the balance endpoint of the Stripe API, with the string as a Bearer token. A publishable key is not a secret key and is not meant to authenticate that endpoint, so a rejection is the normal outcome and says nothing about the safety of what sits next to it. The result is recorded as valid on a 200 or a 403, invalid on a 401, and rate limited on a 429.

## FAQ

Is it a problem that my publishable key is in my public repository?

Not by itself. Stripe designed it to be visible in front-end code. The danger is a secret key committed in the same file or history, so search for one.

Should I roll a publishable key after it leaked?

Usually you do not need to, because it is exposed in your own web pages anyway. Roll it if you want, or if you see card-testing traffic, and redeploy all clients.

How do I tell a publishable key from a secret key quickly?

Read the first three characters. `pk_` is publishable and public by design. `sk_` and `rk_` are secret and restricted keys that must stay on your server.

## Related

-   [Stripe secret key](/secrets/stripe-secret-key)
-   [Stripe Test Secret Key](/secrets/stripe-test-secret-key)
-   [Stripe Restricted Key](/secrets/stripe-restricted-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 Stripe.

![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)
