Skip to content

PHPLIB-1866: Add automated SBOM generation using cyclonedx-php-composer#1921

Open
jasonhills-mongodb wants to merge 6 commits into
mongodb:v2.xfrom
jasonhills-mongodb:PHPLIB-SBOM/sbom_generation_using_cyclonedx-php-composer
Open

PHPLIB-1866: Add automated SBOM generation using cyclonedx-php-composer#1921
jasonhills-mongodb wants to merge 6 commits into
mongodb:v2.xfrom
jasonhills-mongodb:PHPLIB-SBOM/sbom_generation_using_cyclonedx-php-composer

Conversation

@jasonhills-mongodb

@jasonhills-mongodb jasonhills-mongodb commented Jun 10, 2026

Copy link
Copy Markdown

Summary

This PR adds automated CycloneDX 1.5 SBOM generation for the PHP library, following the same two-stage pattern already established in:

Committing sbom.json to the repository is the established MongoDB driver pattern for pre-build SBOM tracking.

Architecture

Stage 1 — GitHub Actions (.github/workflows/sbom.yml)
Triggered on push to v2.x when composer.json changes (or manually). Installs cyclonedx/cyclonedx-php-composer:6.2.0, runs composer update --ignore-platform-reqs --no-scripts to generate a fresh lock file, generates sbom.json from production dependencies only (--omit dev), validates with cyclonedx-cli v0.32.0, and opens a PR if the content has changed. A stable serial number and monotonic .version counter are maintained across updates.

Stage 2 — Evergreen (.evergreen/config/sbom.yml)
Path-triggered on sbom.json changes. Authenticates to ECR, pulls silkbomb:2.0, and runs silkbomb augment to upload the SBOM to the internal SSDLC tracking system (Dependency Track / Kondukto). Soft-fails if the augmented SBOM changes significantly.

Files changed

  • .evergreen/generate-sbom.sh — SBOM generation script
  • .evergreen/upload-sbom.sh — silkbomb upload script
  • .evergreen/config/functions.ymlupload-sbom Evergreen function
  • .evergreen/config/sbom.ymlupload-sbom task and sbom build variant
  • .evergreen/config.yml — include for sbom.yml
  • .github/workflows/sbom.yml — generation workflow
  • sbom.json — initial SBOM (2 production components: psr/log, symfony/polyfill-php85)

Adds a two-stage SBOM pipeline following the pattern established in
mongo-csharp-driver, mongo-go-driver, and mongo-python-driver:

- GitHub Actions (.github/workflows/sbom.yml): generates sbom.json from
  production Composer dependencies via cyclonedx-php-composer v5, validates
  with cyclonedx-cli, and opens a PR when composer.json changes on v2.x.
  Version tracking increments .version only when content changes.

- Evergreen (.evergreen/config/sbom.yml + upload-sbom.sh): uploads the
  committed sbom.json to the internal SSDLC tracking system via silkbomb
  augment, triggered when sbom.json changes. Soft-fails if the augmented
  SBOM changes significantly.

sbom.json updated with correct production dependencies (psr/log, polyfill-php85)
and stable serial number.
Copilot AI review requested due to automatic review settings June 10, 2026 16:40
@jasonhills-mongodb jasonhills-mongodb requested a review from a team as a code owner June 10, 2026 16:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Introduces automated generation, validation, and upload plumbing for a CycloneDX SBOM, and updates the committed sbom.json to the newly generated output.

Changes:

  • Regenerates sbom.json with updated metadata, components, and dependency graph.
  • Adds a GitHub Actions workflow to regenerate/validate SBOM and open an auto-update PR when it changes.
  • Adds Evergreen task/functionality to augment and upload SBOM via Silkbomb.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sbom.json Updates the committed CycloneDX SBOM content and version metadata.
.github/workflows/sbom.yml Automates SBOM generation/validation and opens a PR when sbom.json changes.
.evergreen/generate-sbom.sh Generates sbom.json and manages a stable serial number + incremental versioning.
.evergreen/upload-sbom.sh Runs Silkbomb augmentation and reports significant augmented SBOM changes to Evergreen.
.evergreen/config/sbom.yml Adds an Evergreen buildvariant/task to run SBOM upload.
.evergreen/config/functions.yml Adds an upload-sbom function integrating AWS role assumption and upload script execution.
.evergreen/config.yml Includes the new Evergreen SBOM config file.

Comment thread .github/workflows/sbom.yml
Comment thread .github/workflows/sbom.yml
Comment thread .github/workflows/sbom.yml Outdated
Comment thread .github/workflows/sbom.yml
Comment thread .evergreen/generate-sbom.sh
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jasonhills-mongodb jasonhills-mongodb changed the title PHPLIB-SBOM: Add automated SBOM generation using cyclonedx-php-composer PHPLIB-1866: Add automated SBOM generation using cyclonedx-php-composer Jun 10, 2026
- Use temp files for SBOM content comparison in generate-sbom.sh
  instead of shell variable capture
- Add jq -S (sort keys) to workflow diff steps to avoid false-positive
  diffs from key reordering
Copilot AI review requested due to automatic review settings June 10, 2026 17:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 7 out of 7 changed files in this pull request and generated 7 comments.

Comment thread .github/workflows/sbom.yml
Comment thread .evergreen/generate-sbom.sh
Comment thread .evergreen/generate-sbom.sh
Comment thread sbom.json
Comment thread sbom.json
Comment thread .evergreen/upload-sbom.sh
Comment thread .evergreen/upload-sbom.sh
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.

3 participants