Skip to content

ci: add Grype CVE scanning workflow, clean up vulnerable deps #2

ci: add Grype CVE scanning workflow, clean up vulnerable deps

ci: add Grype CVE scanning workflow, clean up vulnerable deps #2

Workflow file for this run

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: Scan project
uses: anchore/scan-action@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7
id: scan
with:
path: .
fail-build: true
severity-cutoff: high
only-fixed: true
config: .grype.yaml
- name: Upload SARIF report
if: ${{ always() }}
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
- name: Generate table report
if: ${{ always() }}
run: |
export PATH="$(dirname $(find /opt/hostedtoolcache/grype -name grype -type f | head -1)):$PATH"
grype dir:. \
--config .grype.yaml \
--only-fixed \
--output table | tee grype-report.txt || true
- name: Upload scan reports
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: grype-scan
path: |
grype-report.txt
${{ steps.scan.outputs.json }}
retention-days: 30