Duplicate entries in the affects field of vulnerabilities when outputting CycloneDX #3492
Labels
kind/bug
Categorizes issue or PR as related to a bug.
priority/backlog
Higher priority than priority/awaiting-more-evidence.
Milestone
Description
SBOM scanning sometimes outputs the same package multiple times in the affects field of the vulnerabilities that were found. This goes against the CycloneDX, which specifies the entries in that array must be unique. For reference: CycloneDX Spec
The issue can be reproduced easily with this input data:
Interestingly, if I remove the
pkg:cargo/windows_x86_64_gnullvm@0.42.0
package, the issue is not present anymore.What did you expect to happen?
The list of packages affected by a vulnerability to contain unique items.
What happened instead?
The list of packages affected by a vulnerability contained duplicate entries.
Output of run with
-debug
:Output of
trivy -v
:Additional details (base image name, container registry info...):
Edit: It seems that something is wrong when there are cargo packages involved. If I replace
pkg:cargo/windows_x86_64_gnullvm@0.42.0
bypkg:cargo/ncurses@5.101.0
in the input, not only theaffects
field still has duplicates, but now the vulnerabilities ofpkg:golang/github.com/aws/aws-sdk-go@v1.44.171
are not being reported anymore. Please note that all of this only happens when the format is set to CycloneDX. When using thejson
format, all vulnerabilities are reported as expected.The text was updated successfully, but these errors were encountered: