Skip to content

Commit e2e9a4b

Browse files
committed
Test vulnerability scan
1 parent 53c0a0e commit e2e9a4b

File tree

2 files changed

+71
-2
lines changed

2 files changed

+71
-2
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ jobs:
272272
'{channel: $channel, text: $text}')"
273273
274274
- name: Install cyclonedx-npm
275-
run: npm install -g @cyclonedx/cyclonedx-npm@4.0.2
275+
run: npm install -g @cyclonedx/cyclonedx-npm@4.1.2
276276

277277
- name: Generate CycloneDX SBOM
278278
run: cyclonedx-npm --output-format json --output-file sbom.json
279279

280280
- name: Scan SBOM for vulnerabilities using Trivy
281-
uses: aquasecurity/trivy-action@0.28.0
281+
uses: aquasecurity/trivy-action@0.34.0
282282
with:
283283
scan-type: sbom
284284
scan-ref: sbom.json
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Scans dependencies for CRITICAL/HIGH vulnerabilities using SBOM and Trivy (same flow as release.yml).
2+
3+
name: Vulnerability Scan
4+
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
workflow_dispatch:
11+
12+
jobs:
13+
vulnerability-scan:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Use Node.js 24.x
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 24.x
25+
26+
- name: Setup npm version 10
27+
run: |
28+
npm i -g npm@10 --registry=https://registry.npmjs.org
29+
30+
- name: Cache node modules
31+
id: cache-nodemodules
32+
uses: actions/cache@v4
33+
env:
34+
cache-name: cache-node-modules
35+
with:
36+
# caching node_modules
37+
path: |
38+
node_modules
39+
*/*/node_modules
40+
key: ${{ runner.os }}-deps-24.x-${{ hashFiles('**/package-lock.json') }}
41+
restore-keys: |
42+
${{ runner.os }}-deps-24.x-
43+
44+
- name: Install Dependencies
45+
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
46+
run: npm ci
47+
48+
- name: Install cyclonedx-npm
49+
run: npm install -g @cyclonedx/cyclonedx-npm@4.1.2
50+
51+
- name: Generate CycloneDX Software Bill of Materials (SBOM) in JSON format
52+
run: cyclonedx-npm --output-format json --output-file sbom.json
53+
54+
- name: Scan SBOM for vulnerabilities using Trivy
55+
uses: aquasecurity/trivy-action@0.34.0
56+
with:
57+
scan-type: sbom
58+
scan-ref: sbom.json
59+
format: table
60+
exit-code: 0 # TODO: Change to 1 to fail CI on vulnerabilities
61+
output: vuln-report.txt
62+
severity: CRITICAL,HIGH
63+
64+
- name: Print vulnerability report
65+
if: always()
66+
run: |
67+
echo "=== Vulnerability Scan Report ==="
68+
cat vuln-report.txt
69+

0 commit comments

Comments
 (0)