Skip to content

Commit 19b067a

Browse files
authored
Merge pull request #141 from BitGo/WP-6506-npm-trivy-ci-checks
feat: add npm security checks in CI via trivy
2 parents 9723ab9 + dad7c31 commit 19b067a

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,43 @@ jobs:
9999
- name: Lint
100100
run: npm run lint
101101

102+
trivy-scan:
103+
name: Security - Trivy Scan
104+
runs-on: ubuntu-latest
105+
steps:
106+
- name: Checkout
107+
uses: actions/checkout@v4
108+
109+
- name: Setup Node.js
110+
uses: actions/setup-node@v4
111+
with:
112+
node-version: ${{ inputs.node-version }}
113+
cache: 'npm'
114+
115+
- name: Cache dependencies
116+
uses: actions/cache@v3
117+
id: node-modules-cache
118+
with:
119+
path: '**/node_modules'
120+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
121+
restore-keys: |
122+
${{ runner.os }}-modules-
123+
124+
- name: Install dependencies
125+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
126+
run: npm ci
127+
128+
- name: Run Trivy vulnerability scanner
129+
uses: aquasecurity/trivy-action@master
130+
with:
131+
scan-type: 'fs'
132+
scan-ref: '.'
133+
format: 'table'
134+
severity: 'CRITICAL,HIGH'
135+
exit-code: '1'
136+
ignore-unfixed: true
137+
scanners: 'vuln' # Only scan for vulnerabilities, not secrets
138+
102139
test:
103140
name: Test
104141
runs-on: ubuntu-latest

.trivyignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Trivy Ignore File
2+
# Exclude false positive vulnerabilities from security scans
3+
#
4+
# NOTE: We use scanners:'vuln' in CI workflows to skip secret scanning entirely.
5+
# Test certificates (.pem, .key files) are not scanned for secrets in CI.
6+
#
7+
# This file is used for ignoring specific CVEs that are false positives.
8+
#
9+
# Format:
10+
# CVE-ID [exp:YYYY-MM-DD] [# comment]
11+
#
12+
# Examples:
13+
# CVE-2024-12345 # False positive - not applicable to our usage
14+
# CVE-2024-67890 exp:2025-12-31 # Temporary ignore until vendor fixes
15+
#
16+
17+
# Add specific CVE ignores below with reasons:
18+
19+
# Ruby gem vulnerabilities in js-xdr/Gemfile.lock
20+
# Source: @bitgo-beta/sdk-coin-algo -> [email protected] -> stellar-base -> [email protected]
21+
# Reason: Ruby gems are not executed in Node.js runtime, false positive
22+
# These are packaged Ruby files for Ruby bindings/testing, not used in JavaScript
23+
CVE-2020-8165 # rubygem-activesupport 4.2.1
24+
CVE-2023-22796 # rubygem-activesupport 4.2.1
25+
CVE-2014-10077 # rubygem-i18n 0.7.0
26+
CVE-2020-10663 # rubygem-json 1.8.2
27+
CVE-2022-31163 # rubygem-tzinfo 1.2.2

0 commit comments

Comments
 (0)