Skip to content

Commit cb67e35

Browse files
ci: stamp SBOM creator and sign build provenance attestations
Same sbom.yml v2 already merged and verified in gen-fraud-graph#29: SPDX/CycloneDX creator stamped as Santander Group and both SBOM files signed with actions/attest-build-provenance (Sigstore), verifiable via 'gh attestation verify'. Release assets uploaded after stamping.
1 parent 3478c19 commit cb67e35

1 file changed

Lines changed: 44 additions & 10 deletions

File tree

.github/workflows/sbom.yml

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# Generates a Software Bill of Materials for each published release and
2-
# attaches it as release assets in both standard formats (SPDX + CycloneDX).
1+
# Generates a Software Bill of Materials for each published release, stamps
2+
# Santander Group as document creator, signs a build provenance attestation
3+
# (Sigstore, verifiable with `gh attestation verify`) and attaches both
4+
# standard formats (SPDX + CycloneDX) as release assets.
35
# Manual runs (workflow_dispatch) upload the SBOMs as workflow artifacts only.
46
name: SBOM
57

@@ -10,12 +12,17 @@ on:
1012

1113
permissions: {}
1214

15+
env:
16+
BASE: ${{ github.event.repository.name }}-${{ github.ref_name }}
17+
1318
jobs:
1419
sbom:
15-
name: Generate and attach SBOM
20+
name: Generate, attest and attach SBOM
1621
runs-on: ubuntu-latest
1722
permissions:
18-
contents: write # upload release assets
23+
contents: write # upload release assets
24+
id-token: write # sign the attestation (Sigstore)
25+
attestations: write # store the attestation
1926
steps:
2027
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2128
with:
@@ -24,13 +31,40 @@ jobs:
2431
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
2532
with:
2633
format: spdx-json
27-
output-file: ${{ github.event.repository.name }}-${{ github.ref_name }}.spdx.json
28-
artifact-name: ${{ github.event.repository.name }}-${{ github.ref_name }}.spdx.json
29-
upload-release-assets: ${{ github.event_name == 'release' }}
34+
output-file: ${{ env.BASE }}.spdx.json
35+
upload-artifact: false
36+
upload-release-assets: false
3037
- name: Generate CycloneDX SBOM
3138
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
3239
with:
3340
format: cyclonedx-json
34-
output-file: ${{ github.event.repository.name }}-${{ github.ref_name }}.cdx.json
35-
artifact-name: ${{ github.event.repository.name }}-${{ github.ref_name }}.cdx.json
36-
upload-release-assets: ${{ github.event_name == 'release' }}
41+
output-file: ${{ env.BASE }}.cdx.json
42+
upload-artifact: false
43+
upload-release-assets: false
44+
- name: Stamp Santander Group as document creator
45+
run: |
46+
jq '.creationInfo.creators += ["Organization: Santander Group"]' \
47+
"$BASE.spdx.json" > tmp.json && mv tmp.json "$BASE.spdx.json"
48+
jq '.metadata.authors = [{"name": "Open Source Santander AI", "email": "opensource@gruposantander.com"}]' \
49+
"$BASE.cdx.json" > tmp.json && mv tmp.json "$BASE.cdx.json"
50+
- name: Attest SBOM build provenance
51+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
52+
with:
53+
subject-path: |
54+
${{ env.BASE }}.spdx.json
55+
${{ env.BASE }}.cdx.json
56+
- name: Upload SBOMs as workflow artifacts (manual runs)
57+
if: github.event_name == 'workflow_dispatch'
58+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
59+
with:
60+
name: sboms
61+
path: |
62+
${{ env.BASE }}.spdx.json
63+
${{ env.BASE }}.cdx.json
64+
- name: Attach SBOMs to the release
65+
if: github.event_name == 'release'
66+
env:
67+
GH_TOKEN: ${{ github.token }}
68+
run: |
69+
gh release upload "${{ github.event.release.tag_name }}" \
70+
"$BASE.spdx.json" "$BASE.cdx.json" --clobber

0 commit comments

Comments
 (0)