Skip to content

Commit d5a1241

Browse files
authored
Merge pull request #4 from AstrumBot/ci/sbom-provenance-cosign
ci: add SBOM/provenance/cosign signing and hadolint/trivy scanning
2 parents 34e42ec + f4d7416 commit d5a1241

2 files changed

Lines changed: 54 additions & 3 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
permissions:
1111
contents: read
1212
packages: write
13+
id-token: write
1314

1415
env:
1516
IMAGE_NAME: astrum-agent-runtime
@@ -64,12 +65,15 @@ jobs:
6465
- name: Verify runtime
6566
run: docker run --rm "${{ steps.meta.outputs.image }}:verify" verify-runtime
6667

67-
- name: Push verified image
68+
- name: Push verified image with attestations
69+
id: push
6870
uses: docker/build-push-action@v6
6971
with:
7072
context: .
7173
file: ./Dockerfile
7274
push: true
75+
provenance: mode=max
76+
sbom: true
7377
tags: |
7478
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.tag }}
7579
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.latest }}
@@ -81,3 +85,14 @@ jobs:
8185
org.opencontainers.image.version=${{ steps.meta.outputs.tag }}
8286
cache-from: type=gha
8387
cache-to: type=gha,mode=max
88+
89+
- name: Install cosign
90+
uses: sigstore/cosign-installer@v3.8.1
91+
with:
92+
cosign-release: 'v2.4.3'
93+
94+
- name: Sign image with cosign
95+
env:
96+
COSIGN_YES: true
97+
run: |
98+
cosign sign "${{ steps.meta.outputs.image }}@${{ steps.push.outputs.digest }}"

.github/workflows/docker-verify.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,36 @@ on:
99

1010
permissions:
1111
contents: read
12+
security-events: write
1213

1314
env:
1415
IMAGE_NAME: astrum-agent-runtime
1516

1617
jobs:
17-
verify:
18-
name: Build and verify image
18+
lint:
19+
name: Lint Dockerfile
1920
runs-on: ubuntu-24.04
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Run hadolint
26+
uses: hadolint/hadolint-action@v3.1.0
27+
with:
28+
dockerfile: Dockerfile
29+
format: sarif
30+
output-file: hadolint-results.sarif
31+
no-fail: true
32+
33+
- name: Upload hadolint results to GitHub Security
34+
uses: github/codeql-action/upload-sarif@v3
35+
with:
36+
sarif_file: hadolint-results.sarif
37+
category: hadolint
2038

39+
scan:
40+
name: Build and scan image
41+
runs-on: ubuntu-24.04
2142
steps:
2243
- name: Checkout
2344
uses: actions/checkout@v4
@@ -37,3 +58,18 @@ jobs:
3758

3859
- name: Verify runtime
3960
run: docker run --rm "${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}" verify-runtime
61+
62+
- name: Run Trivy vulnerability scanner
63+
uses: aquasecurity/trivy-action@v0.36.0
64+
with:
65+
image-ref: ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}
66+
format: sarif
67+
output: trivy-results.sarif
68+
severity: HIGH,CRITICAL
69+
70+
- name: Upload Trivy results to GitHub Security
71+
if: always()
72+
uses: github/codeql-action/upload-sarif@v3
73+
with:
74+
sarif_file: trivy-results.sarif
75+
category: trivy

0 commit comments

Comments
 (0)