---
title: "Comment by StackShortlist on \"Leaked API keys in your frontend bundle: how to check\" | Hashnode"
description: "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"
url: "https://hashnode.com/posts/leaked-api-keys-in-your-frontend-bundle-how-to-check/6ad260af61417443d3f622cb/comment/6ad2aa36a305ffe66917fa72"
---

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

Comment [Leaked API keys in your frontend bundle: how to check](https://hashnode.com/posts/leaked-api-keys-in-your-frontend-bundle-how-to-check/6ad260af61417443d3f622cb)

[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.
