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

cve-guard-npm

v1.0.2

Published

A lifecycle hook guard for npm installs that scans CVEs before package installation and audits dependencies after install.

Downloads

382

Readme

cve-guard-npm

cve-guard-npm is a lifecycle hook guard for npm installs. It automatically scans package install targets for OSV/CVE vulnerabilities before install and audits the resulting dependency tree after install.

Features

  • Pre-install CVE scanning for packages requested with npm install
  • Interactive warnings and confirmation when vulnerabilities are detected
  • Post-install audit report using npm audit --json
  • Beautiful terminal experience with chalk, boxen, cli-table3, gradient-string, and ora
  • Works without changing normal npm commands after one-time setup
  • Graceful error handling for offline, malformed input, unsupported npm usage, and audit failures
  • Bonus reputation details for packages: weekly downloads, publish date, maintainers count

Installation

npm install --save-dev cve-guard-npm

One-time Setup

Add lifecycle scripts to your package.json:

{
  "scripts": {
    "preinstall": "cve-guard-npm preinstall",
    "postinstall": "cve-guard-npm postinstall"
  }
}

After setup, every future npm install call will trigger the CVE guard automatically.

Usage

Normal install

npm install express

This will automatically run the preinstall CVE scan for express, prompt if vulnerabilities exist, and run npm audit --json after install.

Preinstall flow

If the package scan detects issues, you will see a report and a prompt like:

Continue installation? (y/n):

If you choose n, the install aborts safely.

Postinstall flow

After install completes, the package runs npm audit --json and prints a summary report for detected vulnerabilities.

Example Output

Preinstall

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CVE PRE-INSTALL CHECK
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Package: lodash
  • Weekly downloads: 23,000,000
  • Last publish date: 2024-12-05
  • Maintainers: 4

┌───────────┬────────────┬──────────────────────────────────────────────────────────┐
│ Severity  │ CVE / GHSA │ Summary                                                  │
├───────────┼────────────┼──────────────────────────────────────────────────────────┤
│ HIGH      │ GHSA-xxxx  │ Prototype Pollution                                       │
└───────────┴────────────┴──────────────────────────────────────────────────────────┘

Continue installation? (y/n): n

❌ Installation aborted by user.

Postinstall

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DEPENDENCY SECURITY REPORT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

┌───────────┬───────┐
│ Severity  │ Count │
├───────────┼───────┤
│ CRITICAL  │ 1     │
│ HIGH      │ 2     │
│ MODERATE  │ 5     │
│ LOW       │ 1     │
└───────────┴───────┘

Affected Packages:

┌──────────────────────────┬──────────┬──────────────────────────────┐
│ Package@Version          │ Severity │ Identifier                   │
├──────────────────────────┼──────────┼──────────────────────────────┤
│ [email protected]           │ high     │ GHSA-xxxx                    │
└──────────────────────────┴──────────┴──────────────────────────────┘

Architecture Overview

  • bin/cli.js - executable entrypoint for cve-guard-npm
  • lib/preinstall.js - pre-install lifecycle hook logic
  • lib/postinstall.js - post-install audit reporting
  • lib/osv.js - reusable OSV API integration with retry and timeout support
  • lib/audit.js - npm audit execution and JSON parsing
  • lib/formatter.js - CLI output formatting and tables
  • lib/logger.js - rich boxed headers and log helpers
  • lib/prompt.js - interactive confirmation helper
  • lib/utils.js - npm argv parsing, package normalization, and package.json helpers
  • lib/constants.js - shared configuration values and mappings

Screenshots

Screenshot 1

Screenshot 2

Roadmap

  • [ ] Add support for lockfile-aware package resolution
  • [ ] Add optional CI-only enforcement mode
  • [ ] Add config file support for ignore rules
  • [ ] Add support for Yarn and pnpm lifecycle flows
  • [ ] Add package metadata caching to reduce network traffic

Contributing

  1. Fork the repository
  2. Create a branch for your feature or fix
  3. Submit a pull request with tests and documentation

Please follow the existing code style and keep features modular.

License

MIT