npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

prscan

v1.0.5

Published

如果使用的NPM包是最新版,且发布时间小于1个月,则报异常 #### 依据 攻击者获取NPM包发布权限后,需要发布一个新NPM包以植入恶意代码,但安全社区往往能在一段时间内发现并发布安全通告

Readme

NPM依赖检查

检测规则

使用最新且近期发布的NPM包

描述

如果使用的NPM包是最新版,且发布时间小于1个月,则报异常

依据

攻击者获取NPM包发布权限后,需要发布一个新NPM包以植入恶意代码,但安全社区往往能在一段时间内发现并发布安全通告

访问危险的全局变量

描述

使用babel解析js文件,并提取出js文件访问的所有全局变量。对于操作DOM、发起网络请求的全局变量发出告警,需要手工检查这些敏感调用点是否正常

依据

从过往的恶意代码Payload来看,攻击者外带信息都是通过fetch,还没有做什么隐藏手段

混淆代码

描述

如果js文件内出现了被混淆代码的特征,则告警

依据

过往的恶意代码中大部分经过了 obfsucator.io 这一JS混淆器处理,该混淆器产生的代码有明显特征,可以识别

关键字检查

描述

如果js文件内出现 ethereum 等关键字,则直接告警

依据

非Crypto领域的NPM包不应该出现这类关键字,但从过往的恶意代码Payload看,有时会通过 ethereum 这一全局变量窃取信息

使用

目前支持PNPM, YARN等包管理工具,不支持处理默认的NPM包管理工具

CLI

在本地GIT仓库内使用

通过对比2个分支的差异,确定NPM依赖变更,并做扫描

npx prscan branch <基础分支> <变更分支> -o <报告输出文件名, 默认输出到stdout> -r <仓库路径, 默认为当前路径>

在远程GitHub仓库使用

npx prscan github <PR链接> -o <报告输出文件名, 默认输出到stdout> -t <GitHub TOKEN, 公开项目不需要>