<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shibbir Ahmed</title>
    <description>The latest articles on DEV Community by Shibbir Ahmed (@creativeartbd).</description>
    <link>https://dev.to/creativeartbd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F292859%2Fe5c3e16d-1825-46ba-bb3b-fe84c21e4111.jpeg</url>
      <title>DEV Community: Shibbir Ahmed</title>
      <link>https://dev.to/creativeartbd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/creativeartbd"/>
    <language>en</language>
    <item>
      <title>I built a tool that catches leaked secrets before `npm publish` — then GitHub caught mine</title>
      <dc:creator>Shibbir Ahmed</dc:creator>
      <pubDate>Mon, 22 Jun 2026 07:59:27 +0000</pubDate>
      <link>https://dev.to/creativeartbd/i-built-a-tool-that-catches-leaked-secrets-before-npm-publish-then-github-caught-mine-can</link>
      <guid>https://dev.to/creativeartbd/i-built-a-tool-that-catches-leaked-secrets-before-npm-publish-then-github-caught-mine-can</guid>
      <description>&lt;p&gt;We've all seen the horror stories: someone leaks an API key and wakes up to a $30k cloud bill, or accidentally publishes private code that's now public forever. And with AI tools making everyone ship faster than ever, it's happening more — not less.&lt;/p&gt;

&lt;p&gt;Here's the part that surprised me. Most security tools scan your &lt;strong&gt;source code&lt;/strong&gt; or your &lt;strong&gt;commits&lt;/strong&gt;. But a lot of the worst leaks happen somewhere else entirely: in the &lt;strong&gt;published package&lt;/strong&gt; — the exact files npm actually sends out.&lt;/p&gt;

&lt;p&gt;Earlier this year, a major AI company accidentally shipped its own source code in an npm package — around 500,000 lines, exposed through a source map that slipped into the build. Their code scanners didn't catch it, because the mistake wasn't &lt;em&gt;in&lt;/em&gt; the code. It was in what got &lt;em&gt;packaged&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;That gap bugged me, so I built a tiny tool for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  LeakGate
&lt;/h2&gt;

&lt;p&gt;It runs right before you publish and checks &lt;strong&gt;exactly the files npm would actually send&lt;/strong&gt; (via &lt;code&gt;npm pack&lt;/code&gt;), for things you never want to go public:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hardcoded keys — AWS, Stripe, OpenAI, Anthropic, Google, GitHub, Slack&lt;/li&gt;
&lt;li&gt;Database URLs with passwords, and private key blocks&lt;/li&gt;
&lt;li&gt;Dangerous files — &lt;code&gt;.env&lt;/code&gt;, source maps, &lt;code&gt;.git&lt;/code&gt;, &lt;code&gt;.pem&lt;/code&gt;/&lt;code&gt;.key&lt;/code&gt;, DB dumps, &lt;code&gt;.npmrc&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One command, no config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx leakgate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example output on a messy project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LeakGate — pre-publish safety check
Checked 5 files that npm would publish.

✗ Stop — found 2 serious problems.

CRITICAL  Stripe live secret key
          in src/index.js:2  (sk_liv…fGh)
          → Remove it and roll the key in your Stripe dashboard.

CRITICAL  Environment secrets file (.env)
          in .env
          → Add the .env file to your .npmignore / .gitignore so it is never published.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It exits with code 1 when it finds something, so you can wire it into &lt;code&gt;prepublishOnly&lt;/code&gt; or CI to &lt;strong&gt;block&lt;/strong&gt; a risky release.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that made me laugh
&lt;/h2&gt;

&lt;p&gt;While pushing LeakGate to GitHub, &lt;strong&gt;GitHub's own secret scanner blocked my push&lt;/strong&gt; — it caught the fake test secrets in my test fixtures. Two scanners doing their job, and the tool basically proved its own point before it even launched. 😅&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest status
&lt;/h2&gt;

&lt;p&gt;It's free and open source (MIT), and it's an early &lt;strong&gt;v0.1&lt;/strong&gt; — npm/JavaScript only for now. Bigger tools like Snyk and GitGuardian do far more at the org level; LeakGate is deliberately the tiny, zero-setup "check before you ship" piece I wanted for myself.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;npm: &lt;a href="https://www.npmjs.com/package/leakgate" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/leakgate&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Code: &lt;a href="https://github.com/creativeartbd/leakgate" rel="noopener noreferrer"&gt;https://github.com/creativeartbd/leakgate&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you publish to npm, give it a run before your next release. And I'd genuinely love feedback: &lt;strong&gt;would you use this before publishing, and what should I add next?&lt;/strong&gt; (More languages? A "fix it for me" mode? Continuous watching?)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>showdev</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
