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

Generate serial numbers deterministically (#420) #425

Merged
merged 2 commits into from
Dec 9, 2023

Conversation

vy
Copy link
Contributor

@vy vy commented Nov 9, 2023

This PR implements two changes:

  1. Serial numbers are generated deterministically by deriving a UUID from groupId, artifactId, and version namespace
  2. Serial numbers are included by default even for reproducible builds (which is disabled now in master due to non-deterministic nature of the serial number generation scheme there)

Copy link
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hboutemy
Copy link
Contributor

hboutemy commented Nov 9, 2023

nice work: I think we should add more data to the seed on the configuration used of cyclonedx-maven-plugin that affect the result, like the scopes configuration and the goal used
that way, we avoid having different configuration give different output with the same uuid

@vy
Copy link
Contributor Author

vy commented Nov 10, 2023

@hboutemy, thanks so much for the prompt review! 🙇

Making seed's entropy reflect the Maven coordinate (composed of groupId, artifactId, and version) was a deliberate decision. AFAIU, there can only be one SBOM deployed to a particular Maven coordinate. Hence, capturing the Maven coordinate uniqueness in the generated serial number sounds logical to me. If the user is expecting a different serial number just because they happen to change, say, the order of plugins, output timestamp, package type, etc., they should not, just like they should not expect Maven coordinate to change too.

Is there a particular real world situation in your mind? Could you share a concrete use case where deriving the serial number only from the Maven coordinate will cause confusion/trouble?

@vy
Copy link
Contributor Author

vy commented Nov 10, 2023

(CI fails since json-unit-assertj-3.2.2 is not Java 8 compatible. I will address this.)

@hboutemy
Copy link
Contributor

hboutemy commented Dec 6, 2023

@hboutemy hboutemy merged commit e8dd5cb into CycloneDX:master Dec 9, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants