Skip to content

CSHARP-5626: Add evergreen script to generate CycloneDX SBOM #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jasonhills-mongodb
Copy link

Added a bash script to generate a build lifecycle CycloneDX SBOM using the cyclonedx-dotnet tool. The script installs a fixed version of cyclonedx-dotnet, runs a versioned dotnet restore, and generates an SBOM for each of the 4 MongoDB.Driver Nuget packages.

To ensure accurate results, two queries are run against each of the .csproj files to ensure all development packages are excluded and that any local <ProjectReference> items are marked in the SBOM as Nuget packages. Once all 4 SBOMs are created, they are merged into a single hierarchical SBOM file.

The file is saved as sbom.cdx.json (as opposed to the current sbom.json) which is the preferred file extension for CycloneDX files. There is not yet any code to commit the new SBOM to the repo. This is to allow for evaluation of the new SBOM first without interfering with the current workflow to upload the current static sbom.json file to Kondukto.

There is also a line added to download-augmented-sbom.sh to copy the augmented SBOM to vex.cdx.json (also not yet committed to repo) after it has been uploaded to the release artifacts bucket, as this is how we should be storing the augmented SBOM for public consumption.

Once the SBOM generation process has been approved, I will add commit code for both of the cdx.json files, remove the sbom.json file and update download-augmented-sbom.sh to use the new sbom.cdx.json file.

Added a bash script to generate a 'build' lifecycle CycloneDX SBOM using
the cyclonedx-dotnet tool. The script installed a fixed version of
cyclonedx-dotnet, runs a versioned dotnet restore, and generates an SBOM
for each of the 4 MongoDB.Driver Nuget packages.

To ensure accurate results, two queries are run against each of the
.csproj files to ensure all development packages are excluded and that
any local <ProjectReference> items are marked in the SBOM as Nuget
packages. Once all 4 SBOMs are created, they are merged into a single
heirarchical SBOM file.

The file is saved as sbom.cdx.json (as opposed to the current sbom.json)
which is the preferred file extention for CycloneDX files. There is not
yet any code to commit the new SBOM to the repo. This is to allow for
evaluation of the new SBOM first without intefering with the current
workflow to upload the current static sbom.json file to Kondukto.

There is also a line added to download-augmented-sbom.sh to copy the
augmented SBOM to ./vex.cdx.json (also not yet committed to repo) after
it has been uploaded to the release artifacts bucket, as this is how we
should be storing the augmented SBOM for public consumption.

Once the SBOM generation process has been approved, I will add commit
code for both of the cdx.json files, remove th sbom.json file and update
download-augmented-sbom.sh to use the new sbom.cdx.json file.
Undoing unintended changes to evergreen.yml
@jasonhills-mongodb jasonhills-mongodb marked this pull request as ready for review July 1, 2025 15:50
@jasonhills-mongodb jasonhills-mongodb requested a review from a team as a code owner July 1, 2025 15:50
@jasonhills-mongodb jasonhills-mongodb requested review from papafe and removed request for a team July 1, 2025 15:50
@jasonhills-mongodb
Copy link
Author

To generate the SBOM, run evergreen/generate-sbom.sh. There shouldn't be any pre-requisites other than having the basic dotnet toolchain(s) available.

@papafe papafe removed their request for review July 3, 2025 16:16
@adelinowona adelinowona self-requested a review July 3, 2025 17:07
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