Skip to content

Commit 3c74969

Browse files
committed
feat: add npm audit and trivy CI checks on PRs
Ticket: WP-6506
1 parent 9723ab9 commit 3c74969

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-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

0 commit comments

Comments
 (0)