auditwheel icon indicating copy to clipboard operation
auditwheel copied to clipboard

Record repaired libraries' provenance into wheel with SBOM

Open sethmlarson opened this issue 11 months ago • 4 comments

Hello! I'm the author of PEP 770 which allows shipping SBOM files inside a Python package archive. PEP 770 is approaching provisional status and adds a new Metadata-Version, so the following work detailed below might take some time before it's usable end-to-end by PyPI and Python package builders.

I propose recording the software ID and provenance for the software libraries that are "repaired" and bundled into Python wheels for manylinux compliance.

Looking at many widely used binary Python packages, auditwheel and the bundling of libraries is quite common! This means there'd be value in recording this information automatically through auditwheel where possible.

This would look like:

  • If the operating system is supported:
  • For each library being repaired:
  • Look up which package provides the package path
  • Record the package name, version, and other identifiers into an SBOM file
  • Add the SBOM file into the Python wheel, adding the Sbom-File field to the Python package metadata.

I've created a rudimentary patch to auditwheel in the past that uses the above approach and have seen positive results with the SBOM/SCA tools Syft and Grype which can detect and report on the bundled software.

Not all software is automatable in this way, this only would cover software libraries that are distributed through a packaging tool like yum or rpm.

sethmlarson avatar Feb 12 '25 22:02 sethmlarson

Hey @sethmlarson, this looks cool!

Do you think the code handling external package managers could live in a separate project? I'm concerned that having this in auditwheel will increase the project's maintenance burden. I'm actually surprised that this isn't something Syft can do since it seems useful for multiple package ecosystems, not just Python. Do you think it would make sense to implement this in Syft, or at least in a separate Python package, outside of auditwheel?

lkollar avatar Feb 13 '25 14:02 lkollar

Do you think the code handling external package managers could live in a separate project?

I definitely think so, and I intend to create this as a separate project and then folks can decide how they want to include it, whether it's copy-pasting the file into their project or including it as an actual dependency :)

sethmlarson avatar Feb 13 '25 15:02 sethmlarson

This was first requested in #398 I had a comment about a PEP being pre-requisite and we're almost there with PEP 770. My other comment in there was similar in part to the one of @lkollar and it seems it's going to be addressed too.

mayeut avatar Feb 14 '25 06:02 mayeut

Now that PEP 770 has been accepted I've created the initial draft pull request here: https://github.com/pypa/auditwheel/pull/577

sethmlarson avatar Apr 24 '25 18:04 sethmlarson