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

Optional encoding of license text #235

Merged
merged 3 commits into from Nov 20, 2022

Conversation

synaos-bwi
Copy link
Contributor

Per specification, the license text encoding is optional (since v1.1). If stated, it must be one choice of a list of pre-defined values, the only current specified choice is base64.

The Java core code always specified the encoding as base64 with no way to disable the encoding. This was not coherent within the cycloneDX ecosystem, e.g. the npm generator generates a string in plain text. Generating BOMs in a mixed situation leads to differently styled files.

The change at hand offers control over the used encoding, current options are none and base64. For better extensibility and to resemble the specification those choices are modeled as an Enum instead of a toggling boolean. For backwards compatibility old interfaces with their default behavior base64 stay in place. I recommend to deprecate them in the future, to keep the public interface of the LicenseResolver lighter.

Additional test validations have been added for the encoding field. In the future, additional tests could verify that the chosen encoding is actually applied correctly.

If accepted, I'll create a follow-up pull request for the cycloneDX maven plugin to make use of this new functionality.

Signed-off-by: Bernhard Willert <bernhard.willert@synaos.com>
The license text encoding is optional per standard, but was hardcoded as base64.
This implementation makes it optional and is extensible if the standard introduces additional choices for the encoding.
Old behaviour stays as default for backwards compatibility.

Signed-off-by: Bernhard Willert <bernhard.willert@synaos.com>
Signed-off-by: Bernhard Willert <bernhard.willert@synaos.com>
@stevespringett
Copy link
Member

Thanks for the PR

@stevespringett stevespringett merged commit d94610d into CycloneDX:master Nov 20, 2022
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.

None yet

2 participants