-
Notifications
You must be signed in to change notification settings - Fork 8
/
verify_tests.sh
executable file
·39 lines (31 loc) · 1.03 KB
/
verify_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
MAX_HIGH=0
MAX_CRITICAL=0
npm install cross-env npm-run-all -g
npm install
npm run prettier:frontend
npm run lint:frontend
npm run test:frontend
echo "::notice::Checking for high vulnerabilities in frontend Node.js app dependencies."
cd frontend
export CI=true
HIGH_VULN_ALLOWED=$MAX_HIGH
HIGH_VULN=$(npm audit --json | jq '.metadata.vulnerabilities.high')
if [ "$HIGH_VULN" -gt "$HIGH_VULN_ALLOWED" ]; then
echo "::error::NPM HIGH vulnerabilities exceed allowed budget."
npm audit
exit 1
else
echo "::notice::No HIGH vulnerabilities found on frontend app."
fi
echo "::notice::Checking for critical vulnerabilities in frontend Node.js app dependencies."
export CI=true
CRITICAL_VULN_ALLOWED=$MAX_CRITICAL
CRITICAL_VULN=$(npm audit --json | jq '.metadata.vulnerabilities.high')
if [ "$CRITICAL_VULN" -gt "$CRITICAL_VULN_ALLOWED" ]; then
echo "::error::NPM CRITICAL vulnerabilities exceed allowed budget."
npm audit
exit 1
else
echo "::notice::No CRITICAL vulnerabilities found on frontend app."
fi