Skip to content

Add workflow code to generate SBOMs and upload them to the release/pre-release#179

Open
jsf9k wants to merge 21 commits intodevelopfrom
feature/add-sbom
Open

Add workflow code to generate SBOMs and upload them to the release/pre-release#179
jsf9k wants to merge 21 commits intodevelopfrom
feature/add-sbom

Conversation

@jsf9k
Copy link
Copy Markdown
Member

@jsf9k jsf9k commented Jan 20, 2026

🗣 Description

This pull request:

  • Adds workflow code to generate SBOMs for the Python distribution package
  • If we happen to be building a release or pre-release then the SBOMs will be uploaded to the release or pre-release.
  • Adds workflow code to create provenance attestations for the SBOMs and the Python distribution package
  • Adds workflow code to create SBOM attestations for the Python distribution package

💭 Motivation and context

CISA advocates for the use of SBOMs, so we should be generating them for our software products.

Resolves #178.

🧪 Testing

All automated tests pass.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All new and existing tests pass.

✅ Pre-merge checklist

  • Mark SBOM checks as required.

@jsf9k jsf9k self-assigned this Jan 20, 2026
@jsf9k jsf9k moved this to In Progress in Next Kraken Jan 20, 2026
@github-actions github-actions Bot added the github-actions Pull requests that update GitHub Actions code label Jan 20, 2026
@jsf9k jsf9k force-pushed the feature/add-sbom branch 6 times, most recently from 85920f3 to 6a499a3 Compare January 20, 2026 21:50
jsf9k added 2 commits January 21, 2026 00:02
Thus our SBOMs are named, e.g.,
cisagov-skeleton-python-library.py3.13.spdx-json rather than
sbom.py3.13.spdx-json.
The latest release supports the artifact-metadata permission that we
are now using in the generate-sbom job of the build.yml GitHub Actions
workflow.
@github-actions github-actions Bot added dependencies Pull requests that update a dependency file version bump This issue or pull request increments the version number python Pull requests that update Python code labels Jan 26, 2026
@jsf9k jsf9k removed version bump This issue or pull request increments the version number python Pull requests that update Python code labels Jan 26, 2026
@jsf9k jsf9k marked this pull request as ready for review January 26, 2026 19:05
@jsf9k jsf9k moved this from In progress to Review in progress in Skeleton Maintenance Jan 26, 2026
@jsf9k jsf9k force-pushed the feature/add-sbom branch from 407cce7 to 58b63d0 Compare March 9, 2026 17:00
Note that actions/attest-build-provenance has changed its name to
actions/attest, partly because it now supports different types of
attestations.  One such type is an SBOM attestation, which we are now
using here.
@jsf9k jsf9k force-pushed the feature/add-sbom branch from 58b63d0 to 3ef4839 Compare March 9, 2026 17:20
@jsf9k jsf9k requested a review from dav3r March 10, 2026 17:02
@jsf9k jsf9k force-pushed the feature/add-sbom branch from 83337e8 to 03bd84e Compare March 10, 2026 17:14
Copy link
Copy Markdown
Member

@dav3r dav3r left a comment

Choose a reason for hiding this comment

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

👍 👍

@jsf9k jsf9k force-pushed the feature/add-sbom branch from 502f151 to 26e7ea5 Compare March 10, 2026 17:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jsf9k jsf9k requested a review from rm-sbin-sh April 14, 2026 15:19
@github-project-automation github-project-automation Bot moved this from Review in progress to Reviewer approved in Skeleton Maintenance Apr 15, 2026
Copy link
Copy Markdown
Contributor

@felddy felddy left a comment

Choose a reason for hiding this comment

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

Looks good. Nice and clean.

Not today, but in the future, we should consider decoupling the attestation steps from the build process. i.e., move attestation to its own workflow. This will be helpful when we move to reusable workflows, and have various artifacts to attest. (SBOMs, vulnerability scans, provenance, etc..)

Strong work! 💪

Copy link
Copy Markdown
Member

@mcdonnnj mcdonnnj left a comment

Choose a reason for hiding this comment

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

I spoke with @jsf9k in person about this but I have some reservations about SBOMs for our Python projects. The issue is that the only way to generate one at present is to create a lockfile of some kind (this PR uses Pipfile.lock) and generate an SBOM from this snapshot of dependencies. Unlike our Docker images there is no guarantee that the same software with the same versions will be installed when installing the project/wheel at a later point in time.

- name: Setup tmate debug session
uses: mxschmitt/action-tmate@v3
if: env.RUN_TMATE
generate-sbom:
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.

I think a release workflow still makes sense here. We should be uploading a wheel to releases and it does not need to be built with different Python versions. I think a release workflow that builds a wheel for the release and then uploads the built wheel and SBOMs generated from that wheel makes more sense than band-aiding it to this workflow.

artifact-name: >-
${{ steps.manipulate-repo-name.outputs.repo-name }}.py${{
matrix.python-version }}.${{ matrix.sbom-format }}
file: Pipfile.lock
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.

An issue here is the SBOM may not accurately reflect the result of installing the Python package. The Pipfile.lock file is a snapshot in time of the dependency chain, but there is no guarantee of the same result if you install the wheel at a later point.

@jsf9k
Copy link
Copy Markdown
Member Author

jsf9k commented Apr 27, 2026

@mcdonnnj mentioned PEP 770, which is related. See also here and pypa/setuptools#4821).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file github-actions Pull requests that update GitHub Actions code

Projects

Status: In Progress
Status: Reviewer approved

Development

Successfully merging this pull request may close these issues.

Upload an SBOM for each release

6 participants