CXX-3309 Automate SBOM generation and Endor Labs scanning#1528
CXX-3309 Automate SBOM generation and Endor Labs scanning#1528jasonhills-mongodb wants to merge 3 commits into
Conversation
| env: | ||
| ENDOR_SCAN_EMBEDDINGS: true | ||
| with: | ||
| additional_args: '--languages=c --include-path="build/_deps/**"' |
There was a problem hiding this comment.
Should the --languages flag use something like c,cpp instead? Catch2 (only used for tests) is a C++ library.
There was a problem hiding this comment.
In endorctl, you indicate "c" to enable both C and C++
| --repo mongodb/mongo-cxx-driver | ||
| --branch "${branch_name:?}" | ||
| --sbom-in /pwd/etc/cyclonedx.sbom.json | ||
| --sbom-in /pwd/sbom.json |
There was a problem hiding this comment.
Why not under etc as before? Is this required by Endor Labs?
| "type": "distribution" | ||
| } | ||
| ], | ||
| "scope": "required" |
There was a problem hiding this comment.
Should zlib be marked "optional"? zlib is a default-enabled but optional component. The C driver may be built without zlib. And the C++ driver can be built using a custom C driver install:
# Install C driver without zlib:
cd "$HOME/code/mongo-c-driver"
cmake -DENABLE_ZLIB=OFF -S. -Bcmake-build -DCMAKE_INSTALL_PREFIX="$HOME/mongo-c-driver-nozlib"
cmake --build cmake-build --target install
# Build C++ driver with custom C driver:
cd "$HOME/code/mongo-cxx-driver"
cmake -DCMAKE_PREFIX_PATH="$HOME/mongo-c-driver-nozlib" -S. -Bcmake-buildHowever, I expect that is a rare scenario. I expect most users would have zlib enabled.
| Run a patch build which executes the `sbom` task and download the "Augmented SBOM (Updated)" file as `etc/augmented.sbom.json`. Evergreen CLI may be used to schedule only the `sbom` task: | ||
| Ensure the container engine (e.g. `podman` or `docker`) is authenticated with the DevProd-provided Amazon ECR instance. | ||
|
|
||
| Run a patch build which executes the `sbom` task and downloads the "Augmented SBOM (Updated)" file as `etc/augmented.sbom.json`. Evergreen CLI may be used to schedule only the `sbom` task: |
There was a problem hiding this comment.
| Run a patch build which executes the `sbom` task and downloads the "Augmented SBOM (Updated)" file as `etc/augmented.sbom.json`. Evergreen CLI may be used to schedule only the `sbom` task: | |
| Run a patch build which executes the `sbom` task and download the "Augmented SBOM (Updated)" file as `etc/augmented.sbom.json`. Evergreen CLI may be used to schedule only the `sbom` task: |
Tweak wording since the person doing the release is expected to download and commit the Augmented SBOM.
| - **Date Detected:** YYYY-MM-DD | ||
| - **Severity:** Low, Medium, High, or Critical | ||
| - **Detector:** Silk or Snyk | ||
| - **Detector:** Endor Labs or Dependency-Track |
There was a problem hiding this comment.
If Silk is no longer used, suggest similarly updating ssdlc_compliance_report.md.
Aside: ssdlc_compliance_report.md was a requirement of DRIVERS-2898 and refers to Proposal: SSDLC Compliance Verification Flow. I think that policy is no longer required in favor of Secure SDLC Best Practices. So maybe ssdlc_compliance_report.md is no longer strictly needed.
- Split monolithic endor_scan_and_generate_sbom.yml into separate endor_monitoring_sbom.yml (push/dispatch) and endor_pr_scan.yml (pull_request) workflows - Extract shared clone+CMake configure steps into composite action .github/actions/clone-and-configure - Move SBOM scripts from etc/sbom/ to .github/scripts/sbom/ - Sync config.py, generate_sbom.py, endorctl_utils.py from mongodb/mongo, removing mongo-specific components and applying branch-context bug fix - Replace Kondukto token auth with AWS credential pass-through in Evergreen sbom.sh and config generator - Update CODEOWNERS for new workflow and action paths
Objective
Changes
.github/workflows/endor_scan_and_generate_sbom.yml) triggered by edits to cmake files that:push) performs an Endor Labs SCA scan and exports an SBOM formasterorreleases/v*branches, enriches SBOM with metadata, opens a PR for updated SBOMpull_request) performs an Endor Labs SCA scan for PRs (non-blocking) and, if potential vulnerabilities were found, add a comment to PRworkflow_dispatch) workflow can also be triggered manuallyetc/purls.txtfilesbom.jsonfile is used as input instead ofetc/purls.txtetc/cyclonedx.sbom.jsontosbom.jsonfor consistency with other MDB reposetc/sbomfolder with:pyproject.tomletc/sbom/metadata.cdx.jsonetc/releasing.mdTesting
The workflow was thoroughly tested on a fork, including scenarios with missing or malformed files.
Permissions
The workflow requires the repository configuration to allow it to request write access and open PRs.
Miscellaneous
master, it may be cherry picked to the relevant release branches.