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/using-npm/dependency-selectors.md
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ The [`npm query`](/commands/npm-query) command exposes a new dependency selector
62
62
-`:path(<path>)`[glob](https://www.npmjs.com/package/glob) matching based on dependencies path relative to the project
63
63
-`:type(<type>)`[based on currently recognized types](https://github.com/npm/npm-package-arg#result-object)
64
64
-`:outdated(<type>)` when a dependency is outdated
65
-
-`:vuln` when a dependency has a known vulnerability
65
+
-`:vuln(<selector>)` when a dependency has a known vulnerability
66
66
67
67
##### `:semver(<spec>, [selector], [function])`
68
68
@@ -106,8 +106,17 @@ Some examples:
106
106
107
107
The `:vuln` pseudo selector retrieves data from the registry and returns information about which if your dependencies has a known vulnerability. Only dependencies whose current version matches a vulnerability will be returned. For example if you have `[email protected]` in your tree, a vulnerability for `semver` which affects versions `<=6.3.1` will not match.
108
108
109
+
You can also filter results by certain attributes in advisories. Currently that includes `severity` and `cwe`. Note that severity filtering is done per severity, it does not include severities "higher" or "lower" than the one specified.
110
+
109
111
In addition to the filtering performed by the pseudo selector, info about each relevant advisory will be added to the `queryContext` attribute of each node under the `advisories` attribute.
110
112
113
+
Some examples:
114
+
115
+
-`:root > .prod:vuln` returns direct production dependencies with any known vulnerability
116
+
-`:vuln([severity=high])` returns only dependencies with a vulnerability with a `high` severity.
117
+
-`:vuln([severity=high],[severity=moderate])` returns only dependencies with a vulnerability with a `high` or `moderate` severity.
118
+
-`:vuln([cwe=1333])` returns only dependencies with a vulnerability that includes CWE-1333 (ReDoS)
0 commit comments