Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the genereated .\_manifest\spdx_2.2\manifest.spdx.json scaned with trivy got no vulnerbiltiy #778

Open
baoj-dfo opened this issue Nov 5, 2024 · 12 comments
Labels
needs customer input Awaiting input from user before proceeding

Comments

@baoj-dfo
Copy link

baoj-dfo commented Nov 5, 2024

when use trivy to scan the image, got some vulnerbiltiy,
but using this sbom tool to getnerated ._manifest\spdx_2.2\manifest.spdx.json, then run trivy sbom ._manifest\spdx_2.2\manifest.spdx.json
returns
2024-11-04T... INFO [vuln] Vulnerability scanning is enabled
2024-11-04T... INFO Detected SBOM format format="spdx-json"
2024-11-04T... INFO Number of language-specific files num=0

._manifest\spdx_2.2\manifest.spdx.json contains about same number od packages as the sbom file genereated by trivy.

@JoseRenan
Copy link
Member

Hi @baoj-dfo, thanks for reporting! Could you please provide more details on what are you trying to do, and the expected outcomes?

@JoseRenan JoseRenan added the needs customer input Awaiting input from user before proceeding label Nov 6, 2024
@baoj-dfo
Copy link
Author

baoj-dfo commented Nov 6, 2024

@JoseRenan , can you give me email ?, I'll send you the two spdx files generated by MS sbom and trivy for investigation
the expected outcomes is to trivy sbom of those 2 files to get same results.

@JoseRenan
Copy link
Member

@baoj-dfo you can send the files through Github Gist and give the links or upload them here!

@DaveTryon DaveTryon added needs triage Default status upon issue submission and removed needs triage Default status upon issue submission labels Nov 7, 2024
@DaveTryon
Copy link
Contributor

DaveTryon commented Nov 7, 2024

@baoj-dfo, we triaged this today. We will only be able to take action if you can provide a demonstrable case where the SPDX data generated by sbom-tool is non-compliant with the SPDX spec. We know that we're specifying 2.2 as our SPDX version (instead of 2.2.2), but other than that we believe that our output is SPDX-compliant.

As mentioned previously, please put the non-compressed manifest.spdx.json file into a Gist, as well as a reference to the SPDX spec that seems out of sync, and we can investigate it from there. Thanks!

@baoj-dfo
Copy link
Author

baoj-dfo commented Nov 7, 2024

@JoseRenan
Copy link
Member

@baoj-dfo I've noticed in the files that they are in different versions of SPDX format, our tool generates the SPDX 2.2 version format while the Trivy one is using the 2.3 version format. Maybe that's a issue you should bring to Trivy's team so they can investigate why the result is different for different formats. Also, we noticed that the files field is empty in one of the JSONs. But I'm not sure on how Trivy looks for vulnerabilities or generates the spdx, so you should try opening a issue with them for getting a better support on this scenario.

@baoj-dfo
Copy link
Author

baoj-dfo commented Nov 8, 2024

@JoseRenan
It appears that Microsoft doesn’t provide a tool specifically for generating vulnerability reports from SBOM files. What tools would you suggest, or which ones are commonly used by Microsoft developers?

@JoseRenan
Copy link
Member

@baoj-dfo yes we don't have a public tool for that unfortunately, but as I told you, what caught my attention is that your files section on the SPDX is empty for the one generated by our sbom-tool, I don't know how you ran the tool so the json was generated that way, but since I don't know how trivy works, that could be one of the reasons they are not finding any vulnerabilities, because besides that, the only other noticeable difference between the files seems to be the SPDX version.

@baoj-dfo
Copy link
Author

baoj-dfo commented Nov 9, 2024

@JoseRenan
I didn't get any error, so files section is empty , that could be the sbom-tool's problem ?
sbom-tool generate -di apsabacacr.azurecr.io/ncds/ncdsapi:latest -m . -ps 'aa' -pn 'bb' -pv "cc"

I also tried Grype, and it works well alongside Trivy. The SBOM generated by one tool can be scanned by the other, yielding the same vulnerability results.

@rhyskoedijk
Copy link

rhyskoedijk commented Nov 11, 2024

@baoj-dfo I believe the files section of the SPDX is only populated if you specify the -b or -bl options. It won't detect files within the ncdsapi image.

I could be completely misunderstanding what you are doing, but maybe something like this would get the results you are expecting?

# export the docker image filesystem to a local directory that sbom-tool can scan it
docker container create --name my-build-container apsabacacr.azurecr.io/ncds/ncdsapi:latest
docker export my-build-container -o my-build-container-fs

# generate a sbom using the exported filesystem (files) and docker image (packages)
sbom-tool generate -b my-build-container-fs/usr/local/ncds_api -di apsabacacr.azurecr.io/ncds/ncdsapi:latest -m . -ps 'aa' -pn 'bb' -pv "cc"

@baoj-dfo
Copy link
Author

@rhyskoedijk
Followed your steps, it generated the same ._manifest\spdx_2.2\manifest.spdx.json as before

(get-content ._manifest\spdx_2.2\manifest.spdx.json | convertfrom-json).packages.length return 43
(get-content .\sbom.syft.spdx.json | convertfrom-json).packages.length return 321 # syft
(get-content .\spdx.json | convertfrom-json).packages.length return 321 # trivy

The SBOM file generated by MS missing a lots of packages, some of them contributed to vulnerabilities.
spring-security-web
commons-io
...

@rhyskoedijk
Copy link

@baoj-dfo ignore me, looks like I misunderstood what you were trying achieve; Sounds like your issue is that the number of spdx "packages" reported by sbom-tool is not consistent with what is reported by other tools, which has nothing to do with the spdx "files".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs customer input Awaiting input from user before proceeding
Projects
None yet
Development

No branches or pull requests

4 participants