npm audit

Free

by npm

Provided by npm

Not yet rated
Platform
Web
Pricing
Free
Account required
No
Ads
None
Last verified
15 hours ago
Developer
npm
Official URL

Overview

npm audit is a command built into the npm command-line client that checks a JavaScript project's dependencies against a database of known security vulnerabilities. Running it in a project folder sends a description of the installed packages to the registry the project is configured to use and prints a report: which packages are affected, how severe each issue is, and what change would fix it. It also reports packages that are only at risk because they depend on a vulnerable version of something else.

Two subcommands extend it. npm audit fix tries to apply the suggested upgrades by running an install, staying inside the version ranges in package.json unless you add the force flag, which permits breaking major-version upgrades and is documented as something to use with care. npm audit signatures verifies the registry signatures of downloaded packages and, where present, their provenance attestations.

It is aimed at developers and build pipelines. Output can be switched to JSON, development or optional dependencies can be left out, and the audit-level setting decides the lowest severity that makes the command exit with an error code, which is how it is usually wired into continuous integration. By default it needs a package-lock.json or shrinkwrap file so that the result is repeatable.

Features

  • Reports known vulnerabilities in a project's installed dependencies
  • Shows severity, affected packages and the suggested remediation
  • npm audit fix applies compatible upgrades automatically
  • npm audit signatures verifies registry signatures and provenance attestations
  • JSON output for scripts and other tools
  • Audit-level setting controls which severity causes a failing exit code
  • Omit option to skip dev, optional or peer dependencies
  • Package-lock-only mode that ignores the node_modules folder
  • Dry-run option to preview what a fix would change

Privacy

The documentation says the audit sends each package name and its versions to the configured registry, and that the fallback endpoint also sends the npm version, Node version, platform, architecture and NODE_ENV. Older npm releases scrubbed some package names from this payload; the docs state that scrubbing was removed in version 7.

Pros & Cons

Pros

  • Comes with npm, so there is nothing extra to install
  • Exit codes make it simple to fail a build on serious findings
  • Can fix many issues with one command
  • Signature and provenance checks help detect tampered packages

Cons

  • Not every vulnerability can be fixed automatically
  • Force mode can install breaking major-version upgrades
  • Needs a lockfile by default
  • Sends the names and versions of your dependencies to the registry

Community Reviews (0)

No written reviews yet — be the first to rate this tool.

Similar Tools

  • Dependency Analysis · Snyk

    Scans dependencies for known security vulnerabilities.

    Not yet rated
    Freemium Web
  • Detects publicly known vulnerabilities in project dependencies.

    Not yet rated
    Open Source Web
  • Dependency Analysis · GitHub

    Alerts on and automatically updates vulnerable dependencies.

    Not yet rated
    Free Web API