Skip to content

Add source dependency SBOM generation - #421

Merged
cooktheryan merged 1 commit into
mainfrom
sbom-source-dependencies
Oct 12, 2026
Merged

cooktheryan merged 1 commit into
mainfrom
sbom-source-dependencies

Conversation

@cooktheryan

@cooktheryan cooktheryan commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add a make sbom target that generates an SPDX JSON inventory of source dependencies with Syft
  • Exclude generated output, Git metadata, and vendored manifests from the scan
  • Add a workflow that generates and uploads the SBOM on PRs, main pushes, and manual runs
  • Document local generation and output overrides

Validation

  • make sbom SYFT='go run github.com/anchore/syft/cmd/syft@v1.54.1'
  • Validated generated SPDX 2.3 JSON metadata and package inventory
  • go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 .github/workflows/sbom.yml
  • git diff --check

Summary by Sourcery

Add automated and local generation of a source dependency SBOM in SPDX JSON format.

New Features:

  • Add a Make target for generating an SPDX JSON inventory of source dependencies.
  • Add CI automation to generate and upload the source SBOM for pull requests, pushes to main, and manual runs.

Enhancements:

  • Exclude Git metadata, vendored files, and generated output from source dependency scanning.
  • Document local SBOM generation, output customization, and scan scope.

CI:

  • Add a pinned GitHub Actions workflow that installs Syft, generates the SBOM, and publishes it as an artifact.

Documentation:

  • Document SBOM generation, configurable output paths, workflow behavior, and scan scope.

@sourcery-ai

sourcery-ai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Sorry @cooktheryan, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 19 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces source dependency SBOM generation through a configurable Syft-backed Make target, integrates it into a pinned GitHub Actions workflow for PRs, main pushes, and manual runs, and documents local usage, output overrides, exclusions, and scan scope.

Sequence diagram for source SBOM generation in CI

sequenceDiagram
    participant Trigger as GitHub event
    participant Actions as GitHub Actions
    participant SyftSetup as download-syft
    participant Make as make sbom
    participant Syft as Syft
    participant Artifact as upload-artifact

    Trigger->>Actions: Start sbom workflow
    Actions->>Actions: checkout
    Actions->>Actions: setup-go
    Actions->>SyftSetup: Install Syft v1.54.1
    SyftSetup-->>Actions: steps.syft.outputs.cmd
    Actions->>Make: make sbom
    Make->>Syft: scan dir:. with source exclusions
    Syft-->>Make: Write SPDX JSON to SBOM_FILE
    Make-->>Actions: _output/sbom/fetchit.spdx.json
    Actions->>Artifact: Upload fetchit-sbom
Loading

Flow diagram for configurable source SBOM generation

flowchart LR
    Source[Source tree] --> Make[make sbom]
    Make --> Syft[SYFT executable]
    Syft --> SPDX[SPDX JSON]
    SPDX --> Output[SBOM_FILE]
    Git[.git] -. excluded .-> Syft
    Vendor[vendor/] -. excluded .-> Syft
    Generated[_output/] -. excluded .-> Syft
Loading

File-Level Changes

Change Details Files
Add a reusable Make target for generating a source dependency SPDX SBOM with Syft while avoiding repository artifacts and vendored manifests.
  • Adds configurable Syft executable and output path variables.
  • Creates the output directory and scans the source tree in SPDX JSON format.
  • Excludes Git metadata, vendored content, and generated output.
  • Skips the vendored build-machinery include when invoking only the SBOM target.
Makefile
Automate SBOM generation and publication in GitHub Actions.
  • Runs on pull requests, pushes to main, and manual dispatches with read-only repository permissions.
  • Pins checkout, Go setup, Syft download, and artifact upload actions.
  • Generates the SBOM through the Make target and uploads the expected SPDX file as an artifact.
.github/workflows/sbom.yml
Document local SBOM generation, customization, workflow behavior, and scope.
  • Documents the Syft-based make command and default SPDX JSON location.
  • Describes SYFT and SBOM_FILE overrides and workflow artifact publication.
  • Clarifies that source dependencies are scanned while container operating-system packages are excluded.
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Signed-off-by: Ryan Cook <rcook@redhat.com>
@cooktheryan
cooktheryan force-pushed the sbom-source-dependencies branch from 7262e70 to 412754b Compare October 12, 2026 18:45
@cooktheryan
cooktheryan merged commit bb867ff into main Oct 12, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant