Skip to content

Commit 4936ba9

Browse files
ngraefisaacs
authored andcommitted
doc: add --audit-level param
implementation added in #31
1 parent 238263a commit 4936ba9

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

doc/cli/npm-audit.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ npm-audit(1) -- Run a security audit
33

44
## SYNOPSIS
55

6-
npm audit [--json|--parseable]
7-
npm audit fix [--force|--package-lock-only|--dry-run|--production|--only=dev]
6+
npm audit [--json|--parseable|--audit-level=(low|moderate|high|critical)]
7+
npm audit fix [--force|--package-lock-only|--dry-run]
8+
9+
common options: [--production] [--only=(dev|prod)]
810

911
## EXAMPLES
1012

@@ -60,6 +62,11 @@ To parse columns, you can use for example `awk`, and just print some of them:
6062
$ npm audit --parseable | awk -F $'\t' '{print $1,$4}'
6163
```
6264

65+
Fail an audit only if the results include a vulnerability with a level of moderate or higher:
66+
```
67+
$ npm audit --audit-level=moderate
68+
```
69+
6370
## DESCRIPTION
6471

6572
The audit command submits a description of the dependencies configured in
@@ -75,6 +82,12 @@ runs a full-fledged `npm install` under the hood, all configs that apply to the
7582
installer will also apply to `npm install` -- so things like `npm audit fix
7683
--package-lock-only` will work as expected.
7784

85+
By default, the audit command will exit with a non-zero code if any vulnerability
86+
is found. It may be useful in CI environments to include the `--audit-level` parameter
87+
to specify the minimum vulnerability level that will cause the command to fail. This
88+
option does not filter the report output, it simply changes the command's failure
89+
threshold.
90+
7891
## CONTENT SUBMITTED
7992

8093
* npm_version

0 commit comments

Comments
 (0)