| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 581a84e commit 4096d81
133 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,13 +93,12 @@ npm init --scope=@foo --yes | |||
| 93 | 93 | #### `auth-type` | |
| 94 | 94 | ||
| 95 | 95 | * Default: "legacy" | |
| 96 | - * Type: "legacy", "webauthn", "sso", "saml", or "oauth" | ||
| 97 | - * DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in | ||
| 98 | - a future version of npm in favor of web-based login. | ||
| 96 | + * Type: "legacy", "web", "sso", "saml", "oauth", or "webauthn" | ||
| 99 | 97 | ||
| 100 | - What authentication strategy to use with `adduser`/`login`. | ||
| 98 | + NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be | ||
| 99 | + removed in a future version. | ||
| 101 | 100 | ||
| 102 | - Pass `webauthn` to use a web-based login. | ||
| 101 | + What authentication strategy to use with `login`. | ||
| 103 | 102 | ||
| 104 | 103 | <!-- automatically generated, do not edit manually --> | |
| 105 | 104 | <!-- see lib/utils/config/definitions.js --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ description: Run a security audit | |||
| 11 | 11 | <!-- see lib/commands/audit.js --> | |
| 12 | 12 | ||
| 13 | 13 | ```bash | |
| 14 | - npm audit [fix] | ||
| 14 | + npm audit [fix|signatures] | ||
| 15 | 15 | ``` | |
| 16 | 16 | ||
| 17 | 17 | <!-- automatically generated, do not edit manually --> | |
@@ -41,6 +41,17 @@ vulnerability is found. It may be useful in CI environments to include the | |||
| 41 | 41 | will cause the command to fail. This option does not filter the report | |
| 42 | 42 | output, it simply changes the command's failure threshold. | |
| 43 | 43 | ||
| 44 | + ### Audit Signatures | ||
| 45 | + | ||
| 46 | + This command can also audit the integrity values of the packages in your | ||
| 47 | + tree against any signatures present in the registry they were downloaded | ||
| 48 | + from. npm will attempt to download the keys from `/-/npm/v1/keys` on | ||
| 49 | + each the registry used to download any given package. It will then | ||
| 50 | + check the `dist.signatures` object in the package itself, and verify the | ||
| 51 | + `sig` present there using the `keyid` there, matching it with a key | ||
| 52 | + returned from the registry. The command for this is `npm audit | ||
| 53 | + signatures` | ||
| 54 | + | ||
| 44 | 55 | ### Audit Endpoints | |
| 45 | 56 | ||
| 46 | 57 | There are two audit endpoints that npm may use to fetch vulnerability | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,7 +102,7 @@ following help topics: | |||
| 102 | 102 | done via [`npm install`](/commands/npm-install) | |
| 103 | 103 | * adduser: | |
| 104 | 104 | Create an account or log in. When you do this, npm will store | |
| 105 | - credentials in the user config file config file. | ||
| 105 | + credentials in the user config file. | ||
| 106 | 106 | * publish: | |
| 107 | 107 | Use the [`npm publish`](/commands/npm-publish) command to upload your | |
| 108 | 108 | code to the registry. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,7 +124,7 @@ IDs](https://spdx.org/licenses/). Ideally you should pick one that is | |||
| 124 | 124 | ||
| 125 | 125 | If your package is licensed under multiple common licenses, use an [SPDX | |
| 126 | 126 | license expression syntax version 2.0 | |
| 127 | - string](https://www.npmjs.com/package/spdx), like this: | ||
| 127 | + string](https://spdx.dev/specifications/), like this: | ||
| 128 | 128 | ||
| 129 | 129 | ```json | |
| 130 | 130 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -215,6 +215,19 @@ exit code. | |||
| 215 | 215 | <!-- automatically generated, do not edit manually --> | |
| 216 | 216 | <!-- see lib/utils/config/definitions.js --> | |
| 217 | 217 | ||
| 218 | + #### `auth-type` | ||
| 219 | + | ||
| 220 | + * Default: "legacy" | ||
| 221 | + * Type: "legacy", "web", "sso", "saml", "oauth", or "webauthn" | ||
| 222 | + | ||
| 223 | + NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be | ||
| 224 | + removed in a future version. | ||
| 225 | + | ||
| 226 | + What authentication strategy to use with `login`. | ||
| 227 | + | ||
| 228 | + <!-- automatically generated, do not edit manually --> | ||
| 229 | + <!-- see lib/utils/config/definitions.js --> | ||
| 230 | + | ||
| 218 | 231 | #### `before` | |
| 219 | 232 | ||
| 220 | 233 | * Default: null | |
@@ -1905,20 +1918,6 @@ When set to `dev` or `development`, this is an alias for `--include=dev`. | |||
| 1905 | 1918 | <!-- automatically generated, do not edit manually --> | |
| 1906 | 1919 | <!-- see lib/utils/config/definitions.js --> | |
| 1907 | 1920 | ||
| 1908 | - #### `auth-type` | ||
| 1909 | - | ||
| 1910 | - * Default: "legacy" | ||
| 1911 | - * Type: "legacy", "webauthn", "sso", "saml", or "oauth" | ||
| 1912 | - * DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in | ||
| 1913 | - a future version of npm in favor of web-based login. | ||
| 1914 | - | ||
| 1915 | - What authentication strategy to use with `adduser`/`login`. | ||
| 1916 | - | ||
| 1917 | - Pass `webauthn` to use a web-based login. | ||
| 1918 | - | ||
| 1919 | - <!-- automatically generated, do not edit manually --> | ||
| 1920 | - <!-- see lib/utils/config/definitions.js --> | ||
| 1921 | - | ||
| 1922 | 1921 | #### `cache-max` | |
| 1923 | 1922 | ||
| 1924 | 1923 | * Default: Infinity | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,7 +39,7 @@ There are some special life cycle scripts that happen only in certain | |||
| 39 | 39 | situations. These scripts happen in addition to the `pre<event>`, `post<event>`, and | |
| 40 | 40 | `<event>` scripts. | |
| 41 | 41 | ||
| 42 | - * `prepare`, `prepublish`, `prepublishOnly`, `prepack`, `postpack` | ||
| 42 | + * `prepare`, `prepublish`, `prepublishOnly`, `prepack`, `postpack`, `dependencies` | ||
| 43 | 43 | ||
| 44 | 44 | **prepare** (since `npm@4.0.0`) | |
| 45 | 45 | * Runs any time before the package is packed, i.e. during `npm publish` | |
@@ -71,6 +71,10 @@ situations. These scripts happen in addition to the `pre<event>`, `post<event>`, | |||
| 71 | 71 | **postpack** | |
| 72 | 72 | * Runs AFTER the tarball has been generated but before it is moved to its final destination (if at all, publish does not save the tarball locally) | |
| 73 | 73 | ||
| 74 | + **dependencies** | ||
| 75 | + * Runs AFTER any operations that modify the `node_modules` directory IF changes occurred. | ||
| 76 | + * Does NOT run in global mode | ||
| 77 | + | ||
| 74 | 78 | #### Prepare and Prepublish | |
| 75 | 79 | ||
| 76 | 80 | **Deprecation Note: prepublish** | |
@@ -96,6 +100,10 @@ The advantage of doing these things at `prepublish` time is that they can be don | |||
| 96 | 100 | * You don't need to rely on your users having `curl` or `wget` or | |
| 97 | 101 | other system tools on the target machines. | |
| 98 | 102 | ||
| 103 | + #### Dependencies | ||
| 104 | + | ||
| 105 | + The `dependencies` script is run any time an `npm` command causes changes to the `node_modules` directory. It is run AFTER the changes have been applied and the `package.json` and `package-lock.json` files have been updated. | ||
| 106 | + | ||
| 99 | 107 | ### Life Cycle Operation Order | |
| 100 | 108 | ||
| 101 | 109 | #### [`npm cache add`](/commands/npm-cache) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,7 +57,7 @@ structure of files and folders: | |||
| 57 | 57 | ``` | |
| 58 | 58 | . | |
| 59 | 59 | +-- node_modules | |
| 60 | - | `-- packages/a -> ../packages/a | ||
| 60 | + | `-- a -> ../packages/a | ||
| 61 | 61 | +-- package-lock.json | |
| 62 | 62 | +-- package.json | |
| 63 | 63 | `-- packages | |
@@ -112,15 +112,15 @@ respect the provided `workspace` configuration. | |||
| 112 | 112 | ||
| 113 | 113 | Given the [specifities of how Node.js handles module resolution](https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together) it's possible to consume any defined workspace | |
| 114 | 114 | by its declared `package.json` `name`. Continuing from the example defined | |
| 115 | - above, let's also create a Node.js script that will require the `workspace-a` | ||
| 115 | + above, let's also create a Node.js script that will require the workspace `a` | ||
| 116 | 116 | example module, e.g: | |
| 117 | 117 | ||
| 118 | 118 | ``` | |
| 119 | - // ./workspace-a/index.js | ||
| 119 | + // ./packages/a/index.js | ||
| 120 | 120 | module.exports = 'a' | |
| 121 | 121 | ||
| 122 | 122 | // ./lib/index.js | |
| 123 | - const moduleA = require('workspace-a') | ||
| 123 | + const moduleA = require('a') | ||
| 124 | 124 | console.log(moduleA) // -> a | |
| 125 | 125 | ``` | |
| 126 | 126 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -207,12 +207,11 @@ <h4 id="scope"><code>scope</code></h4> | |||
| 207 | 207 | <h4 id="auth-type"><code>auth-type</code></h4> | |
| 208 | 208 | <ul> | |
| 209 | 209 | <li>Default: "legacy"</li> | |
| 210 | - <li>Type: "legacy", "webauthn", "sso", "saml", or "oauth"</li> | ||
| 211 | - <li>DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in | ||
| 212 | - a future version of npm in favor of web-based login.</li> | ||
| 210 | + <li>Type: "legacy", "web", "sso", "saml", "oauth", or "webauthn"</li> | ||
| 213 | 211 | </ul> | |
| 214 | - <p>What authentication strategy to use with <code>adduser</code>/<code>login</code>.</p> | ||
| 215 | - <p>Pass <code>webauthn</code> to use a web-based login.</p> | ||
| 212 | + <p>NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be | ||
| 213 | + removed in a future version.</p> | ||
| 214 | + <p>What authentication strategy to use with <code>login</code>.</p> | ||
| 216 | 215 | <!-- raw HTML omitted --> | |
| 217 | 216 | <!-- raw HTML omitted --> | |
| 218 | 217 | <!-- raw HTML omitted --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -142,14 +142,14 @@ <h1 id="npm-audit">npm-audit</h1> | |||
| 142 | 142 | ||
| 143 | 143 | <section id="table_of_contents"> | |
| 144 | 144 | <h2 id="table-of-contents">Table of contents</h2> | |
| 145 | - <div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#audit-endpoints">Audit Endpoints</a></li><ul><li><a href="#bulk-advisory-endpoint">Bulk Advisory Endpoint</a></li><li><a href="#quick-audit-endpoint">Quick Audit Endpoint</a></li><li><a href="#scrubbing">Scrubbing</a></li><li><a href="#calculating-meta-vulnerabilities-and-remediations">Calculating Meta-Vulnerabilities and Remediations</a></li></ul><li><a href="#exit-code">Exit Code</a></li><li><a href="#examples">Examples</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#audit-level"><code>audit-level</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#force"><code>force</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#package-lock-only"><code>package-lock-only</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#foreground-scripts"><code>foreground-scripts</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li><li><a href="#install-links"><code>install-links</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> | ||
| 145 | + <div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#audit-signatures">Audit Signatures</a></li><li><a href="#audit-endpoints">Audit Endpoints</a></li><ul><li><a href="#bulk-advisory-endpoint">Bulk Advisory Endpoint</a></li><li><a href="#quick-audit-endpoint">Quick Audit Endpoint</a></li><li><a href="#scrubbing">Scrubbing</a></li><li><a href="#calculating-meta-vulnerabilities-and-remediations">Calculating Meta-Vulnerabilities and Remediations</a></li></ul><li><a href="#exit-code">Exit Code</a></li><li><a href="#examples">Examples</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#audit-level"><code>audit-level</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#force"><code>force</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#package-lock-only"><code>package-lock-only</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#foreground-scripts"><code>foreground-scripts</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li><li><a href="#install-links"><code>install-links</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> | ||
| 146 | 146 | </section> | |
| 147 | 147 | ||
| 148 | 148 | <div id="_content"><h3 id="synopsis">Synopsis</h3> | |
| 149 | 149 | <!-- raw HTML omitted --> | |
| 150 | 150 | <!-- raw HTML omitted --> | |
| 151 | 151 | <!-- raw HTML omitted --> | |
| 152 | - <pre lang="bash"><code>npm audit [fix] | ||
| 152 | + <pre lang="bash"><code>npm audit [fix|signatures] | ||
| 153 | 153 | </code></pre> | |
| 154 | 154 | <!-- raw HTML omitted --> | |
| 155 | 155 | <!-- raw HTML omitted --> | |
@@ -170,6 +170,14 @@ <h3 id="description">Description</h3> | |||
| 170 | 170 | <code>--audit-level</code> parameter to specify the minimum vulnerability level that | |
| 171 | 171 | will cause the command to fail. This option does not filter the report | |
| 172 | 172 | output, it simply changes the command's failure threshold.</p> | |
| 173 | + <h3 id="audit-signatures">Audit Signatures</h3> | ||
| 174 | + <p>This command can also audit the integrity values of the packages in your | ||
| 175 | + tree against any signatures present in the registry they were downloaded | ||
| 176 | + from. npm will attempt to download the keys from <code>/-/npm/v1/keys</code> on | ||
| 177 | + each the registry used to download any given package. It will then | ||
| 178 | + check the <code>dist.signatures</code> object in the package itself, and verify the | ||
| 179 | + <code>sig</code> present there using the <code>keyid</code> there, matching it with a key | ||
| 180 | + returned from the registry. The command for this is <code>npm audit signatures</code></p> | ||
| 173 | 181 | <h3 id="audit-endpoints">Audit Endpoints</h3> | |
| 174 | 182 | <p>There are two audit endpoints that npm may use to fetch vulnerability | |
| 175 | 183 | information: the <code>Bulk Advisory</code> endpoint and the <code>Quick Audit</code> endpoint.</p> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -166,7 +166,7 @@ <h3 id="description">Description</h3> | |||
| 166 | 166 | the results to only the paths to the packages named. Note that nested | |
| 167 | 167 | packages will <em>also</em> show the paths to the specified packages. For | |
| 168 | 168 | example, running <code>npm ls promzard</code> in npm's source tree will show:</p> | |
| 169 | - <pre lang="bash"><code>npm@8.13.2 /path/to/npm | ||
| 169 | + <pre lang="bash"><code>npm@8.14.0 /path/to/npm | ||
| 170 | 170 | └─┬ init-package-json@0.0.4 | |
| 171 | 171 | └── promzard@0.1.5 | |
| 172 | 172 | </code></pre> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments