Skip to content

Commit 3487489

Browse files
committed
Add SBOM generation workflow
1 parent 4e73b1e commit 3487489

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

.github/workflows/sbom.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: SBOM
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: "24 3 * * 3"
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
source-sbom:
16+
name: Source SBOM
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Generate repository source SBOM
23+
uses: anchore/sbom-action@v0.20.9
24+
with:
25+
path: .
26+
format: spdx-json
27+
artifact-name: repo-source.spdx.json
28+
syft-version: v1.41.2
29+
upload-release-assets: false
30+
31+
image-sbom:
32+
name: Image SBOM (${{ matrix.name }})
33+
runs-on: ubuntu-latest
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
include:
38+
- name: backend
39+
context: ./backend
40+
dockerfile: ./backend/Dockerfile
41+
target: runner
42+
image: cv-kit-backend:sbom
43+
artifact: backend-runner.spdx.json
44+
- name: frontend
45+
context: ./frontend
46+
dockerfile: ./frontend/Dockerfile
47+
target: runner
48+
image: cv-kit-frontend:sbom
49+
artifact: frontend-runner.spdx.json
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
54+
- name: Build runner image
55+
run: >
56+
docker build
57+
--file ${{ matrix.dockerfile }}
58+
--target ${{ matrix.target }}
59+
--tag ${{ matrix.image }}
60+
${{ matrix.context }}
61+
62+
- name: Generate image SBOM
63+
uses: anchore/sbom-action@v0.20.9
64+
with:
65+
image: ${{ matrix.image }}
66+
format: spdx-json
67+
artifact-name: ${{ matrix.artifact }}
68+
syft-version: v1.41.2
69+
upload-release-assets: false

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ A separate GitHub workflow generates license-report artifacts for the root works
129129

130130
The dependency-review config also keeps a conservative allowlist of licenses already present in the current dependency tree, so tightening policy does not start by breaking routine updates.
131131

132+
An SBOM workflow also publishes SPDX artifacts for the repository source plus the frontend and backend runner images.
133+
132134
## Releases
133135

134136
- Release Drafter keeps a draft release updated from merged pull requests on `main` and can auto-label incoming pull requests by path.

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The repository also uses automated scanning to help catch common security issues
3333
- CodeQL code scanning on GitHub for JavaScript/TypeScript, Python, and workflow files
3434
- GitHub dependency review on pull requests for newly introduced vulnerable dependency changes
3535
- GitHub license-report artifacts for npm and Python dependency inventories
36+
- GitHub SBOM artifacts for the repository source and runner images
3637

3738
Dependency review is also configured with an allowlist that matches the current dependency tree, so changes that introduce new license types are surfaced deliberately instead of silently drifting in.
3839

future-reference-feature.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The template-grade layer is the part worth reusing almost anywhere:
2323
- release automation
2424
- security scanning
2525
- license reporting
26+
- SBOM generation
2627
- repo governance
2728
- image/build verification
2829
- smoke testing after release
@@ -219,13 +220,15 @@ Files:
219220
- `.github/workflows/template-ci.yml`
220221
- `.github/workflows/codeql.yml`
221222
- `.github/workflows/license-report.yml`
223+
- `.github/workflows/sbom.yml`
222224
- `SECURITY.md`
223225

224226
What it covers here:
225227

226228
- tracked git content scanned with `gitleaks`
227229
- CodeQL scanning for JavaScript/TypeScript, Python, and workflow files
228230
- generated license inventories for npm and Python dependencies
231+
- SBOM artifacts for source and runner images
229232
- private disclosure guidance
230233

231234
Why it matters:
@@ -239,6 +242,7 @@ Generic takeaway:
239242
- secret scanning is a near-default for public repos
240243
- CodeQL or equivalent static analysis is a strong baseline for maintained starters
241244
- non-blocking license reporting is a good bridge before stricter allowlist enforcement
245+
- SBOM generation is a strong supply-chain visibility layer for deployable templates
242246

243247
### 9. Workflow Linting
244248

template-playbook.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ If a template only has code and no repo workflow, it is usually still a prototyp
4141
- workflow lint
4242
- secret scan
4343
- dependency review on pull requests
44+
- SBOM generation for source or publishable artifacts when relevant
4445
- app verification
4546
- cross-platform check if relevant
4647
- packaging or Docker build check if relevant
@@ -82,6 +83,7 @@ soon.md
8283
.github/workflows/release-drafter.yml
8384
.github/workflows/release.yml
8485
.github/workflows/release-smoke.yml
86+
.github/workflows/sbom.yml
8587
.github/workflows/sync-labels.yml
8688
.github/workflows/codeql.yml
8789
scripts/dev.mjs
@@ -156,6 +158,7 @@ If you want the version that scales better for open source or long-term reuse, a
156158
- secrets should be scanned
157159
- dependency changes should be reviewed on pull requests
158160
- dependency licenses should be reportable without manual digging
161+
- SBOMs should be generated for source trees or release artifacts when supply-chain visibility matters
159162
- release steps should be automated
160163
- docs should explain maintainer flow, not just user setup
161164

0 commit comments

Comments
 (0)