Skip to content

Commit 1dc6669

Browse files
authored
Update npm packages to latest versions (#165)
GitHub Actions should audit npm packages using yarn audit Adds script/yarn_audit.sh which GitHub Actions and developers can run.
1 parent 4506c4a commit 1dc6669

563 files changed

Lines changed: 2128 additions & 1700 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/static_code_analysis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ jobs:
3030
run: bundle exec bundle-audit check --update --ignore CVE-2024-6484
3131
# run: bundle exec bundle-audit check --update
3232

33+
yarn-audit:
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- uses: actions/checkout@v3
38+
- name: Set up Ruby + Bundle
39+
uses: ruby/setup-ruby@v1
40+
with:
41+
bundler-cache: true
42+
- name: Audit the yarn npm packages
43+
run: script/yarn_audit.sh
44+
3345
# notify:
3446
# # Run only on main, but regardless of whether tests past:
3547
# if: ${{ always() }}

script/yarn_audit.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
# Script yarn_audit.sh
3+
# Runs a yarn audit, but ignores accepted yarn warnings, and pretty-prints errors in JSON
4+
5+
# YARN_IGNROE is a list of accepted yarn warnings, space separated:
6+
# Path traversal in webpack-dev-middleware
7+
YARN_IGNORE="GHSA-wr3j-pwj9-hqq6"
8+
# Uncontrolled resource consumption in braces
9+
YARN_IGNORE="$YARN_IGNORE GHSA-grv7-fg5c-xmjg"
10+
# Denial of service in http-proxy-middleware
11+
YARN_IGNORE="$YARN_IGNORE GHSA-c7qv-q95q-8v27"
12+
# Improper Verification of Cryptographic Signature in node-forge
13+
YARN_IGNORE="$YARN_IGNORE GHSA-x4jg-mjrx-434g GHSA-cfm4-qjh2-4765"
14+
# node-forge has ASN.1 Unbounded Recursion
15+
YARN_IGNORE="$YARN_IGNORE GHSA-554w-wpv2-vw27"
16+
# node-forge has an Interpretation Conflict vulnerability via its ASN.1 Validator Desynchronization
17+
YARN_IGNORE="$YARN_IGNORE GHSA-5gfm-wpxj-wjgq"
18+
# Inefficient Regular Expression Complexity in nth-check"
19+
YARN_IGNORE="$YARN_IGNORE GHSA-rp65-9cf3-cjxr"
20+
# ip SSRF improper categorization in isPublic
21+
YARN_IGNORE="$YARN_IGNORE GHSA-2p57-rm9w-gvfp"
22+
23+
YARN_IGNORE_JSON="`echo $YARN_IGNORE | sed -e 's/^/"/' -e 's/$/"/' -e 's/ /", "/g'`"
24+
echo "yarn audit --no-progress --level high --json"
25+
yarn audit --no-progress --level high --json > yarn_audit.json || true
26+
echo
27+
echo "Summary counts of vulnerabilities found, before filtering accepted warnings:"
28+
cat yarn_audit.json | jq -c 'select ( .type == "auditSummary" )' | jq -M
29+
30+
echo
31+
echo "Filtering for new high or critical severity warnings:"
32+
for IGNORE in $YARN_IGNORE; do
33+
cat yarn_audit.json | \
34+
jq -cMe 'select ( .type == "auditAdvisory" and (.data.advisory.github_advisory_id == "'"$IGNORE"'") )' > /dev/null || \
35+
echo "Warning: yarn audit no longer flags github_advisory_id $IGNORE"
36+
done
37+
38+
if cat yarn_audit.json | jq -c 'select ( .type == "auditAdvisory" and (.data.advisory.github_advisory_id | IN ('"$YARN_IGNORE_JSON"') | not) )' | jq -Me; then
39+
echo
40+
echo Warning: New yarn audit vulnerabilities found in yarn.lock, listed above.
41+
echo Run yarn upgrade, or update YARN_IGNORE in script/yarn_audit.sh
42+
echo with accepted github_advisory_id values.
43+
exit 1
44+
else
45+
rm -f yarn_audit.json
46+
echo No new yarn audit vulnerabilities found
47+
fi
-14.8 KB
Binary file not shown.
-7.25 KB
Binary file not shown.
9.74 KB
Binary file not shown.
-6.08 KB
Binary file not shown.
6.42 KB
Binary file not shown.
-181 KB
Binary file not shown.
186 KB
Binary file not shown.
-99.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)