Skip to content

[BUG] npm audit does not exit with exit code 1 if a vulnerability is found #2868

Closed
npm/npm-audit-report
#46
@jansepke

Description

@jansepke

Current Behavior:

Running npm audit in a reposity with a vulnerable package will give the correct report output, but will not exit with status code 1.

Expected Behavior:

Same as in NPM V6 and as stated in the V7 Docs: "By default, the audit command will exit with a non-zero code if any vulnerability is found."

Steps To Reproduce:

  1. npm install [email protected]
  2. npm audit
  3. echo $?

I don't know if this problem applies only to lo severity findings. Our workaround currently is to use npm audit --audit-level=low which will exit correctly with 1.

Environment:

  • OS: Ubuntu 20.04
  • Node: v14.16.0
  • npm: 7.6.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions