Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

better-npm-audit

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-npm-audit

Made to allow skipping certain vulnerabilities, and any extra handling that are not supported by the default npm audit in the future.

  • 2.0.0-rc
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47K
increased by34.96%
Maintainers
1
Weekly downloads
 
Created
Source

Better NPM Audit

Made to allow skipping certain vulnerabilities, and any extra handling that are not supported by the default npm audit in the future.

NPM

PRs Welcome GitHub issues npm bundle size

Supports both NPM version 6 and 7

NPM has upgraded to version 7 in late 2020 and has breaking changes on the npm audit. The output of npm audit has significantly changed both in the human-readable and --json output styles. We have added handling so it works properly in both npm versions.

DocsLink
NPM v6 & v7 changeshttps://github.blog/2020-10-13-presenting-v7-0-0-of-the-npm-cli/
NPM v7 blog posthttps://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major
Official NPM v6 audit docshttps://docs.npmjs.com/cli/v6/commands/npm-audit
Official NPM v7 audit docshttps://docs.npmjs.com/cli/v7/commands/npm-audit
Dealing with new npm audithttps://uko.codes/dealing-with-npm-v7-audit-changes

Installation

$ npm install better-npm-audit

or

$ npm install -g better-npm-audit

Usage

Run global

better-npm-audit audit

Run with exceptions

Demo of table displaying the security report

Unhandled or new exceptions will be highlighted:

Demo of table displaying the security report

Add into package scripts

{
  "scripts": {
    "prepush": "npm run test && npm run audit",
    "audit": "node node_modules/better-npm-audit audit"
  }
}

Now you can run locally or in your CI pipeline:

npm run audit

Options

FlagShortDescription
--level-lSame as the original --audit-level flag
--production-pSkip checking devDependencies
--ignore-iFor skipping certain advisories

Environment Variables

VariableDescription
NPM_CONFIG_AUDIT_LEVELUsed in setting the audit level.
Note: this will be disregard if the audit level flag is passed onto the command.

Using .nsprc file to manage exceptions

You may add a file .nsprc to your project root directory to manage the exceptions. For example:

{
  "1337": {
    "active": true,
    "notes": "Ignored since we don't use xxx method",
    "expiry": 1615462134681
  },
  "4501": {
    "active": false,
    "notes": "Ignored since we don't use xxx method"
  },
  "980": "Ignored since we don't use xxx method",
  "Note": "Any non number key will not be excepted"
}

When using .nsprc file, you will see this report display when it starts running:

Demo of table displaying a list of exceptions

Changelog

You can find the changelog here.


Special mentions

  • @IanWright for his solutions in improving the vulnerability validation for us to have the minimum-audit-level and production-mode flags.

  • @EdwinTaylor for all the bug reports and improvement suggestions.

  • @MrHus for the logging of unused exceptions from the .nsprc file and -ignore flags. Courtesy of 42 BV.



If you like this project,

Buy Me A Coffee

Keywords

FAQs

Package last updated on 20 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc