Skip to content

Generate SBOM for wheels #908

@lcarva

Description

@lcarva

A recent discussion in the python community reached the conclusion that SBOMs should be used to identify the origin of a certain python package. This was then adopted in the Fedora Rawhide community.

Given that Fromager's purpose is to build wheels, it would be wonderful if Fromager could also generate an SBOM along the way. Expanding on the Rawhide example:

{
  "bomFormat": "CycloneDX",
  "specVersion": "1.6",
  "components": [
    {
      "type": "library",
      "name": "requests",
      "version": "2.32.5",
      "purl": "pkg:pypi/requests@2.32.5?repository_url=https://my.index.example.com"
    }
  ]
}

The important piece is the purl attribute. It follows the spec for python packages and it adds a qualifier, repository_url to specify an alternate locaion.

The value of repository_url should indicate the index of where the package will be published to. Since Fromager has no way of knowing this, a new optional parameter should be added. If the parameter is not provided, repository_url is not added to the purl. (This could be used to support cases where Fromager is used to build wheels intended to be published on pypi.org.)

As per PEP-770 the SBOM should reside under the .dist-info/sboms directory. There are two main SBOM format CycloneDX and SPDX. I don't think Formager needs to support generating both. No preference is given to either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions