-
Notifications
You must be signed in to change notification settings - Fork 39
chore: Generate SSDLC report and SBOM on release #1365
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d45c800
example generation of ssdlc report and sbom
oarbusi cbf9c40
ssdlc report and sbom generation
oarbusi 8bdbafc
Revert "example generation of ssdlc report and sbom"
oarbusi 0bc22f8
implement action and commit generated files
oarbusi ee36793
reuse
oarbusi d494da8
testing changes
oarbusi 31410e1
env vars instead of input
oarbusi 7d3bde3
repo path
oarbusi 464b38f
debug
oarbusi 964b79d
author fix
oarbusi f16c561
remove debug
oarbusi a8dd72f
try using remote action
oarbusi d6c3338
Revert "testing changes"
oarbusi fcce05a
get published version when no version is provided in the action
oarbusi ed2a036
shell check
oarbusi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,7 +113,12 @@ for resource in ${resources}; do | |
| fi | ||
| command="aws cloudformation publish-type --type RESOURCE --arn ${type_arn} ${version_param}" | ||
| echo "${command}" | ||
| ${command} | ||
| publish_output=$(${command}) | ||
| echo "${publish_output}" | ||
|
|
||
| # Extract and store the published version from PublicTypeArn | ||
| published_version=$(echo "${publish_output}" | jq -r '.PublicTypeArn' | awk -F'/' '{print $NF}') | ||
| echo "$published_version" >published_version.txt | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to store it into a file so that it can be accessed in the next steps of Github action above to store it as a GITHUB_OUTPUT to be used in the next job |
||
|
|
||
| echo "Deleting role stack as it is not needeed anymore" | ||
| roleStack="mongodb-atlas-${resource//-/}-role-stack" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [ "$#" -ne 2 ]; then | ||
| echo "Usage: $0 <binary_path> <output_file>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| BINARY_PATH="$1" | ||
| OUTPUT_FILE="$2" | ||
|
|
||
| go version -m "$BINARY_PATH" | | ||
| awk '$1 == "dep" || $1 == "=>" { print "pkg:golang/" $2 "@" $3 }' | | ||
| LC_ALL=C sort >"$OUTPUT_FILE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
| : "${LINKER_FLAGS:=}" | ||
|
|
||
| if [ $# -ne 1 ]; then | ||
| echo "Usage: $0 <resource-name>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| RESOURCE="$1" | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| EXTRACT_PURL_SCRIPT="${SCRIPT_DIR}/extract-purls.sh" | ||
|
|
||
| if [ ! -x "$EXTRACT_PURL_SCRIPT" ]; then | ||
| echo "extract-purls.sh not found or not executable" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "==> Generating purls" | ||
|
|
||
| # Define output and temp files | ||
| OUT_DIR="cfn-resources/${RESOURCE}/compliance" | ||
| BIN_DIR="${OUT_DIR}/bin" | ||
| PURL_ALL="${OUT_DIR}/purls.txt" | ||
|
|
||
| # Build and extract for Linux | ||
| pushd "cfn-resources/${RESOURCE}/cmd" >/dev/null | ||
| GOOS=linux GOARCH=amd64 go build -ldflags "${LINKER_FLAGS}" -o "../compliance/bin" | ||
| popd >/dev/null | ||
| "$EXTRACT_PURL_SCRIPT" "${BIN_DIR}" "${PURL_ALL}" | ||
|
|
||
| # Clean up temp files | ||
| rm -f "${BIN_DIR}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| release_date=${DATE:-$(date -u '+%Y-%m-%d')} | ||
|
|
||
| if [ $# -ne 2 ]; then | ||
| echo "Usage: $0 <resource-name> <version>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| RESOURCE="$1" | ||
| VERSION="$2" | ||
|
|
||
| export DATE="${release_date}" | ||
|
|
||
| if [ "${AUGMENTED_REPORT:-false}" = "true" ]; then | ||
| target_dir="." | ||
| file_name="ssdlc-compliance-${RESOURCE}-${VERSION}-${DATE}.md" | ||
| SBOM_TEXT=" - See Augmented SBOM manifests (CycloneDX in JSON format): | ||
| - This file has been provided along with this report under the name 'linux_amd64_augmented_sbom_v${VERSION}.json' | ||
| - Please note that this file was generated on ${DATE} and may not reflect the latest security information of all third party dependencies." | ||
|
|
||
| else # If not augmented, generate the standard report | ||
| target_dir="cfn-resources/${RESOURCE}/compliance/v${VERSION}" | ||
| file_name="ssdlc-compliance-${RESOURCE}-${VERSION}.md" | ||
| SBOM_TEXT=" - See SBOM Lite manifests (CycloneDX in JSON format): | ||
| - https://github.com/mongodb/mongodbatlas-cloudformation-resources/cfn-resources/${RESOURCE}/compliance/v${VERSION}/sbom.json" | ||
| # Ensure terraform-provider-mongodbatlas version directory exists | ||
| mkdir -p "${target_dir}" | ||
| fi | ||
|
|
||
| export AUTHOR | ||
| export VERSION | ||
| export SBOM_TEXT | ||
|
|
||
| echo "Generating SSDLC report for CloudFormation MongoDB::Atlas::${RESOURCE} version ${VERSION}, author ${AUTHOR} and release date ${DATE}..." | ||
|
|
||
| envsubst <templates/ssdlc-compliance.template.md \ | ||
| >"${target_dir}/${file_name}" | ||
|
|
||
| echo "SSDLC compliance report ready. Files in ${target_dir}/:" | ||
| ls -l "${target_dir}/" | ||
|
|
||
| echo "Printing the generated report:" | ||
| cat "${target_dir}/${file_name}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [ $# -ne 2 ]; then | ||
| echo "Usage: $0 <resource-name> <version>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| RESOURCE="$1" | ||
| VERSION="$2" | ||
| COMPLIANCE_DIR="cfn-resources/${RESOURCE}/compliance" | ||
|
|
||
| if [ ! -d "$COMPLIANCE_DIR" ]; then | ||
| echo "Compliance directory not found: $COMPLIANCE_DIR" | ||
| exit 1 | ||
| fi | ||
|
|
||
| PURL_FILE="${COMPLIANCE_DIR}/purls.txt" | ||
| SBOM_FILE="${COMPLIANCE_DIR}/v${VERSION}/sbom.json" | ||
|
|
||
| # Ensure the output directory exists | ||
| mkdir -p "$(dirname "$SBOM_FILE")" | ||
|
|
||
| echo "Generating SBOM for resource: $RESOURCE..." | ||
| docker run --rm \ | ||
| -v "$PWD:/pwd" \ | ||
| "$SILKBOMB_IMG" \ | ||
| update \ | ||
| --purls "/pwd/${PURL_FILE}" \ | ||
| --sbom-out "/pwd/${SBOM_FILE}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [ $# -ne 2 ]; then | ||
| echo "Usage: $0 <resource-name> <version>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| RESOURCE="$1" | ||
| echo "Uploading SBOMs for resource: $RESOURCE..." | ||
| docker run --rm \ | ||
| -v "$PWD:/pwd" \ | ||
| -e KONDUKTO_TOKEN \ | ||
| "$SILKBOMB_IMG" \ | ||
| upload \ | ||
| --sbom-in "/pwd/cfn-resources/${RESOURCE}/compliance/v${VERSION}/sbom.json" \ | ||
| --repo "$KONDUKTO_REPO" \ | ||
| --branch "$KONDUKTO_BRANCH_PREFIX-${RESOURCE}-linux-arm64" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| SSDLC Compliance Report: CloudFormation MongoDB::Atlas::${RESOURCE} ${VERSION} | ||
| ================================================================= | ||
|
|
||
| - Release Creator: ${AUTHOR} | ||
| - Created On: ${DATE} | ||
|
|
||
| Overview: | ||
|
|
||
| - **Product and Release Name** | ||
| - CloudFormation MongoDB::Atlas::${RESOURCE} ${VERSION}, ${DATE}. | ||
|
|
||
| - **Process Document** | ||
| - https://www.mongodb.com/blog/post/how-mongodb-protects-against-supply-chain-vulnerabilities | ||
|
|
||
| - **Tool used to track third party vulnerabilities** | ||
| - [Kondukto](https://arcticglow.kondukto.io/) | ||
|
|
||
| - **Dependency Information** | ||
| ${SBOM_TEXT} | ||
|
|
||
| - **Security Testing Report** | ||
| - Available as needed from Cloud Security. | ||
|
|
||
| - **Security Assessment Report** | ||
| - Available as needed from Cloud Security. | ||
|
|
||
| Assumptions and attestations: | ||
|
|
||
| - Internal processes are used to ensure CVEs are identified and mitigated within SLAs. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
see docs to understand why this is done