Skip to content

Commit c6609e9

Browse files
authored
CLOUDP-315270: Generate SSDLC report with augmented SBOM on-demand (#3916)
1 parent d3dd97f commit c6609e9

File tree

4 files changed

+124
-10
lines changed

4 files changed

+124
-10
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Augment SBOM
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_version:
7+
description: "Release version (e.g. 1.42.2)"
8+
required: true
9+
type: string
10+
11+
permissions:
12+
id-token: write
13+
contents: read
14+
15+
jobs:
16+
augment-sbom:
17+
runs-on: ubuntu-latest
18+
19+
env:
20+
KONDUKTO_TOKEN: ${{ secrets.KONDUKTO_TOKEN }}
21+
KONDUKTO_REPO: ${{ vars.KONDUKTO_REPO }}
22+
KONDUKTO_BRANCH_PREFIX: ${{ vars.KONDUKTO_BRANCH_PREFIX }}
23+
SILKBOMB_IMG: ${{ vars.SILKBOMB_IMG }}
24+
25+
steps:
26+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
27+
with:
28+
config: ${{ vars.PERMISSIONS_CONFIG }}
29+
30+
- name: Checkout repo
31+
uses: actions/checkout@v4
32+
33+
- uses: actions/setup-go@v5
34+
with:
35+
go-version-file: 'go.mod'
36+
37+
- name: Download Linux ARM64 binary
38+
run: |
39+
curl -L "https://github.com/mongodb/mongodb-atlas-cli/releases/download/atlascli%2Fv${{ inputs.release_version }}/mongodb-atlas-cli_${{ inputs.release_version }}_linux_arm64.tar.gz" \
40+
-o release.tar.gz
41+
42+
- name: Extract binary
43+
run: |
44+
tar -xzf release.tar.gz
45+
46+
- name: Generate PURLs from binary
47+
run: |
48+
go version -m ./mongodb-atlas-cli_${{ inputs.release_version }}_linux_arm64/bin/atlas | \
49+
awk '$1 == "dep" || $1 == "=>" { print "pkg:golang/" $2 "@" $3 }' | \
50+
LC_ALL=C sort > purls.txt
51+
cat purls.txt
52+
53+
- name: Generate SBOM with Silkbomb
54+
run: |
55+
docker run \
56+
--pull=always \
57+
--platform="linux/amd64" \
58+
--rm \
59+
-v "${PWD}:/pwd" \
60+
"${SILKBOMB_IMG}" \
61+
update \
62+
--purls "/pwd/purls.txt" \
63+
--sbom-out "/pwd/sbom_lite.json"
64+
cat "sbom_lite.json"
65+
66+
- name: Get current date
67+
id: date
68+
run: |
69+
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
70+
71+
- name: Augment SBOM with Kondukto
72+
run: |
73+
docker run \
74+
--pull=always \
75+
--platform="linux/amd64" \
76+
--rm \
77+
-v "${PWD}:/pwd" \
78+
-e "KONDUKTO_TOKEN=${KONDUKTO_TOKEN}" \
79+
"${SILKBOMB_IMG}" \
80+
augment \
81+
--sbom-in "/pwd/sbom_lite.json" \
82+
--repo "${KONDUKTO_REPO}" \
83+
--branch "${KONDUKTO_BRANCH_PREFIX}-linux-arm64" \
84+
--sbom-out "/pwd/linux-amd64-augmented-sbom-v${{ inputs.release_version }}-${{ env.date }}.json"
85+
86+
- name: Generate SSDLC report
87+
env:
88+
AUTHOR: ${{ github.actor }}
89+
VERSION: ${{ inputs.release_version }}
90+
AUGMENTED_REPORT: "true"
91+
run: ./build/package/gen-ssdlc-report.sh
92+
93+
- name: Upload augmented SBOM as artifact
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: augmented_sbom_and_ssdlc_report
97+
path: |
98+
linux-amd64-augmented-sbom-v${{ inputs.release_version }}-${{ env.date }}.json
99+
ssdlc-compliance-${{ inputs.release_version }}-${{ env.date }}.md
100+
if-no-files-found: error

.github/workflows/update-ssdlc-report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
env:
3939
AUTHOR: ${{ steps.extract.outputs.author }}
4040
VERSION: ${{ steps.extract.outputs.version }}
41+
AUGMENTED_REPORT: "false"
4142
run: ./build/package/gen-ssdlc-report.sh
4243
- name: set Apix Bot token
4344
id: app-token

build/package/gen-ssdlc-report.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,33 @@ if [ -z "${VERSION:-}" ]; then
2828
VERSION=$(git tag --list 'atlascli/v*' --sort=-taggerdate | head -1 | cut -d 'v' -f 2)
2929
fi
3030

31+
if [ "${AUGMENTED_REPORT}" = "true" ]; then
32+
target_dir="."
33+
file_name="ssdlc-compliance-${VERSION}-${DATE}.md"
34+
SBOM_TEXT=" - See Augmented SBOM manifests (CycloneDX in JSON format):
35+
- This file has been provided along with this report under the name 'linux_amd64_augmented_sbom_v${VERSION}.json'
36+
- Please note that this file was generated on ${DATE} and may not reflect the latest security information of all third party dependencies."
37+
38+
else # If not augmented, generate the standard report
39+
target_dir="compliance/v${VERSION}"
40+
file_name="ssdlc-compliance-${VERSION}.md"
41+
SBOM_TEXT=" - See SBOM Lite manifests (CycloneDX in JSON format):
42+
- https://github.com/mongodb/mongodb-atlas-cli/releases/download/atlascli%2Fv${VERSION}/sbom.json"
43+
# Ensure AtlasCLI version directory exists
44+
mkdir -p "${target_dir}"
45+
fi
46+
3147
export AUTHOR
3248
export VERSION
49+
export SBOM_TEXT
3350

3451
echo "Generating SSDLC checklist for AtlasCLI version ${VERSION}, author ${AUTHOR} and release date ${DATE}..."
3552

36-
# Ensure AtlasCLI version directory exists
37-
mkdir -p "compliance/v${VERSION}"
38-
3953
envsubst < docs/releases/ssdlc-compliance.template.md \
40-
> "compliance/v${VERSION}/ssdlc-compliance-${VERSION}.md"
54+
> "${target_dir}/${file_name}"
4155

42-
echo "SDLC checklist ready. Files in compliance/v${VERSION}/:"
43-
ls -l "compliance/v${VERSION}/"
56+
echo "SDLC checklist ready. Files in ${target_dir}/:"
57+
ls -l "${target_dir}/"
4458

4559
echo "Printing the generated report:"
46-
cat "compliance/v${VERSION}/ssdlc-compliance-${VERSION}.md"
60+
cat "${target_dir}/${file_name}"

docs/releases/ssdlc-compliance.template.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Overview:
1616
- [Kondukto](https://arcticglow.kondukto.io/)
1717

1818
- **Dependency Information**
19-
- See SBOM Lite manifests (CycloneDX in JSON format):
20-
- https://github.com/mongodb/mongodb-atlas-cli/releases/download/atlascli%2Fv${VERSION}/sbom.json
19+
${SBOM_TEXT}
2120

2221
- **Security Testing Report**
2322
- Available as needed from Cloud Security.
@@ -27,4 +26,4 @@ Overview:
2726

2827
Assumptions and attestations:
2928

30-
- Internal processes are used to ensure CVEs are identified and mitigated within SLAs.
29+
- Internal processes are used to ensure CVEs are identified and mitigated within SLAs.

0 commit comments

Comments
 (0)