-
Notifications
You must be signed in to change notification settings - Fork 23
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
container component purl format not consistent with CycloneDX specifications #112
Comments
Thanks for your detailed analysis and finding this bug - Yes our I have fix the issue with following PR: https://github.com/ksoclabs/kbom/pull/117 we think that we should use purl in form:
but any feedback is more than welcome! |
Hi @mateuszdyminski, Thank you for the quick turn around on this issue. I had another comment based on something I've noticed while using the #117 changes. For components like the Now, one will be required to parser further into the qualifiers to pull out the Is it possible for the "name:" and "cdx:k8s:component:name" to include the "namespace/name" again? The changes required for purl format compliance are a subset of the changes seen in #117 and is it possible to limit the changes just to the purl field? |
I have reverted the name to the old version in https://github.com/ksoclabs/kbom/pull/117. Now the output looks like:
Please @kevinlinglesas let us know if it works for you. Thanks again for your help! |
@mateuszdyminski, |
@kevinlinglesas Please let me know if this |
@mateuszdyminski |
#117 has been merged Changes released in |
The Scenario
Given a kbom (v0.2.4) generated bom file with a set of 'container' type components that include package URL (
purl
) fields reflecting, presumably, docker images that are resources in the kubernetes cluster.The bom is CycloneDX json format. I am also using another open source tool: https://github.com/CycloneDX/cyclonedx-python-lib. Specifically, I am using the
from_json()
method available with the project'sBom
class to deserialize from a CycloneDX JSON BOM (ie, the afore mentioned kbom bom file).The Issue
At the point where the first
purl
in the bom is encountered, and exception is thrown.This exception is coming from cyclonedx-python-lib's usage of https://github.com/package-url/packageurl-python 's
PackageURL.from_string()
.That usage isn't arbitrary. The CycloneDX v1.5 specification for the 'purl' indicates a
purl
MUST be valid and conform to the specification defined at: https://github.com/package-url/purl-spec.It appears that a portion of the kbom generated URL is being interpreted as a "URL Authority component" and those are not allowed. See bullet 3 of section "A purl is a URL" in the purl-spec.
The Ask
Do you agree that the format of
purl
fields currently generated by kbom do not adhere to the required format as prescribed by CycloneDX specificications?It would be desirable to be able to interoperate with another emerging open source toolset like cyclonedx-python-lib.
Potential Format Changes
If the kbom generated
purl
is altered as follows,packageurl
is happy. Note: sha shortened for brevity.In particular, from the seven components the purl-spec defines:
pkg:
- Per the spec, only pkg scheme defined.docker
- Added this per the pkg type that spec defines.registry.k8s.io
- not sure if this is best here or as a qualifier per the example in the spec.kube-scheduler
- the image namethe sha digest value
- moved around a bittag=v1.26.1
- moved to a qualifier so as to not lose this informationI am uncertain on whether my qualifiers are good our not. It was an attempt to retain the tag.
I was attempting to craft a purl where all the information needed to pull the image was there, even if not available
in a direct copy/paste form. Not that there is a requirement for that perse, but it seems to me it would be potentially useful to the consumers of SBOMs (automated or otherwise). The docker image can still be pulled using 'docker pull registry.k8s.io/kube-scheduler@sha256:af0292c...' (not including qualifiers). Automations should be able to further parse and craft pull commands.
References
The text was updated successfully, but these errors were encountered: