Skip to content

Commit f326891

Browse files
committed
ci: add Grype CVE scanning and fix high/critical CVEs
Adds a Grype CVE scanning workflow that runs on push, PR, and weekly schedule. Scans package-lock.json (not the working directory) to avoid false positives from CI runner tooling. Uploads SARIF to the Security tab and a table report as an artifact. Fails on high severity with a fix available. Dependency bumps (all same-major, no breaking changes): - concurrently 9.2.1 → 9.2.3 (shell-quote critical: GHSA-w7jw-789q-3m8p) - vitest 3.2.4 → 3.2.6 (critical: arbitrary file read) - @vitest/coverage-v8 3.2.4 → 3.2.6 (depends on vitest) - vite 7.3.1 → 7.3.5 (high: GHSA-fx2h-pf6j-xcff) - cypress 15.9.0 → 15.17.0 (tmp, qs, uuid transitives) - react-router-dom 6.30.3 → 6.30.4 (moderate: GHSA-2j2x-hqr9-3h42) Overrides for transitive deps whose parents haven't released fixes: - form-data 4.0.5 → 4.0.6 (high: GHSA-hmw2-7cc7-3qxx) - tmp 0.2.5 → 0.2.6 (high: path traversal) Reduces total vulnerabilities from 19 to 7 (0 critical, 0 high).
1 parent fc23d58 commit f326891

5 files changed

Lines changed: 670 additions & 721 deletions

File tree

.github/workflows/cve.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CVE Scanning
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: ['main']
9+
pull_request:
10+
branches: ['main']
11+
schedule:
12+
- cron: '0 6 * * 1' # Weekly Monday 6am UTC
13+
14+
jobs:
15+
grype:
16+
name: Grype dependency scan
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
security-events: write
21+
steps:
22+
- name: Harden Runner
23+
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
24+
with:
25+
egress-policy: audit
26+
27+
- name: Checkout
28+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
29+
30+
- name: Install Grype
31+
id: grype
32+
uses: anchore/scan-action/download-grype@e1165082ffb1fe366ebaf02d8526e7c4989ea9d2 # v7
33+
with:
34+
cache-db: true
35+
36+
- name: Scan (table)
37+
run: |
38+
${{ steps.grype.outputs.cmd }} dir:. \
39+
--config .grype.yaml \
40+
--output template
41+
42+
- name: Scan (SARIF)
43+
if: ${{ always() }}
44+
run: |
45+
${{ steps.grype.outputs.cmd }} dir:. \
46+
--config .grype.yaml \
47+
--output sarif --file grype-results.sarif || true
48+
49+
- name: Upload SARIF report
50+
if: ${{ always() }}
51+
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
52+
with:
53+
sarif_file: grype-results.sarif

.grype-report.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{printf "%-8s | %-19s | %-50s | %-15s | %s" "SEVERITY" "ADVISORY" "PACKAGE" "FIXED IN" "SOURCE"}}
2+
{{printf "%-8s | %-19s | %-50s | %-15s | %s" "--------" "-------------------" "--------------------------------------------------" "---------------" "------"}}
3+
{{- range .Matches -}}
4+
{{- $loc := "" -}}{{- range .Artifact.Locations -}}{{- $loc = .RealPath -}}{{- end}}
5+
{{printf "%-8s | %-19s | %-50s | %-15s | %s" .Vulnerability.Severity .Vulnerability.ID (printf "%s@%s" .Artifact.Name .Artifact.Version) (join ", " .Vulnerability.Fix.Versions) $loc}}
6+
{{- end}}

.grype.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fail-on-severity: high
2+
sort-by: severity
3+
output-template-file: .grype-report.tmpl
4+
5+
ignore:
6+
- fix-state: 'wont-fix'
7+
- fix-state: 'not-fixed'
8+
9+
# Comment out to include scanning experimental license inventory
10+
exclude:
11+
- './experimental/**'

0 commit comments

Comments
 (0)