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
# See the License for the specific language governing permissions and
# limitations under the License.


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

Stray whitespace?

}
}
```
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?

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.

2 participants