Skip to content

Commit 449f35b

Browse files
authored
Merge pull request #1605 from finos/chore/cve-ci
ci: add Grype CVE scanning workflow, clean up vulnerable deps
2 parents 5106be3 + fb20c69 commit 449f35b

4 files changed

Lines changed: 81 additions & 0 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/**'

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)