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

Adding optional RPM summary to SBOMs #762

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

a-ovchinnikov
Copy link
Contributor

@a-ovchinnikov a-ovchinnikov commented Dec 4, 2024

This change adds an option to include RPM summary in a SBOM.

Maintainers will complete the following section

  • Commit messages are descriptive enough
  • Code coverage from testing does not decrease and new code is covered
  • Docs updated (if applicable)
  • Docs links in the code are still valid (if docs were updated)

Note: if the contribution is external (not from an organization member), the CI
pipeline will not run automatically. After verifying that the CI is safe to run:

@a-ovchinnikov a-ovchinnikov requested review from eskultety and brunoapimentel and removed request for eskultety December 4, 2024 10:57
cachi2/core/models/property_semantics.py Outdated Show resolved Hide resolved
@@ -7,6 +7,7 @@
PropertyName = Literal[
"cachi2:bundler:package:binary",
"cachi2:found_by",
"cachi2:rpm_summary",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use a custom cachi2 property or perhaps the description field for a CycloneDX Component instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe. I'll need to think about it more. A Property looks the least invasive way of doing this.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we decide to go the component.description path, we might be able to map it to SPDX similarly:
https://spdx.github.io/spdx-spec/v2.3/package-information/#718-package-summary-description-field

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW properties can be straightforwardly converted to annotations.

Copy link
Member

Choose a reason for hiding this comment

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

Should we use a custom cachi2 property or perhaps the description field for a CycloneDX Component instead?

Description feels more natural, but then we need to sit down and define what description is expected to represent a particular PM backend's component to remain consistent across all backends. In that case, also for consistency reasons, we should also introduce the same functionality to the rest of the backends in a short timeline span in order not to leave the rest of PMs behind; note that a custom property IMO feels like less of a problem for consistency than making use of an existing CycloneDX field suited directly for this purpose.

Copy link
Member

@eskultety eskultety Jan 9, 2025

Choose a reason for hiding this comment

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

@taylormadore would you care enough to create an issue on investigating the possibility of adopting a more general approach covering all backends via the built-in description field? I like the idea in general and I feel we should invest some time into exploring the possibility before ruling it out completely.

@a-ovchinnikov a-ovchinnikov marked this pull request as ready for review January 2, 2025 18:41
@a-ovchinnikov a-ovchinnikov changed the title WIP: Adding optional RPM summary to SBOMs Adding optional RPM summary to SBOMs Jan 2, 2025
@brunoapimentel
Copy link
Contributor

/retest

Copy link
Member

@eskultety eskultety left a comment

Choose a reason for hiding this comment

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

One major comment, otherwise we're pretty much set for merging, one last respin will be needed.

cachi2/core/models/property_semantics.py Outdated Show resolved Hide resolved
cachi2/core/package_managers/rpm/main.py Outdated Show resolved Hide resolved
@@ -216,6 +216,7 @@ class RpmPackageInput(_PackageInputBase):
"""Accepted input for a rpm package."""

type: Literal["rpm"]
add_rpm_summary: bool = False
Copy link
Member

Choose a reason for hiding this comment

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

nitpick - it's part of RpmPackageInput already so the 'rpm' part of the option name is redundant, but at the same time the name itself doesn't indicate this is an SBOM only flag - what about sbom_inlude_summary OR include_summary_in_sbom? What I'm after is some kind of naming pattern that could be reasonably reusable for other such flags we might be required to add, IOW include_XYZ_in_sbom.

Copy link
Member

Choose a reason for hiding this comment

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

same naming nitpick - I apologize for not having been clearer in my initial response, but I having "sbom" somehow mentioned in the option would be beneficial. If this were an internal variable I would have resolved the thread already, but sadly this is an input JSON option which isn't properly documented (I mean you can't really run a help on the input json like you would on other CLI options) and so having a clear descriptive name on the option so that users immediately know what to expect from the flag is a huge plus IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, done.

@brunoapimentel
Copy link
Contributor

/retest

Copy link
Member

@eskultety eskultety left a comment

Choose a reason for hiding this comment

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

Approve, but please try to address the input JSON option naming nitpick I raised I think it's justified for users sake.

"value": "cachi2"
},
{
'name': 'cachi2:rpm_summary',
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: single quotes instead of double quotes (multiple occurrences). I would not even notice if GH UI wouldn't flag this in red for me, that's why I'm mentioning it (it's also the only bom.json with this pattern so it would be inconsistent :) ).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@@ -216,6 +216,7 @@ class RpmPackageInput(_PackageInputBase):
"""Accepted input for a rpm package."""

type: Literal["rpm"]
add_rpm_summary: bool = False
Copy link
Member

Choose a reason for hiding this comment

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

same naming nitpick - I apologize for not having been clearer in my initial response, but I having "sbom" somehow mentioned in the option would be beneficial. If this were an internal variable I would have resolved the thread already, but sadly this is an input JSON option which isn't properly documented (I mean you can't really run a help on the input json like you would on other CLI options) and so having a clear descriptive name on the option so that users immediately know what to expect from the flag is a huge plus IMO.

This change adds an option to include RPM summary in a SBOM.

Signed-off-by: Alexey Ovchinnikov <[email protected]>
@a-ovchinnikov a-ovchinnikov added this pull request to the merge queue Jan 16, 2025
Merged via the queue into hermetoproject:main with commit 38f8cd9 Jan 16, 2025
14 of 15 checks passed
@a-ovchinnikov a-ovchinnikov deleted the rpm_adding_summary branch January 16, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants