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 License Processing Capability For CycloneDX Generated SBOMs #1

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

REestwick
Copy link
Owner

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 spdx-license-list 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.

@REestwick REestwick merged commit 72437b1 into main Mar 11, 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