Skip to content

Conversation

@jasonhills-mongodb
Copy link

@jasonhills-mongodb jasonhills-mongodb commented Dec 4, 2025

Objective

  • Obviate manual SBOM component management via automated generation of a CycloneDX SBOM that includes all required and optional runtime components.
  • Add Endor Labs SCA scanning of PRs (non-blocking)

Changes

  • Add a GitHub Action workflow (.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 for master or releases/v* branches, enriches SBOM with metadata, opens a PR for updated SBOM
    • (pull_request) performs an Endor Labs SCA scan for PRs (non-blocking) and, if potential vulnerabilities were found, add a comment to PR
    • (workflow_dispatch) workflow can also be triggered manually
  • Remove the etc/purls.txt file
    • update all references to it in scripts and documentation
    • existing scripts and processes using Silkbomb for the augmented SBOM are unchanged, except that the sbom.json file is used as input instead of etc/purls.txt
  • Change the location of the SBOM file from etc/cyclonedx.sbom.json to sbom.json for consistency with other MDB repos
  • Add etc/sbom folder with:
    • Python scripts for SBOM generation using Endor Labs scan results and pre-defined enrichment data
      • Dependency group added to pyproject.toml
    • SBOM enrichment data in etc/sbom/metadata.cdx.json
  • Updated SBOM-related documentation in etc/releasing.md

Testing

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

@jasonhills-mongodb jasonhills-mongodb requested a review from a team as a code owner December 4, 2025 18:46
@kevinAlbs kevinAlbs requested a review from eramongodb December 4, 2025 18:49
}
}
```
The `metadata.component.bom-ref` field does not need to change, but if you do change it be sure to also update the assocaited `dependencies[].ref` field. Note that the github PURL references the release tag (`rX.Y.Z`).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The `metadata.component.bom-ref` field does not need to change, but if you do change it be sure to also update the assocaited `dependencies[].ref` field. Note that the github PURL references the release tag (`rX.Y.Z`).
The `metadata.component.bom-ref` field does not need to change, but if you do change it be sure to also update the associated `dependencies[].ref` field. Note that the github PURL references the release tag (`rX.Y.Z`).

Typo.

Copy link
Contributor

@eramongodb eramongodb Dec 4, 2025

Choose a reason for hiding this comment

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

Given these scripts are intended for use by GitHub Actions, can they be relocated into a new .github/scripts directory instead?

CXX_STANDARD: 17
working-directory: ${{env.BUILD}}
run: |
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_STANDARD=${{env.CXX_STANDARD}} -DENABLE_TESTS=ON
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_STANDARD=${{env.CXX_STANDARD}} -DENABLE_TESTS=ON
cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DCMAKE_CXX_STANDARD="${{env.CXX_STANDARD}}" -DENABLE_TESTS=OFF -B . -S ..

Recommended CMake command syntax + guard against variable expansion.

working-directory: ${{env.BUILD}}
run: |
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_STANDARD=${{env.CXX_STANDARD}} -DENABLE_TESTS=ON
rm .gitignore # prevent exclusion of build/_deps from endorctl scan
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
rm .gitignore # prevent exclusion of build/_deps from endorctl scan
echo "!_deps" >>.gitignore # prevent exclusion of build/_deps from endorctl scan

Consider excluding the _deps directory specifically instead.

env:
ENDOR_SCAN_EMBEDDINGS: true
with:
additional_args: '--languages=c --include-path="build/_deps/**"'
Copy link
Contributor

@eramongodb eramongodb Dec 4, 2025

Choose a reason for hiding this comment

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

Should the --languages flag use something like c,cpp instead? Catch2 (only used for tests) is a C++ library.

--repo mongodb/mongo-cxx-driver
--branch "${branch_name:?}"
--sbom-in /pwd/etc/cyclonedx.sbom.json
--sbom-in /pwd/sbom.json
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not under etc as before? Is this required by Endor Labs?

"type": "distribution"
}
],
"scope": "required"
Copy link
Collaborator

Choose a reason for hiding this comment

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

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-build

However, 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:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

if: env.PR_SCAN == 'false'
id: sbom_diff
run: |
# diff the temp SBOM files, save output to variable, supress exit code
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# diff the temp SBOM files, save output to variable, supress exit code
# diff the temp SBOM files, save output to variable, suppress exit code

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