Skip to content

Commit 748367c

Browse files
GODRIVER-3599: Add task script to generate CycloneDX SBOM
Added a `task` and `etc` bash script to generate a build lifecycle CycloneDX SBOM using a pinned version of the `cyclonedx-gomod` tool. The SBOM includes the aggregate of modules required by packages in the mongo-go-driver library, excluding examples, tests and test packages. The task will run only when go.mod is newer than sbom.cdx.json. 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 static sbom.json file to Kondukto. TODOs: - Once the SBOM generation process has been approved, the GitHub Action in `mongodb-labs/drivers-github-tools` can be called with the updated SBOM file name. - Add libmongocrypt as an optional component via a merge once the libmongocrypt SBOM is updated with newer automation `task generate-sbom`
1 parent 6c97757 commit 748367c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.evergreen/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,14 @@ tasks:
647647
binary: bash
648648
args: [*task-runner, check-fmt, check-license, check-modules, lint]
649649

650+
- name: generate-sbom
651+
tags: ["ssdlc"]
652+
commands:
653+
- command: subprocess.exec
654+
params:
655+
binary: bash
656+
args: [*task-runner, generate-sbom]
657+
650658
- name: pull-request-helpers
651659
allowed_requesters: ["patch", "github_pr"]
652660
commands:

Taskfile.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ tasks:
8585

8686
update-notices: bash etc/generate_notices.pl > THIRD-PARTY-NOTICES
8787

88+
generate-sbom:
89+
desc: Generate a CycloneDX SBOM
90+
summary: |
91+
The cyclonedx-gomod 'mod' subcommand is used to generate a CycloneDX SBOM with GOWORK=off to exclude example/test code.
92+
The SBOM includes the aggregate of modules required by packages in the mongo-go-driver library, excluding examples, tests and test packages.
93+
Task will run only when go.mod is newer than sbom.cdx.json.
94+
TODO: Add libmongocrypt as an optional component via a merge once the libmongocrypt SBOM is updated with newer automation
95+
method: timestamp
96+
sources: [go.mod]
97+
generates: [sbom.cdx.json]
98+
cmd: |
99+
GOWORK=off go run github.com/CycloneDX/cyclonedx-gomod/cmd/[email protected] mod -type library -licenses -assert-licenses -output-version 1.5 -json -output sbom.cdx.json .
100+
88101
### Local testing tasks. ###
89102
test: go test ${BUILD_TAGS} -timeout {{.TEST_TIMEOUT}}s -p 1 ./...
90103

0 commit comments

Comments
 (0)