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
In some cases, peer dependencies are listed in package-lock.json, and then Trivy detects the vulnerabilities for those packages, but Trivy doesn't include them in the dependency tree.
yarn install doesn't record peer dependencies in package-lock.json
yarn list --all doesn't show peer dependencies in the tree
$ yarn list --all
yarn list v1.22.19
Done in 0.17s.
They all work differently.
Ideas
There are two ideas:
Always exclude peer dependencies
Follow the package manager's implementations
Suggestion
Peer dependencies are not strictly project-dependent packages. Therefore, peer dependencies are not installed in npm v6 and are shown separately in the dependency tree, I guess. However, in newer npm versions (v7+), peer dependencies are installed and displayed in the tree like normal dependencies. If Trivy does not show peer dependencies, we expect to receive inquiries from users. To avoid confusion, we would like to opt for the second approach.
If peer dependencies are recorded in the lock file, treat them as normal dependencies, like npm v7+, even though it's not technically accurate.
Description
In some cases, peer dependencies are listed in package-lock.json, and then Trivy detects the vulnerabilities for those packages, but Trivy doesn't include them in the dependency tree.
winston-mail
has a peer dependencywinston
.https://github.com/wavded/winston-mail/blob/19e80d757996a305739536de66ecf3a939360cc4/package.json#L29-L31
npm v3-v6 (tested with v6.14.18)
npm install
doesn't install peer dependenciesnpm install
doesn't record peer dependencies in package-lock.jsonnpm list --all
doesn't show the details of peer dependencies in the tree if they are not found.npm list --all
shows peer dependencies separately in the tree if they are found locally.WHen
winston
is not foundWhen
winston
is foundwinston
is displayed next towinston-mail
, not underwinston-mail
.npm v7+ (tested with v10.9.1) and v1-3(?)
npm install
installs peer dependenciesnpm install
records peer dependencies in package-lock.jsonnpm list --all
shows peer dependencies under the parent in the treewinston
is displayed underwinston-mail
.Yarn (tested with v1.2.22)
yarn install
doesn't install peer dependenciesyarn install
doesn't record peer dependencies in package-lock.jsonyarn list
--all doesn't show peer dependencies in the treeThey all work differently.
Ideas
There are two ideas:
Suggestion
Peer dependencies are not strictly project-dependent packages. Therefore, peer dependencies are not installed in npm v6 and are shown separately in the dependency tree, I guess. However, in newer npm versions (v7+), peer dependencies are installed and displayed in the tree like normal dependencies. If Trivy does not show peer dependencies, we expect to receive inquiries from users. To avoid confusion, we would like to opt for the second approach.
If peer dependencies are recorded in the lock file, treat them as normal dependencies, like npm v7+, even though it's not technically accurate.
References
https://nodejs.org/en/blog/npm/peer-dependencies
The text was updated successfully, but these errors were encountered: