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

CycloneDX License Encoding #1770

Open
spiffcs opened this issue Apr 27, 2023 · 1 comment
Open

CycloneDX License Encoding #1770

spiffcs opened this issue Apr 27, 2023 · 1 comment
Labels
enhancement New feature or request format:cyclonedx CycloneDX related enhancement or bug license relating to software licensing question Further information is requested

Comments

@spiffcs
Copy link
Contributor

spiffcs commented Apr 27, 2023

What would you like to be added:
PR #1743 changes how syft processes license encoding for the cycloneDX format.

If syft finds "other licenses", licenses that are not a valid SPDX Expression or in the SPDX license list for a given package, then it generates a list of cyclonedx.Licenses where any single valid spdx ID is it's own license, the "other licenses" are their own license, and any complex expression lifted from the source is slotted under the Name field of an individual cyclonedx license

If no other licenses are found syft merges single ID and expressions into a single SPDX expression under the expression cyclonedx field

This issue is to resolve the case where multiple complex SPDX expressions are lifted from a source along with "other licenses" - given the below test case - it's unclear if we want to drop the "other license" in favor of a merge OR parse the complex expressions into individual licenses.

{
	name: "multiple complex SPDX license expression and a non spdx id",
	input: pkg.Package{
		Licenses: []pkg.License{
			{
				SPDXExpression: "MIT AND GPL-3.0-only",
			},
			{
				SPDXExpression: "MIT AND GPL-3.0-only WITH Classpath-exception-2.0",
			},
			{
				Value: "FOOBAR",
			},
		},
	},
	expected: &cyclonedx.Licenses{
		{
			Expression: "(MIT AND GPL-3.0-only) AND (MIT AND GPL-3.0-only WITH Classpath-exception-2.0)",
		},
	},
},

Why is this needed:
Better license encoding from syft sbom --> CycloneDX format

@spiffcs spiffcs added the enhancement New feature or request label Apr 27, 2023
@wagoodman wagoodman added the license relating to software licensing label Jul 27, 2023
@wagoodman wagoodman added the format:cyclonedx CycloneDX related enhancement or bug label Mar 15, 2024
@wagoodman
Copy link
Contributor

it's unclear if we want to drop the "other license" (FOOBAR in this case)

I feel that we should never drop this kind of information. Assuming that's true, does that mean this is the answer?

(MIT AND GPL-3.0-only) AND (MIT AND GPL-3.0-only WITH Classpath-exception-2.0) AND FOOBAR

@wagoodman wagoodman added the question Further information is requested label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request format:cyclonedx CycloneDX related enhancement or bug license relating to software licensing question Further information is requested
Projects
Status: Backlog
Development

No branches or pull requests

2 participants