AyoubTadlaoui/npmguard

GitHub: AyoubTadlaoui/npmguard

npmguard 是一款以单一 Rust 二进制形式在 npm install 前拦截恶意包和 typosquat 仿冒包的供应链安全工具,支持通过 MCP 和 CLI 保护 AI 编程助手。

Stars: 2 | Forks: 0

# npmguard **我开发这个工具是因为,如今太多凭感觉写代码的开发者直接让 AI 处于自动模式,随便它想装什么就装什么。npmguard 会在任何 install 脚本运行之前对它们进行筛查。** Claude Code、Cursor 和 Codex 会自动运行 `npm install`。没人会停下来问一句:“等等,`supabase-mcp-helper` 这玩意到底存不存在?”我开发了 npmguard,它作为一个 MCP server 和 CLI,会对每个包进行评分(基于 OSV 恶意软件数据、typosquat/slopsquat 检测、install-script 分析),并在生命周期脚本触发前返回判定结果。 它以单个 Rust 二进制文件的形式发布,完全位于 npm *之外*。这很重要:守门员不能被它所守护的供应链下毒。 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/08e0adf1b2081143.svg)](https://github.com/AyoubTadlaoui/npmguard/actions/workflows/ci.yml) [![Release](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/a5854cc3d6081149.svg)](https://github.com/AyoubTadlaoui/npmguard/actions/workflows/release.yml) [![Latest release](https://img.shields.io/github/v/release/AyoubTadlaoui/npmguard)](https://github.com/AyoubTadlaoui/npmguard/releases/latest) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![codecov](https://codecov.io/gh/AyoubTadlaoui/npmguard/branch/main/graph/badge.svg)](https://codecov.io/gh/AyoubTadlaoui/npmguard) ![Claude Code 通过 npmguard 的 MCP 门控,拒绝安装 lodahs(一个被确认恶意的 typosquat 包,OSV MAL-2025-25502)。真实会话,atlas-ragnarok 主题。](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/7599344299081155.webp) `npmguard install lodahs` 是一个针对 `lodash` 的真实 typosquat 包,在生命周期脚本运行之前就被拒绝了: