-
Notifications
You must be signed in to change notification settings - Fork 506
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
idea: maintaining an SBOM for cve-bin-tool #1646
Comments
@terriko I have looked at the CycloneDX Python tool using the requirements.txt file. It doesn't do what I believe is needed as this report shows: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Running it with a Python virtualenv does produce a SBOM but it also includes the dependencies for the CycloneDX SBOM tool as well. |
Version is an optional field in CycloneDX v1.4 https://cyclonedx.org/docs/1.4/json/#components_items_version |
Thanks @stevespringett but we need the version string with the package name to allow us to query the vulnerability database. Whilst the version isn't explicity specified in the requirements.txt file, I was expecting that the requirements.txt file would be used to find the version for the specififed python packages (as installed) and their dependencies. |
cve.txt. The SBOM contains all the direct dependencies (specified in the requirements.txt file) together with the implicit dependencies from the included files. There is no consistency between licence names (there are multiple ways of specifying an Apache 2.0 licence!). The file reports (as a comment, the licence file as detected; noting that there are multiple packages with no licence reported. Think it would be good if PyPi enforced SPDX Licence names as it would make life so much easier :-) and consistent. There is probably more that should be added to the SBOM e.g. relationship with the version(s) of Python supported and also the development dependencies. |
Hm, I wonder if we should work on a PEP or tooling suggesting the license name thing. Having the pypi packaging tools spit out a warning might be helpful and probably wouldn't be too hard to write. I'll try to find time to look at it. |
A friend pointed me at https://peps.python.org/pep-0639/ -- I haven't read through the details yet but we might want to read through that and throw our support behind it explicitly if it does what we need. I know many peps don't get much in the way of comments, so going and commenting on the discourse thread may be very impactful: https://discuss.python.org/t/pep-639-round-2-improving-license-clarity-with-better-package-metadata/12622 |
@terriko Do you want to try sbom4python ? It seems to work when I have tested it on cve-bin-tool. |
@anthonyharrison ooh, that's a good idea. Do you just want me to run it and make sure you and I get the same results and then we can check in a file (or maybe two so we have multiple formats), or did you have something else in mind? It would be pretty handy if we could run it in CI and have github actions keep it up to date for us too. |
There are some challenges:
So I guess there's some question of what SBOM we should be maintaining. I was thinking "this SBOM should reflect what you get when you install CVE-bin-tool" but we don't have a way of knowing that precisely because your 2nd level dependencies could be different versions than ours. Some potential ideas:
Thoughts? |
@terriko I am finding the SBOM journey fascinating as it is throwing up all sorts of interesting edge cases. I think we should publish the SBOM with every release as part of the baseline (maybe include it in the distribution and then use a The issue I have found is with the hidden dependencies so the only way I can think of ensuring that every install uses the same version of the dependent packages would be deliver a frozen version of ALL of the packages used by cve-bin-tool in the We should probably be running a job (daily?) to continually scan the SBOM to see if there are any new vulnerabilities being reported (this should be less frequent than updates to the packages) and if so we can then upissue the SBOM/requirements.txt as part of a maintenance release. Getting users to generate SBOMs (OPTION1 above) isn't going to happen soonj as I think the current thinking is that suppliers should be producing SBOMs rather than consumers as it should be capturing the 'as built' position. |
We should probably raise some kind of issue with pip. If they don't want to change the behaviour of |
@terriko There are additional options in pip to consider when upgrading the dependencies.
There is also
Looks like we need to specify |
Do you think we should recommend |
Any news on this issue? The current workflow creates SBOM every week but doesn't print the new one and doesn't update SBOM in the repo. I am not familiar with your release process but if we generate SBOM now it will have version 3.2.1.dev0 for cve-bin-tool. So you'd need to generate the new SBOM for distribution after bumping the version. Another thing to consider is the fact that installations on different Python versions will have different SBOMs. Edit: we'd need 3 versions as of now, one for 3.7, one for 3.8 and another one for 3.9-3.11. I've played a bit with it in sbom-ci branch in my fork. I've modified the workflow to update SBOMs for each version of Python we support when there are changes. Would you be interested in this addition? |
@Molkree interesting thought on separate SBOMs based on Python version. It isn't something I have seen done before as the SBOM relates to an instance of the deployment of the module and its dependencies. Certainly something to consider going forward. |
@anthonyharrison, you can see here that SBOMs for different Python versions differ due to the fact that packages have different dependencies on different versions. I guess it's possible that the platform might affect dependencies as well but it's less common and I haven't checked it for cve-bin-tool. |
Honestly, I haven't thought deeply about this in a while given the chaos of the end of 2022. I'm game for producing some sboms per python version now that reflect 3.2 (even if we have to hand edit things or be a bit had wavy about exactly what would have installed on release day for us). I still don't have a really satisfying answer about how to maintain all of this yet. From a release perspective: I probably should have run a script and checked in what I had as part of my 3.2 release artefacts. If we had the script checking in a set of new sboms daily/weekly/monthly then that would have happened automatically in that it would be stored as part of what was extant when the v3.2 release tag was created, so maybe just enabling this to happen is the easiest solution? We should also have a more formally documented release checklist, which is a good idea for other reasons and wouldn't preclude automation. I'd like to have a public fuzzing policy (and automation) as part of that too. |
We currently maintain two .csv files for scanning components needed or included by cve-bin-tool. Now that we have sbom support, we might want to consider providing an actual SBOM both for that scanning and as information for others intending to use the tool.
I have a minor preference for SPDX format but could be convinced something else is better.
We'd want to have some CI mechanics in place to ensure any SBOM created stays up to date.
The text was updated successfully, but these errors were encountered: