---
title: "Discussion on \"Leaked API keys in your frontend bundle: how to check\" | Hashnode"
description: "Discussion on \"Leaked API keys in your frontend bundle: how to check\". How to find secret keys shipped in your JavaScript bundle, and what to do when you find one."
url: "https://hashnode.com/posts/leaked-api-keys-in-your-frontend-bundle-how-to-check/6ad260af61417443d3f622cb"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Leaked API keys in your frontend bundle: how to check](https://lastmilekit.hashnode.dev/leaked-api-keys-in-your-frontend-bundle-how-to-check?utm_source=hashnode&utm_medium=feed)

How to find secret keys shipped in your JavaScript bundle, and what to do when you find one.

Oct 16 · 4 min read · lastmilekit.hashnode.dev  
Read the article

-   [#ai](https://hashnode.com/tag/ai)
-   [#security](https://hashnode.com/tag/security)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Last Mile](https://hashnode.com/@lastmilekit)

@lastmilekit

  
[View profile](https://hashnode.com/@lastmilekit)

Launch kit + free pre-launch URL check for vibe-coded apps.

Launch kit + free pre-launch URL check for vibe-coded apps.

## Responses 2

Markdown supported · ⌘↵ to post

[StackShortlist](https://hashnode.com/@veristria)

[Oct 16](https://hashnode.com/posts/leaked-api-keys-in-your-frontend-bundle-how-to-check/6ad260af61417443d3f622cb/comment/6ad2aa36a305ffe66917fa72)

Searching the built bundle rather than the source is the right call, since env variables prefixed for the client get inlined at build time and are easy to miss in code review. Adding a CI step that greps the output folder for common key patterns like sk\_live or service\_role turns this into a check nobody has to remember. And rotating the key comes before removing it from the code, because the old bundle can stay cached on a CDN for a long time.

[Last Mile](https://hashnode.com/@lastmilekit)

[Oct 19](https://hashnode.com/posts/leaked-api-keys-in-your-frontend-bundle-how-to-check/6ad260af61417443d3f622cb/comment/6ad2aa36a305ffe66917fa72#reply-6ad615a75e216481d8be927a)

Agreed, the built bundle is the only place the truth lives. A CI step that greps dist/ for key prefixes (sk\_live\_, sb\_secret\_, AKIA) and fails the build is cheap insurance. Pair it with gitleaks on history, since a key that was ever committed should be treated as leaked.
