False positives when running a scan from a filesystem or a SBOM #4248
athiol
started this conversation in
False Detection
Replies: 1 comment
-
@athiol thanks for the report and sorry for waiting. |
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
Running
trivy
on a sbom created on a RedHat 8.4 host gives a lot of false positivesOn the host, the sbom was created with
trivy fs --format cyclonedx --output sbom.json /
Then
trivy sbom sbom.json
output many vulnerabilities that are fixed in the RH 8.4 versions, indicating that the vulnerability is fixed in a later version.For example:
But this CVE was fixed in 8.4 by https://access.redhat.com/errata/RHSA-2022:6779 applying amongst others to bind-export-libs-9.11.26-4.el8_4.1.x86_64.rpm
Similarly
This CVE was fixed by https://access.redhat.com/errata/RHSA-2022:4845 applying on zlib-1.2.11-18.el8_4.x86_64.rpm
There are a lot of such false positives which are reported.
Taking a look at the code in
redhat.go
, my understanding is that in the case of scanning a filesystem (directly or from a sbom), trivy skips the ".4" and considers the RHEL8 repositories (rhel-8-for-x86_64-baseos-rpms and rhel-8-for-x86_64-appstream-rpms), but not the eus repositories that we use.On the other hand, when scanning an image based on RHEL8.4 created by Red Hat with a /root/buildinfo directory, trivy can use the specified repositories.
After replacing in the code the default RHEL8 repositories with rhel-8-for-x86_64-baseos-eus-rpms__8_DOT_4 and rhel-8-for-x86_64-appstream-eus-rpms__8_DOT_4 for a test, the false positives are no longer returned.
Is there a way to indicate to trivy to use specific repositories when scanning a filesystem or a sbom?
What did you expect to happen?
Only the CVEs that are not fixed in 8.4 are reported by trivy
What happened instead?
False positives
Output of run with
-debug
:Note: I don't think that the WARNings are directly related to the reported issue.
Output of
trivy -v
:Additional details (base image name, container registry info...):
Beta Was this translation helpful? Give feedback.
All reactions