Skip to content
Open
Show file tree
Hide file tree
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
53 changes: 53 additions & 0 deletions .github/workflows/cve.yml
Comment thread
coopernetes marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CVE Scanning

permissions:
contents: read

on:
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '0 6 * * 1' # Weekly Monday 6am UTC

jobs:
grype:
name: Grype dependency scan
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6

- name: Install Grype
id: grype
uses: anchore/scan-action/download-grype@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7
with:
cache-db: true

- name: Scan (table)
run: |
${{ steps.grype.outputs.cmd }} dir:. \
--config .grype.yaml \
--output template

- name: Scan (SARIF)
if: ${{ always() }}
run: |
${{ steps.grype.outputs.cmd }} dir:. \
--config .grype.yaml \
--output sarif --file grype-results.sarif || true

- name: Upload SARIF report
if: ${{ always() }}
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
with:
sarif_file: grype-results.sarif
6 changes: 6 additions & 0 deletions .grype-report.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{printf "%-8s | %-19s | %-50s | %-15s | %s" "SEVERITY" "ADVISORY" "PACKAGE" "FIXED IN" "SOURCE"}}
{{printf "%-8s | %-19s | %-50s | %-15s | %s" "--------" "-------------------" "--------------------------------------------------" "---------------" "------"}}
{{- range .Matches -}}
{{- $loc := "" -}}{{- range .Artifact.Locations -}}{{- $loc = .RealPath -}}{{- end}}
{{printf "%-8s | %-19s | %-50s | %-15s | %s" .Vulnerability.Severity .Vulnerability.ID (printf "%s@%s" .Artifact.Name .Artifact.Version) (join ", " .Vulnerability.Fix.Versions) $loc}}
{{- end}}
11 changes: 11 additions & 0 deletions .grype.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
fail-on-severity: high
sort-by: severity
output-template-file: .grype-report.tmpl

ignore:
- fix-state: 'wont-fix'
- fix-state: 'not-fixed'

# Comment out to include scanning experimental license inventory
exclude:
- './experimental/**'
Loading
Loading