Skip to content

Support new tool metadata format in the merge syft sbom script#452

Closed
brunoapimentel wants to merge 1 commit intohermetoproject:mainfrom
brunoapimentel:syft-sbom-merge-fix
Closed

Support new tool metadata format in the merge syft sbom script#452
brunoapimentel wants to merge 1 commit intohermetoproject:mainfrom
brunoapimentel:syft-sbom-merge-fix

Conversation

@brunoapimentel
Copy link
Copy Markdown
Member

@brunoapimentel brunoapimentel commented Jan 10, 2024

CycloneDX 1.5 changes the way to define tools in the metadata section, and marks the 1.4 way as deprecated.

Syft has adopted the newer format starting from version 0.99.0. This makes the 'merge_syft_sbom.py' script to fail in case a newer Syft SBOM is used.

This patch updates the script so both formats can be handled.

CycloneDX 1.4:

{
   "metadata": {
      "tools": [
          {
             "vendor": "red hat",
             "name": "cachi2"
          }
      ]
   }
}

CycloneDX 1.5:

{
   "metadata": {
      "tools": {
        "components": [
            {
               "type": "application",
               "author": "red hat",
               "name": "cachi2"
            }
        ]
    }
}

Maintainers will complete the following section

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

CycloneDX 1.5 changes the way to define tools in the metadata section,
and marks the 1.4 way as deprecated.

Syft has adopted the newer format starting from version 0.99.0. This
makes the 'merge_syft_sbom.py' script to fail in case a newer Syft
SBOM is used.

This patch updates the script so both formats can be handled.

Signed-off-by: Bruno Pimentel <bpimente@redhat.com>
Comment thread utils/merge_syft_sbom.py
was marked as deprecated.

This function aims to support both formats. Notice that, for simplicity reasons, we're ignoring
the actual 'tools' key present in the Cachi2 generated SBOM, and the data following the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Clever. Will this end up being tech debt?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah... the kind that might never be paid out. We won't likely change anything about the 'tools' content until (if) we get to the point we're actually adding Cachi2's version number to it. Then this needs to be changed.

On the other hand, the reason I took the simple approach was because I was hoping we could have this fixed ASAP to unblock users from using Yarn in Konflux, but we found a simpler way to fix it. So I can actually go back and implement this the right way.

@brunoapimentel
Copy link
Copy Markdown
Member Author

I introduced a slightly improved version of this patch in #448. It does not hard-code the data the merge script inserts into .metadata.tools of the Syft SBOM, but instead relies on the fact that Cachi2 will be producing CycloneDX 1.5 with the updated .metadata.tools format.

I think we can close this PR and use only #448 instead.

chmeliik added a commit to chmeliik/build-definitions that referenced this pull request Feb 7, 2024
The Renovate PR pairs the cachi2 update with a syft update. The latter
breaks the pipeline (changes needed in the SBOM merge script:
hermetoproject/hermeto#452)

Extract the cachi2 update into a separate PR to unblock it.

Signed-off-by: Adam Cmiel <acmiel@redhat.com>
@brunoapimentel
Copy link
Copy Markdown
Member Author

Closing this in favor of #448

jduimovich pushed a commit to jduimovich/build-definitions that referenced this pull request Feb 20, 2024
The Renovate PR pairs the cachi2 update with a syft update. The latter
breaks the pipeline (changes needed in the SBOM merge script:
hermetoproject/hermeto#452)

Extract the cachi2 update into a separate PR to unblock it.

Signed-off-by: Adam Cmiel <acmiel@redhat.com>
skattoju pushed a commit to skattoju/build-definitions that referenced this pull request Feb 20, 2024
The Renovate PR pairs the cachi2 update with a syft update. The latter
breaks the pipeline (changes needed in the SBOM merge script:
hermetoproject/hermeto#452)

Extract the cachi2 update into a separate PR to unblock it.

Signed-off-by: Adam Cmiel <acmiel@redhat.com>
@brunoapimentel brunoapimentel deleted the syft-sbom-merge-fix branch April 13, 2024 12:48
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.

3 participants