Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add reusable workflow for checking for vulnerabilities #161

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions workflows/check-vulnerabilities/check-vulnerabilities.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check Vulnerabilities

on:
workflow_call:
inputs:
image:
description: Image to check
required: true
type: string
runs_on:
default: "[ubuntu-latest]"
description: Runner specification
required: false
type: string

jobs:
check-vulnerabilities:
runs-on: "${{ inputs.runs_on}}"
steps:
- name: Install Cosign
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v1.13.1'
- name: Check install!
run: cosign version
- name: Verify container
run: |
COSIGN_EXPERIMENTAL=1 cosign verify ${{ inputs.image }}
- name: Get SBOM
id: spdx
run: |
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
- name: Scan image
uses: anchore/scan-action@v3
with:
sbom: ${{ steps.spdx.outputs.spdx }}
fail-build: true
severity-cutoff: critical