-
Notifications
You must be signed in to change notification settings - Fork 548
CXX-3309 Automate SBOM generation and Endor Labs scanning #1528
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
base: master
Are you sure you want to change the base?
CXX-3309 Automate SBOM generation and Endor Labs scanning #1528
Conversation
| } | ||
| } | ||
| ``` | ||
| 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`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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/**"' |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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-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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # diff the temp SBOM files, save output to variable, supress exit code | |
| # diff the temp SBOM files, save output to variable, suppress exit code |
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.