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

Added CycloneDX License ID Validation Capability For CycloneDX Formatted SBOMs #1250

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

REestwick
Copy link

@REestwick REestwick commented Mar 11, 2024

When generating CycloneDX (JSON) SBOMs, license information is added in the form of a License ID, as following:

def get_license_from_name(name):
    return {'license': {'id': name}}

in file tern/tern/formats/cyclonedx/cyclonedx_common.py.

When this license information is not a valid SPDX license ID, as defined in the CycloneDX JSON Schema, it results in an invalid SBOM.

E.g. GPLv2+ (incorrect) as opposed to GPL-2.0+ (correct).

This proposed fix alters the get_license_from_name function to validate the name input as a valid SPDX license ID, utilising the cyclonedx-python-lib python module.

If this validation fails, the get_license_from_name function returns the license as a CycloneDX License Name, which can be any string.

Richard Estwick and others added 3 commits March 9, 2024 19:10
@REestwick REestwick closed this Mar 12, 2024
Richard Estwick and others added 2 commits March 12, 2024 17:41
@REestwick REestwick reopened this Mar 12, 2024
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.

1 participant