Skip to content

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

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

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

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: Install Grype
id: grype
uses: anchore/scan-action/download-grype@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7
with:
cache-db: true
- name: Scan package-lock.json
run: |
${{ steps.grype.outputs.cmd }} file:package-lock.json \
--config .grype.yaml \
--only-fixed \
--fail-on high \
--output sarif --file grype-results.sarif \
--output table | tee grype-report.txt
- name: Upload SARIF report
if: ${{ always() }}
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
with:
sarif_file: grype-results.sarif
- name: Upload scan reports
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: grype-scan
path: |
grype-report.txt
grype-results.sarif
retention-days: 30