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

Add better support for cyclonedx format #117

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

mateuszdyminski
Copy link
Contributor

We had an issue with purl found by @kevinlinglesas -> https://github.com/ksoclabs/kbom/issues/112

was: pkg:docker.io/istio/operator:1.19.0@sha256:b385e1873b071d6effa468114717846ee38db1b4524fa7fb59335f65d8c49735

now: pkg:oci/operator@sha256%3Ab385e1873b071d6effa468114717846ee38db1b4524fa7fb59335f65d8c49735?repository_url=docker.io%2Fistio%2Foperator&tag=1.19.0

Also root component and dependencies were missing, now it should be aligned with CycloneDX v1.5 specification for the 'purl'

I used following python snippet to validate the schema:

import json
from cyclonedx.model.bom import Bom
from cyclonedx.output.json import JsonV1Dot5
from cyclonedx.output.json import Json as JsonOutputter

def read_bom_from_json(json_file_path):
    with open(json_file_path, 'r') as file:
        bom_data = json.load(file)
        return Bom.from_json(bom_data)

def print_bom_to_stdout(bom):
    print(bom.to_xml_string(pretty_print=True))

if __name__ == "__main__":
    json_file_path = "<path_to_kbom_file>"
    bom = read_bom_from_json(json_file_path)
    my_json_outputter: 'JsonOutputter' = JsonV1Dot5(bom)
    serialized_json = my_json_outputter.output_as_string(indent=2)
    print(serialized_json)

pancernik
pancernik previously approved these changes Dec 14, 2023
Signed-off-by: Mateusz Dymiński <[email protected]>
pancernik
pancernik previously approved these changes Dec 19, 2023
Signed-off-by: Mateusz Dymiński <[email protected]>
@mateuszdyminski mateuszdyminski merged commit 1528798 into main Dec 20, 2023
8 of 9 checks passed
@mateuszdyminski mateuszdyminski deleted the better-cyclonedx-support branch December 20, 2023 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants