Trivy reporting vulnerabilities based on wrong package version in yarn projects #5565
Closed
brentswisher
started this conversation in
Bugs
Replies: 2 comments 4 replies
-
Hello @brentswisher Did you remove Regards, Dmitriy |
Beta Was this translation helpful? Give feedback.
4 replies
-
Created #5575 for this task. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
When using a
dependenciesMeta
key in ayarn.lock
file, trivy is incorrectly parsing dependency information resulting in invalid scan results and potentially missing vulnerabilities.For example, in the following sample
yarn.lock
file:Correctly parsing this would find:
However, trivy parses it as follows:
Because
devcert
v1.1.0 has vulnerabilities in versions prior to v1.2.1 and trivy incorrectly think 1.1.0 it installed, it reports those vulnerabilities:While in this case it is resulting in a false positive, a false negative could also exist if
some-dependency-package
had a higher version than its dependency.It appear to specifically be the version number (devcert@1.2.2) in dependenciesMeta which causes this to occur.
See https://github.com/brentswisher/trivy-bug-sample/blob/main/README.md for working samples proving out the bug and demonstrating it is specifically the version string in
dependenciesMeta
which causes the behavior.Desired Behavior
When parsing
yarn.lock
files, Trivy correctly parses the dependencies so that it reports vulnerabilities correctly.Actual Behavior
When parsing
yarn.lock
files, Trivy mistakenly uses a dependence's version number with it's sub-dependency name, resulting in invalid vulnerability scans.Reproduction Steps
Target
Filesystem
Scanner
Vulnerability
Output Format
None
Mode
Standalone
Debug Output
Operating System
macOS 13.5.2
Version
Checklist
trivy image --reset
Beta Was this translation helpful? Give feedback.
All reactions