You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/lib/content/commands/npm-access.md
+5-12Lines changed: 5 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,24 +12,19 @@ description: Set access level on published packages
12
12
13
13
Used to set access controls on private packages.
14
14
15
-
For all of the subcommands, `npm access` will perform actions on the packages
16
-
in the current working directory if no package name is passed to the
17
-
subcommand.
15
+
For all of the subcommands, `npm access` will perform actions on the packages in the current working directory if no package name is passed to the subcommand.
18
16
19
17
* grant / revoke:
20
18
Add or remove the ability of users and teams to have read-only or read-write
21
19
access to a package.
22
20
23
21
### Details
24
22
25
-
`npm access` always operates directly on the current registry, configurable
26
-
from the command line using `--registry=<registry url>`.
23
+
`npm access` always operates directly on the current registry, configurable from the command line using `--registry=<registry url>`.
27
24
28
25
Unscoped packages are *always public*.
29
26
30
-
Scoped packages *default to restricted*, but you can either publish them as
31
-
public using `npm publish --access=public`, or set their access as public using
32
-
`npm access set status=public` after the initial publish.
27
+
Scoped packages *default to restricted*, but you can either publish them as public using `npm publish --access=public`, or set their access as public using `npm access set status=public` after the initial publish.
33
28
34
29
You must have privileges to set the access of a package:
35
30
@@ -38,11 +33,9 @@ You must have privileges to set the access of a package:
38
33
* You have been given read-write privileges for a package, either as a member
39
34
of a team or directly as an owner.
40
35
41
-
If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the `--otp=...` option to specify it on
42
-
the command line.
36
+
If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the `--otp=...` option to specify it on the command line.
43
37
44
-
If your account is not paid, then attempts to publish scoped packages will
45
-
fail with an HTTP 402 status code (logically enough), unless you use
38
+
If your account is not paid, then attempts to publish scoped packages will fail with an HTTP 402 status code (logically enough), unless you use
46
39
`--access=public`.
47
40
48
41
Management of teams and team memberships is done with the `npm team` command.
Copy file name to clipboardExpand all lines: docs/lib/content/commands/npm-adduser.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,13 @@ description: Add a registry user account
10
10
11
11
### Description
12
12
13
-
Create a new user in the specified registry, and save the credentials to
14
-
the `.npmrc` file. If no registry is specified, the default registry
15
-
will be used (see [`registry`](/using-npm/registry)).
13
+
Create a new user in the specified registry, and save the credentials to the `.npmrc` file.
14
+
If no registry is specified, the default registry will be used (see [`registry`](/using-npm/registry)).
16
15
17
-
When you run `npm adduser`, the CLI automatically generates a legacy token of `publish` type. For more information, see [About legacy tokens](/about-access-tokens#about-legacy-tokens).
16
+
When you run `npm adduser`, the CLI automatically generates a legacy token of `publish` type.
17
+
For more information, see [About legacy tokens](/about-access-tokens#about-legacy-tokens).
18
18
19
-
When using `legacy` for your `auth-type`, the username, password, and
20
-
email are read in from prompts.
19
+
When using `legacy` for your `auth-type`, the username, password, and email are read in from prompts.
Copy file name to clipboardExpand all lines: docs/lib/content/commands/npm-audit.md
+39-89Lines changed: 39 additions & 89 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,32 +10,23 @@ description: Run a security audit
10
10
11
11
### Description
12
12
13
-
The audit command submits a description of the dependencies configured in
14
-
your project to your default registry and asks for a report of known
15
-
vulnerabilities. If any vulnerabilities are found, then the impact and
16
-
appropriate remediation will be calculated. If the `fix` argument is
17
-
provided, then remediations will be applied to the package tree.
13
+
The audit command submits a description of the dependencies configured in your project to your default registry and asks for a report of known vulnerabilities.
14
+
If any vulnerabilities are found, then the impact and appropriate remediation will be calculated.
15
+
If the `fix` argument is provided, then remediations will be applied to the package tree.
18
16
19
17
The command will exit with a 0 exit code if no vulnerabilities were found.
20
18
21
-
Note that some vulnerabilities cannot be fixed automatically and will
22
-
require manual intervention or review. Also note that since `npm audit
23
-
fix` runs a full-fledged `npm install` under the hood, all configs that
24
-
apply to the installer will also apply to `npm install` -- so things like
25
-
`npm audit fix --package-lock-only` will work as expected.
19
+
Note that some vulnerabilities cannot be fixed automatically and will require manual intervention or review.
20
+
Also note that since `npm audit fix` runs a full-fledged `npm install` under the hood, all configs that apply to the installer will also apply to `npm install` -- so things like `npm audit fix --package-lock-only` will work as expected.
26
21
27
-
By default, the audit command will exit with a non-zero code if any
28
-
vulnerability is found. It may be useful in CI environments to include the
29
-
`--audit-level` parameter to specify the minimum vulnerability level that
30
-
will cause the command to fail. This option does not filter the report
31
-
output, it simply changes the command's failure threshold.
22
+
By default, the audit command will exit with a non-zero code if any vulnerability is found.
23
+
It may be useful in CI environments to include the `--audit-level` parameter to specify the minimum vulnerability level that will cause the command to fail.
24
+
This option does not filter the report output, it simply changes the command's failure threshold.
32
25
33
26
### Package lock
34
27
35
-
By default npm requires a package-lock or shrinkwrap in order to run the
36
-
audit. You can bypass the package lock with `--no-package-lock` but be
37
-
aware the results may be different with every run, since npm will
38
-
re-build the dependency tree each time.
28
+
By default npm requires a package-lock or shrinkwrap in order to run the audit.
29
+
You can bypass the package lock with `--no-package-lock` but be aware the results may be different with every run, since npm will re-build the dependency tree each time.
39
30
40
31
### Audit Signatures
41
32
@@ -47,12 +38,9 @@ Registry signatures can be verified using the following `audit` command:
47
38
$ npm audit signatures
48
39
```
49
40
50
-
The `audit signatures` command will also verify the provenance attestations of
51
-
downloaded packages. Because provenance attestations are such a new feature,
52
-
security features may be added to (or changed in) the attestation format over
53
-
time. To ensure that you're always able to verify attestation signatures check
54
-
that you're running the latest version of the npm CLI. Please note this often
55
-
means updating npm beyond the version that ships with Node.js.
41
+
The `audit signatures` command will also verify the provenance attestations of downloaded packages.
42
+
Because provenance attestations are such a new feature, security features may be added to (or changed in) the attestation format over time.
43
+
To ensure that you're always able to verify attestation signatures check that you're running the latest version of the npm CLI. Please note this often means updating npm beyond the version that ships with Node.js.
56
44
57
45
The npm CLI supports registry signatures and signing keys provided by any registry if the following conventions are followed:
58
46
@@ -98,42 +86,29 @@ See this [example key's response from the public npm registry](https://registry.
98
86
99
87
### Audit Endpoints
100
88
101
-
There are two audit endpoints that npm may use to fetch vulnerability
102
-
information: the `Bulk Advisory` endpoint and the `Quick Audit` endpoint.
89
+
There are two audit endpoints that npm may use to fetch vulnerability information: the `Bulk Advisory` endpoint and the `Quick Audit` endpoint.
103
90
104
91
#### Bulk Advisory Endpoint
105
92
106
-
As of version 7, npm uses the much faster `Bulk Advisory` endpoint to
107
-
optimize the speed of calculating audit results.
93
+
As of version 7, npm uses the much faster `Bulk Advisory` endpoint to optimize the speed of calculating audit results.
108
94
109
-
npm will generate a JSON payload with the name and list of versions of each
110
-
package in the tree, and POST it to the default configured registry at
111
-
the path `/-/npm/v1/security/advisories/bulk`.
95
+
npm will generate a JSON payload with the name and list of versions of each package in the tree, and POST it to the default configured registry at the path `/-/npm/v1/security/advisories/bulk`.
112
96
113
-
Any packages in the tree that do not have a `version` field in their
114
-
package.json file will be ignored. If any `--omit` options are specified
115
-
(either via the [`--omit` config](/using-npm/config#omit), or one of the
116
-
shorthands such as `--production`, `--only=dev`, and so on), then packages will
117
-
be omitted from the submitted payload as appropriate.
97
+
Any packages in the tree that do not have a `version` field in their package.json file will be ignored.
98
+
If any `--omit` options are specified (either via the [`--omit` config](/using-npm/config#omit), or one of the shorthands such as `--production`, `--only=dev`, and so on), then packages will be omitted from the submitted payload as appropriate.
118
99
119
-
If the registry responds with an error, or with an invalid response, then
120
-
npm will attempt to load advisory data from the `Quick Audit` endpoint.
100
+
If the registry responds with an error, or with an invalid response, then npm will attempt to load advisory data from the `Quick Audit` endpoint.
121
101
122
-
The expected result will contain a set of advisory objects for each
123
-
dependency that matches the advisory range. Each advisory object contains
124
-
a `name`, `url`, `id`, `severity`, `vulnerable_versions`, and `title`.
102
+
The expected result will contain a set of advisory objects for each dependency that matches the advisory range.
103
+
Each advisory object contains a `name`, `url`, `id`, `severity`, `vulnerable_versions`, and `title`.
125
104
126
-
npm then uses these advisory objects to calculate vulnerabilities and
127
-
meta-vulnerabilities of the dependencies within the tree.
105
+
npm then uses these advisory objects to calculate vulnerabilities and meta-vulnerabilities of the dependencies within the tree.
128
106
129
107
#### Quick Audit Endpoint
130
108
131
-
If the `Bulk Advisory` endpoint returns an error, or invalid data, npm will
132
-
attempt to load advisory data from the `Quick Audit` endpoint, which is
133
-
considerably slower in most cases.
109
+
If the `Bulk Advisory` endpoint returns an error, or invalid data, npm will attempt to load advisory data from the `Quick Audit` endpoint, which is considerably slower in most cases.
134
110
135
-
The full package tree as found in `package-lock.json` is submitted, along
136
-
with the following pieces of additional metadata:
111
+
The full package tree as found in `package-lock.json` is submitted, along with the following pieces of additional metadata:
137
112
138
113
*`npm_version`
139
114
*`node_version`
@@ -146,64 +121,42 @@ Omitted dependency types are skipped when generating the report.
146
121
147
122
#### Scrubbing
148
123
149
-
Out of an abundance of caution, npm versions 5 and 6 would "scrub" any
150
-
packages from the submitted report if their name contained a `/` character,
151
-
so as to avoid leaking the names of potentially private packages or git
152
-
URLs.
124
+
Out of an abundance of caution, npm versions 5 and 6 would "scrub" any packages from the submitted report if their name contained a `/` character, so as to avoid leaking the names of potentially private packages or git URLs.
153
125
154
-
However, in practice, this resulted in audits often failing to properly
155
-
detect meta-vulnerabilities, because the tree would appear to be invalid
156
-
due to missing dependencies, and prevented the detection of vulnerabilities
157
-
in package trees that used git dependencies or private modules.
126
+
However, in practice, this resulted in audits often failing to properly detect meta-vulnerabilities, because the tree would appear to be invalid due to missing dependencies, and prevented the detection of vulnerabilities in package trees that used git dependencies or private modules.
158
127
159
128
This scrubbing has been removed from npm as of version 7.
160
129
161
130
#### Calculating Meta-Vulnerabilities and Remediations
module to turn a set of security advisories into a set of "vulnerability"
166
-
objects. A "meta-vulnerability" is a dependency that is vulnerable by
167
-
virtue of dependence on vulnerable versions of a vulnerable package.
132
+
npm uses the [`@npmcli/metavuln-calculator`](http://npm.im/@npmcli/metavuln-calculator) module to turn a set of security advisories into a set of "vulnerability" objects.
133
+
A "meta-vulnerability" is a dependency that is vulnerable by virtue of dependence on vulnerable versions of a vulnerable package.
168
134
169
-
For example, if the package `foo` is vulnerable in the range `>=1.0.2
170
-
<2.0.0`, and the package `bar` depends on `foo@^1.1.0`, then that version
171
-
of `bar` can only be installed by installing a vulnerable version of `foo`.
135
+
For example, if the package `foo` is vulnerable in the range `>=1.0.2 <2.0.0`, and the package `bar` depends on `foo@^1.1.0`, then that version of `bar` can only be installed by installing a vulnerable version of `foo`.
172
136
In this case, `bar` is a "metavulnerability".
173
137
174
-
Once metavulnerabilities for a given package are calculated, they are
175
-
cached in the `~/.npm` folder and only re-evaluated if the advisory range
176
-
changes, or a new version of the package is published (in which case, the
177
-
new version is checked for metavulnerable status as well).
138
+
Once metavulnerabilities for a given package are calculated, they are cached in the `~/.npm` folder and only re-evaluated if the advisory range changes, or a new version of the package is published (in which case, the new version is checked for metavulnerable status as well).
178
139
179
-
If the chain of metavulnerabilities extends all the way to the root
180
-
project, and it cannot be updated without changing its dependency ranges,
181
-
then `npm audit fix` will require the `--force` option to apply the
182
-
remediation. If remediations do not require changes to the dependency
183
-
ranges, then all vulnerable packages will be updated to a version that does
184
-
not have an advisory or metavulnerability posted against it.
140
+
If the chain of metavulnerabilities extends all the way to the root project, and it cannot be updated without changing its dependency ranges, then `npm audit fix` will require the `--force` option to apply the remediation.
141
+
If remediations do not require changes to the dependency ranges, then all vulnerable packages will be updated to a version that does not have an advisory or metavulnerability posted against it.
185
142
186
143
### Exit Code
187
144
188
-
The `npm audit` command will exit with a 0 exit code if no vulnerabilities
189
-
were found. The `npm audit fix` command will exit with 0 exit code if no
190
-
vulnerabilities are found _or_ if the remediation is able to successfully
191
-
fix all vulnerabilities.
145
+
The `npm audit` command will exit with a 0 exit code if no vulnerabilities were found.
146
+
The `npm audit fix` command will exit with 0 exit code if no vulnerabilities are found _or_ if the remediation is able to successfully fix all vulnerabilities.
192
147
193
148
If vulnerabilities were found the exit code will depend on the
Copy file name to clipboardExpand all lines: docs/lib/content/commands/npm-bugs.md
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,8 @@ description: Report bugs for a package in a web browser
10
10
11
11
### Description
12
12
13
-
This command tries to guess at the likely location of a package's bug
14
-
tracker URL or the `mailto` URL of the support email, and then tries to
15
-
open it using the [`--browser` config](/using-npm/config#browser) param. If no
16
-
package name is provided, it will search for a `package.json` in the current
17
-
folder and use the `name` property.
13
+
This command tries to guess at the likely location of a package's bug tracker URL or the `mailto` URL of the support email, and then tries to open it using the [`--browser` config](/using-npm/config#browser) param.
14
+
If no package name is provided, it will search for a `package.json` in the current folder and use the `name` property.
0 commit comments