
pkgxray
io.github.adamsjack711-ux由 GitHub 账号 adamsjack711-ux 发布v1.0.5更新于 Oct 24, 2026
Pre-install security scans for npm packages, MCP servers, and AI agents with cited verdict evidence.
概览
在安装前扫描 npm 包、PyPI 包和 MCP 服务器,给出带证据引用的 SAFE、REVIEW 或 BLOCK 结论。
- 可以做什么
- 对 npm 与 PyPI 包、锁文件、GitHub 仓库、本地目录、MCP 服务器和 AI 代理扩展执行静态、基于固定规则的安全扫描。它输出 SAFE、REVIEW 或 BLOCK 结论,并附上引用到具体文件的证据,可识别凭据窃取、提示注入、数据外泄、持久化、安装钩子执行、已知 CVE 以及 npm 与 GitHub 制品不一致等问题。其他功能包括安装闸门(离线安装已暂存的归档并禁用脚本)、运行时 MCP 代理和定时复查。
- 适用场景
- 当助手或 CI 流程要安装依赖或连接 MCP 服务器,而你希望在代码运行前先检查其行为时使用。它是对 npm audit 等 CVE 扫描工具的补充,而非替代。
- 运行要求
- 需要本地 Node.js 运行时,通过 npx 以 npm 包 pkgxray 运行。仅限桌面端,使用 stdio 传输。未声明任何账号、API 密钥、环境变量或请求头。常规扫描在本地进行,不安装包依赖。
安装
在 SourceWeft 中
- 打开 控制台中的 pkgxray,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
pkgxray — pre-install security for npm packages, MCP servers, and AI agents
Inspect an npm package or MCP server before you install it or connect to it.
You get a SAFE, REVIEW, or BLOCK verdict, decided by fixed rules and backed
by cited evidence. The analysis is static and runs on your machine without
installing npm dependencies. A pinned MIT-licensed Acorn parser is bundled. Normal scans never execute package code.
[npm version] [npm downloads] [tests] [calibration benchmark] [license: MIT]
Website · Documentation · Calibration · Report a bug
[pkgxray guard clearing [email protected] with a SAFE A+ verdict, then blocking a trojaned sample with a BLOCK F verdict and a HIGH credential-access finding]Real runs: guard clears [email protected], then blocks a sample modeled on the 2024 @solana/web3.js compromise.
Highlights
- No npm dependency installation — local Node analysis with a bundled, pinned JavaScript parser.
- Install approved bytes —
pkgxray installscans the npm lockfile, installs held archives offline with scripts disabled, and verifies the resulting files. - Normal scans never execute package code — the tarball is read as bytes in quarantine.
- Cited verdicts from fixed rules — every finding names the file and the evidence. No model decides the verdict, so text planted in a package cannot steer it.
- Built for the agent era — check MCP servers before you connect, gate the installs an agent runs, and re-audit live MCP traffic.
- Adversarial gaps tracked openly — 200 additional synthetic cases track detected attacks and benign contrasts; this is internal testing, not an independent audit.
- Regression gates — calibration and adversarial corpora run in CI; historical top-1000 results remain available for comparison.
1. Quick start · 2. What it scans & detects · 3. Verdicts · 4. Usage · 5. Integrations · 6. How it compares · 7. Documentation
Why
AI coding assistants install packages and connect to MCP servers quickly, and
often no person reads the code first. Sonatype counted more than 454,600 new
malicious open-source packages across monitored ecosystems in 2025, over 99% of
them on npm
(Sonatype).
npm audit asks whether a package has a known CVE. pkgxray also asks what the
code does, before anything installs.
Quick start
1. Scan a known-benign package (no install of pkgxray needed):
It stages the tarball in quarantine and runs the static and supply-chain checks.
There is no npm install, no lifecycle script, and no package code executed.
Sample output
2. Read the verdict:
SAFE is not a proof that a package is harmless; static analysis cannot see a
payload downloaded only at runtime. See the threat model.
3. See a BLOCK on the supplied inert fixture:
The fixture is inert source text that models a split-string SSH-key read and
exfiltration. It is never executed. It returns BLOCK (exit 2) with the
cited file and evidence.
4. Add it to your workflow — rechecks & CI, MCP, Hookshot install gate.
Two execution models. Default
guardandauditscans are static, so package code is never executed. Three surfaces are different: listing an MCP server's tools may spawn it,mcp-proxyruns it behind a gate, and the opt-incanaryexecutes the package in a sandbox to confirm what it does. The canary can confirm that a package is malicious, but it can never prove one is safe. Full boundary: SECURITY.md.
What it scans & detects
Scans — pkgxray guard npm:name@version or pypi:name@version,
github:owner/repo, a local directory, whole lockfiles across two ecosystems
(npm: package-lock.json, yarn.lock, pnpm-lock.yaml, package.json; PyPI:
requirements.txt, poetry.lock, Pipfile.lock, pyproject.toml), MCP
servers, and AI-agent extensions.
Detects — credential theft (incl. split-fragment paths), cloud
instance-metadata and secret-store harvesting, prompt injection, Unicode
smuggling, base64 payloads and stage-2 loaders, exfiltration, persistence
(shell profile, OS scheduler, and injected CI/CD workflows), self-deleting
droppers, registry worm replication (install-time npm publish), npm
install-hook and PyPI setup.py install-time execution, obfuscated computed-arg
execution, hallucinated / slopsquat names (a lockfile pin the registry never
published), known CVEs (via OSV, before download), npm↔GitHub artifact
divergence, trojaned updates (recheck), and MCP
capability-surface abuse.
The full coverage matrix is in the threat model, along with the known blind spot: a package that downloads its payload later. A side-by-side comparison table is on the website.
Verdicts
Exit codes are stable and CI-friendly: 0 safe/allow · 2 block ·
3 review.
Usage
audit checks resolved dependencies against OSV. --deep adds source scans for
blocked dependencies; --deep-all requests source scans for all resolved dependencies.
Failed deep scans and incomplete source collection return REVIEW unless already BLOCK.
guard --deps includes direct-dependency findings in its decision; only exact pins
are checked, with ranges and other unresolved sources left at REVIEW. Guard output
lists completed, partial, disabled and failed checks so a passing verdict does not
imply checks that never ran.
PyPI scans cover source-distribution manifests, vulnerability metadata, and text-level
injection checks; they do not provide full Python module behavioral analysis or wheel inspection.
Python source adds an unsupported-behavior REVIEW finding. Behavioral coverage gaps
cannot be muted or promoted with allow-review; a pinned artifact approval remains
an explicit operator override. Archives containing links or special files are rejected.
One optional .pkgxray.json tunes policy on the Node-based surfaces. The browser
extension scans supplied evidence using engine defaults and cannot read project configuration. No config
means the strictest settings. Config can never allow a CVE away, every loosening
is printed, and a scan that errors fails closed to review. Schema and rules:
configuration.md · .pkgxray.example.json.
Integrations
One engine behind every entry point. "Works with" means a documented setup guide, not a vendor-endorsed integration.
How it compares
npm audit and OSV-Scanner check for published CVEs, and pkgxray does not
replace them. Run it alongside them. The tools in the same lane are Socket.dev,
OpenSSF Package Analysis, and Cisco MCP Scanner, which also analyze what package
code does. The full capability comparison is in
docs/comparison.md and on the
website.
Evidence
Historical top-1000 runs and their scope and methodology remain available at pkgxray.ca/stats. Those results predate the parser-based flow engine and have not been rerun for this change. The current engine passes all 270 internal synthetic calibration/challenge fixtures without a malicious SAFE or benign BLOCK; many malicious cases produce REVIEW. This is regression evidence, not a real-world detection-rate estimate.
Documentation
Start at the documentation index.
Contributing
Pull requests are welcome. Read CONTRIBUTING.md and the Code of Conduct first. Report vulnerabilities privately, as SECURITY.md describes. Releases publish to npm with provenance (SLSA attestation), and each one is gated on the tests, the calibration benchmark, and pkgxray's own supply-chain guard.
来源:README.md,提交 cb1c19a
工具
0版本历史
1- v1.0.5最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分