Skip to main content

Free Secret Scanning for JavaScript Bundles

Paste a built JavaScript file from your own site and find API keys, tokens and private keys shipped by mistake. Findings are redacted, and the scan runs in your browser.

Last updated 15 November 2026

Loading tool…

This secret scanning tool reads the JavaScript your own site ships and looks for credentials that were built into it by mistake. Paste a bundle, or choose up to 20 built files of up to 5 MB in total, and it checks the text against five rules: token formats whose prefixes the vendors document (Stripe, Clerk, GitHub, Slack, GitLab, Supabase and AWS), private key blocks, JSON Web Tokens, and two heuristics of its own, which are a quoted value assigned to a credential-like name and a quoted string that looks random. Each finding gives the file, line and column, a confidence level and a redacted preview: at most the first four characters of the match, then a fixed mask. A remediation register lists the findings with a status and a note for each, and copies out as CSV or Markdown with no code in it. Findings are leads for a person to verify. The scan runs in your browser, and your code is not uploaded.

How to use this tool

  1. 1

    Paste the bundle or choose the files

    Paste the contents of a built JavaScript file from your own site, or switch to files and choose up to 20. The limit is 5 MB in total, and input over it is refused whole, not scanned in part. To try the tool first, press Load the invented example, which holds only fake keys.

  2. 2

    Set the entropy threshold

    The slider runs from 3.0 to 5.5 bits per character and starts at 3.5. A quoted string that scores at or above it is reported at low confidence. Lower it to catch more random-looking strings, or raise it to cut hashes and ids.

  3. 3

    Scan and read the findings

    Press Scan for secrets. A scan that takes more than a moment shows a progress bar and a Cancel button. Each finding shows its type, file, line, column and confidence, a redacted preview, and where its rule comes from: a named document, or this page's own heuristic. Untick a confidence level to hide it.

  4. 4

    Work through the register

    Give each finding a status (To verify; Confirmed, rotate; Rotated; Not a secret) and a note of up to 200 characters, then copy the register as CSV or as a Markdown table. Nothing is saved: the register stays, even if you change the input, until you start another scan or leave the page, so copy it before then.

Why a key in a JavaScript bundle is public

A browser has to download a bundle before it can run it, so anyone who can open your site can read every string in the file. The build tools say as much about the values they put there. The Next.js documentation says environment variables prefixed with NEXT_PUBLIC_ are inlined at build time into the JavaScript sent to the browser, and that variables without that prefix are available only on the server. Vite's documentation says variables prefixed with VITE_ are exposed in client-side source code after bundling, and that they should not contain sensitive information such as API keys. Supabase's API keys page describes the same thing from the provider's side: it counts web pages, where the key is bundled in source code, among the environments it considers public, because anyone can retrieve the key from the source code or build artefacts. That is why providers issue two kinds of key. Stripe's key types table marks the publishable key as safe to expose and says you can include it in front-end code or applications you distribute, and it marks the secret and restricted keys as not safe to expose. Supabase lists its publishable key as safe to expose online, and says secret keys provide full access to a project's data, bypassing Row Level Security. The tool labels a key its vendor documents as public, such as a pk_live_ or sb_publishable_ key or a token whose role claim is anon, Public by design. The role claim is the one token value it reads. Supabase's JWT claims reference describes the role service_role as the service role, with admin privileges (server-side only), and anon as an anonymous user, for public access with RLS policies. A finding repeats that, and adds that the tool cannot tell who issued the token. It labels an AWS access key ID Identifier, because AWS says an access key is an ID and a secret access key used together and this tool has a rule for the ID only.

What the scanner matches, and where each rule comes from

Stripe's API keys page says sandbox keys start with pk_test_, rk_test_ and sk_test_, and live mode keys with pk_live_, rk_live_ and sk_live_. Clerk's environment variables page gives the same pk_ and sk_ prefixes for its own keys, so the tool cannot tell which issued a key. GitHub's authentication page lists ghp_, github_pat_, gho_, ghu_, ghs_ and ghr_. Slack's tokens page gives xoxb-, xoxp- and xapp-. GitLab's token overview gives glpat-, gloas-, gldt- and glptt-. Supabase's API keys page gives sb_publishable_ and sb_secret_. AWS's IAM identifiers page lists AKIA for an access key and ASIA for temporary access key IDs. The rest of each pattern is this tool's choice: at least 16 characters after the prefix, each a letter from A to Z in either case, a digit, an underscore or a hyphen (capital letters A to Z and digits for the two AWS prefixes), with no letter from A to Z, digit or underscore just before it. For private keys, RFC 7468 says a textual encoding begins with a line made of "-----BEGIN ", a label and "-----", and defines the labels PRIVATE KEY and ENCRYPTED PRIVATE KEY. The scanner reads those two and any other label of up to four words of capital letters or digits, each of 1 to 16 characters, before PRIVATE KEY, and says when the RFC does not define one. For JSON Web Tokens it starts at eyJ, which is how base64url encodes a JSON object that opens with a brace, a double quote and a letter from A to Z, and reads the three parts of the JWS Compact Serialization in RFC 7515. It decodes the first two and reports the token when both are JSON objects and the header names an alg, which RFC 7515 says must be present. A token that runs past the 8,192 characters one match reads is reported as too long to decode, provided its header ends within them. A header parameter or claim is named only when RFC 7515, RFC 7519 or Supabase's JWT claims reference lists the name. Other names are counted and no values shown.

Reading a finding: confidence, redaction and the two heuristics

Confidence says how sure a rule is that a match is what its type says, not how serious it is. High is a documented token prefix, a private key block with nothing but key data between its opening and closing lines, or a JSON Web Token whose role claim is service_role. Medium is any other JSON Web Token, a token too long to decode, a private key block with other characters in it or with no closing line, an AWS access key ID, or a value caught by the keyword rule. Low is a string caught by the entropy rule, or a private key opening line with fewer than 16 base64 characters of key data. Key data is the base64 between an opening line and a closing line that follows within 8,192 characters, counted as RFC 7468 says parsers should read it, ignoring white space and other non-base64 characters, so a key split across strings still counts. With no closing line in that distance, or none before another opening line, only the base64 directly after the opening line counts. The keyword rule is this page's own heuristic: a quoted value of 8 to 512 characters, with no white space, quote mark, backtick or backslash and at least one character other than the letters A to Z, assigned with a colon or equals sign to a name that ends, ignoring case, in a credential word such as apiKey, secret, token or password. The entropy rule is this page's own too: a quoted string of 20 to 512 characters, each a letter from A to Z, a digit or one of + / = _ -, with at least one digit, whose Shannon entropy meets the threshold. A preview shows at most the first four characters of a match, or none for a match shorter than 16 characters, then the same mask whatever the length. Up to 60 characters of code on each side are shown, with every other match masked. A short secret that no rule matched would still show there, so read a preview before you share your screen.

What to do with a real secret, and what a clean scan does not prove

Start by checking whether the match is real: the tool contacts no provider, so it cannot tell whether a key works. If it is real, treat it as exposed from the day the bundle went live. Removing the key from the next build does not undo that, because whoever downloaded the old file still has it. Stripe's API keys page lists a compromised secret or restricted key among the reasons to rotate one, and says rotating revokes the key and generates a replacement that is ready to use immediately. Supabase's guide to a leaked key says to fix the root cause of the leak before you rotate anything, because otherwise the new key can leak the same way. Its steps are to create a new secret key, replace the compromised key everywhere the application uses it, confirm that every component uses the new key and then retire the compromised key. It makes one exception: if someone is actively using the leaked key, it says to retire it right away, even though components that still use it stop working until you replace it. For a legacy service_role key, it also says to replace the legacy anon key with a publishable key in browser and mobile clients and to revoke the legacy JWT secret, because anything that still trusts that secret can accept the leaked key. GitHub's secret scanning documentation says that when you receive an alert, you should rotate the affected credential immediately to prevent unauthorised access. After that, move the call that needed the key to your server and look at the provider's logs for use you do not recognise. A scan with no findings is not proof that a bundle holds no secret. The scanner cannot find a secret the page fetches at runtime, a secret that is encoded or obfuscated, a token or password that is split across strings, or a credential in a format it has no rule for, and it stops after 200 findings and says where it stopped. Treat every finding as a lead for a person to verify.

Sources

Worked example

This example is invented for this page. The Load the invented example button fills the paste box with six lines: a comment and five lines of made-up code. The two keys are documented prefixes joined to text that says they are fake, and the token, the password, the hash and the key block are made up as well. None of them has worked anywhere.

Input
The invented example, pasted
Entropy threshold
3.5

6 findings: 4 high, 1 medium and 1 low confidence.

The four high-confidence findings are a publishable key with the pk_live_ prefix, labelled Public by design, a secret key with the sk_live_ prefix, a JSON Web Token whose role claim is service_role, and a private key block. The medium one is the quoted value assigned to dbPassword. The low one is a 40-character string of hexadecimal digits that scores above 3.5. Each preview shows four characters and the mask, such as sk_l[redacted].

Who uses this tool

Developers before a release

Scan the files in the build output before they are deployed, and fix the build if a server key shows up in them.

Owners of an app made with an AI builder

Save the JavaScript files your live site serves, scan them, and see whether a service_role token or a secret key was written into client code.

Agencies taking over a site

Scan the bundles of a site you have just inherited, and use the register to record which keys were rotated and which were not secrets.

Frequently asked questions

Is my code uploaded when I scan it?

No. The pasted text and the files you choose are read by this page and scanned in your browser, and the tool makes no request that carries them. Nothing you paste is evaluated or run. When a scan completes, the page sends one analytics event that names the tool and the page. That event carries nothing you pasted, chose or typed, and no finding.

What is secret scanning, and how is a bundle scan different from a repository scan?

Secret scanning is searching code for hardcoded credentials. GitHub describes its own secret scanning as scanning the entire Git history on all branches of a repository for API keys, passwords, tokens and other known secret types. A bundle scan reads something else: the built JavaScript a browser receives. A key can be absent from the repository and still be in the bundle, because the build put it there from an environment variable.

Is a publishable key or an anon key in my bundle a problem?

Not on that fact alone. Stripe marks its publishable key as safe to expose, and Supabase lists its publishable key as safe to expose online and calls the anon key the legacy version of publishable keys. The tool labels these Public by design. Supabase also says a publishable key only reaches what Row Level Security allows, so what matters is the access rules behind the key.

The scanner found a secret key. What should I do first?

Check that it is real, then rotate or revoke it at the provider. Removing it from the code does not undo the exposure, because the bundle that carried it has already been served. Then change the build so the key is read on the server only, and check the provider's logs for use you do not recognise. Record each step in the register.

Why did it flag a hash or a build id?

The entropy rule reports quoted strings that look random, and it cannot tell a secret from a hash or an id. That is why its findings are low confidence. Raise the threshold to see fewer of them, untick Low confidence to hide them, or set the status of a finding to Not a secret so the register records that someone looked.

Does a scan with no findings mean my bundle has no secrets?

No. It means none of the five rules matched the text you gave it. The scanner cannot see a secret fetched at runtime, a secret that is encoded or obfuscated, a token or password split across strings, or a format it has no rule for, and it reads only the files you chose, so a chunk you left out was not checked.

Related tools and services