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 🙏

© 2024 – Pkg Stats / Ryan Hefner

npm-audit-helper

v4.0.1

Published

Helps you understand your npm audit findings so they're not too overwhelming

Downloads

9,131

Readme

npm-audit-helper

Are your npm audit results overwhelming you? This library helps you resolve them step by step.

npm version npm Build Status

Overview

It can be really overwhelming to stare at an npm audit report with 50+ vulnerabilities. Where do you start? npm-audit-helper helps answer that question, by providing smaller sets of output and a few hints. Example output:

found 155 vulnerabilities (60 low, 76 moderate, 18 high, 1 critical) in 22715 scanned packages
  3 vulnerabilities require manual review. See the full report for details.

=== A little bit of help ===

Where to start:

- run `npm audit fix` to automatically fix 13 issues. These should all be non-breaking upgrades, so don't stress.

- Resolve the 3 high severity issues above and run this command again to move to the next severity.

- The most problematic dependency seems to be example-lib with 18 issues that need your attention.

Getting started

All you need to do is run npm audit --json and pipe the output to npm-audit-helper. There are a few different installation options:

npx (no installation)

npm audit --json | npx npm-audit-helper

Global installation

npm install -g npm-audit-helper
npm audit --json | npm-audit-helper

Per-project installation

(1) Install:

npm install --save-dev npm-audit-helper

(2) Create task in package.json:

{
  "scripts": {
    // ...
    "vuln": "npm audit --json | npm-audit-helper"
  }
}

(3) Run:

npm run vuln

This last approach is great for setting up a prepush hook with a tool like husky. npm-audit-helper will return a non-zero exit code if vulnerabilities are found.

Options

| Flag | Description | Default | |---------------|-----------------------------------------------------------------------------------------------------------------------------|---------| | --exit-zero | Return a zero exit code even when there are vulnerabilities. Useful while you're working your way down to 0 vulnerabilities | false | | --prod-only | Only available for npm < 7. Filter out vulnerability information for devDependencies | false |

To filter our dev dependencies on npm 7+, pass the --only=prod option directly to npm:

npm audit --json --only=prod | npx npm-audit-helper

Dependencies

  • npm-audit-helper requires npm >= 6.1.0 because it relies on the --json option. npm install -g npm to upgrade.
  • npm-audit-helper won't work if it's piped invalid JSON, so you should check the output of npm audit --json if you have any trouble. A likely cause of invalid JSON is additional npm logging, so check the loglevel option in your .npmrc or ~/.npmrc file.
  • This has been tested on *nix, not Windows. Let me know if you use Windows and you'd like to use this library by opening an issue.

npm audit hints

  • You can get npm audit to ignore issues of a certain severity (but only for its exit code) by setting the audit-level option.
  • You can tell npm audit fix to only fix production dependencies with npm audit fix --only=prod.
  • If you want to add exclusions to your project (i.e. these are vulnerabilities I've reviewed and want to ignore), take a look at npm-audit-resolver. There is an RFC open to get npm audit resolve built into npm.

License

MIT