<?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: Hammad</title>
    <description>The latest articles on DEV Community by Hammad (@hammadtariq).</description>
    <link>https://dev.to/hammadtariq</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3860205%2Fda8b6298-3df4-4aed-9f66-cea11ce309eb.jpg</url>
      <title>DEV Community: Hammad</title>
      <link>https://dev.to/hammadtariq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hammadtariq"/>
    <language>en</language>
    <item>
      <title>I built a Claude Code plugin that blocks compromised packages before installation</title>
      <dc:creator>Hammad</dc:creator>
      <pubDate>Sat, 04 Apr 2026 00:08:45 +0000</pubDate>
      <link>https://dev.to/hammadtariq/i-built-a-claude-code-plugin-that-blocks-compromised-packages-before-installation-1o3l</link>
      <guid>https://dev.to/hammadtariq/i-built-a-claude-code-plugin-that-blocks-compromised-packages-before-installation-1o3l</guid>
      <description>&lt;p&gt;Last week, &lt;code&gt;axios@1.14.1&lt;/code&gt; was hijacked on npm. A few days before that, &lt;code&gt;litellm@1.82.8&lt;/code&gt; on PyPI. Both were compromised versions published through hijacked maintainer accounts.&lt;/p&gt;

&lt;p&gt;Claude Code would have installed both of them as it doesn't ask any questions.&lt;/p&gt;

&lt;p&gt;AI coding agents run &lt;code&gt;npm install&lt;/code&gt; and &lt;code&gt;pip install&lt;/code&gt; on your behalf, and there's nothing checking whether the package is safe before it executes. By the time you notice, the compromised code has already run.&lt;/p&gt;

&lt;p&gt;So I built &lt;code&gt;attach-guard&lt;/code&gt; — an open source Claude Code plugin that intercepts every package install command and evaluates it against supply chain risk data before execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;attach-guard&lt;/code&gt; uses Claude Code's PreToolUse hooks. This is important, it's not a skill (which Claude can choose to ignore) or an MCP server (which is advisory). Hooks run automatically on every matching tool call. Claude cannot skip or override them.&lt;/p&gt;

&lt;p&gt;When Claude runs &lt;code&gt;npm install axios&lt;/code&gt;, attach-guard:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Intercepts the command before it executes&lt;/li&gt;
&lt;li&gt;Scores the package via Socket.dev's supply chain API&lt;/li&gt;
&lt;li&gt;Blocks it if it fails policy (malware, low score, too new)&lt;/li&gt;
&lt;li&gt;If the latest version is compromised, suggests the newest safe version instead of just saying "no"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Real example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;npm install axios&lt;/code&gt; → latest (1.14.1) scores 40/100 → blocked → rewrites to &lt;code&gt;axios@1.14.0&lt;/code&gt; (71/100)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pip install litellm==1.82.8&lt;/code&gt; → compromised → denied&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What it catches&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Known malware and compromised packages&lt;/li&gt;
&lt;li&gt;Packages published less than 48 hours ago&lt;/li&gt;
&lt;li&gt;Low supply chain scores (below 50 = denied, 50-70 = flagged)&lt;/li&gt;
&lt;li&gt;Supports npm, pip, Go, and Cargo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Install&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Two commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude plugin marketplace add attach-dev/attach-guard
claude plugin &lt;span class="nb"&gt;install &lt;/span&gt;attach-guard@attach-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It prompts for a Socket.dev API token during setup (free tier available).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/attach-dev/attach-guard" rel="noopener noreferrer"&gt;https://github.com/attach-dev/attach-guard&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MIT licensed, no data collection&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>opensource</category>
      <category>claudecode</category>
      <category>supplychain</category>
    </item>
  </channel>
</rss>
