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