Skip to content

Commit c63866e

Browse files
committed
add reusable workflow for checking for vulnerabilities
Closes #160 Signed-off-by: Jeroen Knoops <[email protected]>
1 parent 448f687 commit c63866e

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Check Vulnerabilities
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image:
7+
description: Image to check
8+
required: true
9+
type: string
10+
runs_on:
11+
default: "[ubuntu-latest]"
12+
description: Runner specification
13+
required: false
14+
type: string
15+
16+
jobs:
17+
check-vulnerabilities:
18+
runs-on: "${{ inputs.runs_on}}"
19+
steps:
20+
- name: Install Cosign
21+
uses: sigstore/cosign-installer@main
22+
with:
23+
cosign-release: 'v1.13.1'
24+
- name: Check install!
25+
run: cosign version
26+
- name: Verify container
27+
run: |
28+
COSIGN_EXPERIMENTAL=1 cosign verify ${{ inputs.image }}
29+
- name: Get SBOM
30+
id: spdx
31+
run: |
32+
echo "spdx=$(COSIGN_EXPERIMENTAL=1 cosign verify-attestation --type spdx ${{ inputs.image }} | jq '.payload |= @base64d | .payload | fromjson | select( .predicateType=="https://spdx.dev/Document" ) | .predicate.Data | fromjson | .') >> $GITHUB_OUTPUT
33+
- name: Scan image
34+
uses: anchore/scan-action@v3
35+
with:
36+
sbom: ${{ steps.spdx.outputs.spdx }}
37+
fail-build: true
38+
severity-cutoff: critical

0 commit comments

Comments
 (0)