@sudoplatform/sudo-common 10.0.3 → 10.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/yarn-audit-with-suppression.sh +66 -30
- package/package.json +12 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/bin/
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
3
|
# Run yarn audit reading any suppressions from the auditSuppressions element
|
|
4
4
|
# of package.json.
|
|
@@ -13,34 +13,70 @@
|
|
|
13
13
|
# }
|
|
14
14
|
# }
|
|
15
15
|
#
|
|
16
|
-
# Previously, the value of the audit suppression was
|
|
17
|
-
# this old format is still recognized by this script
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
# Previously, the value of the audit suppression was just the expiry timestamp
|
|
17
|
+
# this old format is still recognized by this script for Yarn v1 projects, but
|
|
18
|
+
# ignored for Yarn 4+ projects.
|
|
19
|
+
|
|
20
|
+
YARNVER=$(yarn -v)
|
|
21
|
+
if [[ "${YARNVER}" == 1* ]]; then
|
|
22
|
+
yarn npm audit --json --groups "dependencies devDependencies" | \
|
|
23
|
+
jq -M -s -c 'map(select(.type == "auditAdvisory").data.advisory) | unique_by(.id) | .[] | {id, title, module_name, vulnerable_versions, patched_versions, severity, findings}' | \
|
|
24
|
+
(new=""; while read -r advisory ; do
|
|
25
|
+
id=$(echo "${advisory}" | jq '.id')
|
|
26
|
+
suppression=$(jq ".auditSuppressions[\"$id\"] | select (. != null)" package.json)
|
|
27
|
+
if [ -z "$suppression" ]; then
|
|
28
|
+
echo "New advisory ${id}:"
|
|
29
|
+
echo "${advisory}" | jq .
|
|
30
|
+
new=1
|
|
31
|
+
else
|
|
32
|
+
if expr "$suppression" : '[0-9][0-9]*$' >/dev/null ; then
|
|
33
|
+
# Old style suppression that was just the expiry timestamp
|
|
34
|
+
expiry="$suppression"
|
|
35
|
+
else
|
|
36
|
+
# New style suppression is a JSON object
|
|
37
|
+
expiry=$(echo "$suppression" | jq -M -c ".until // 0")
|
|
38
|
+
fi
|
|
39
|
+
if [ "$(date '+%s')" -gt "$expiry" ]; then
|
|
40
|
+
echo "Suppression for advisory ${id} has expired. Please revisit:"
|
|
41
|
+
echo "${advisory}" | jq .
|
|
42
|
+
new=1
|
|
43
|
+
fi
|
|
44
|
+
fi
|
|
45
|
+
done
|
|
46
|
+
if [ -n "${new}" ]; then
|
|
47
|
+
exit 1
|
|
40
48
|
fi
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
)
|
|
50
|
+
else
|
|
51
|
+
now=$(date '+%s')
|
|
52
|
+
|
|
53
|
+
echo "Checking for npm audit advisories"
|
|
54
|
+
echo
|
|
55
|
+
ignores=$(
|
|
56
|
+
# shellcheck disable=SC2002
|
|
57
|
+
cat package.json | \
|
|
58
|
+
jq -j -r ".auditSuppressions | select(. != null) | to_entries[] | select(.value.untilISO | fromdate > $now) | (\" --ignore \" + .key)"
|
|
59
|
+
)
|
|
60
|
+
# shellcheck disable=SC2086
|
|
61
|
+
yarn npm audit --all --environment all --recursive --no-deprecations $ignores
|
|
62
|
+
foundaudits=$?
|
|
63
|
+
|
|
64
|
+
echo
|
|
65
|
+
echo "Checking for expired audit suppressions"
|
|
66
|
+
# shellcheck disable=SC2002
|
|
67
|
+
cat package.json | \
|
|
68
|
+
jq -e ".auditSuppressions | select(. != null) | to_entries[] | select(.value.untilISO | fromdate <= $now)"
|
|
69
|
+
# "jq -e" returns 4 if no valid result was found - so 4 means success, 0 (or anything else) is failure
|
|
70
|
+
# so determine status by testing result for 4
|
|
71
|
+
[ $? == 4 ]
|
|
72
|
+
foundexpired=$?
|
|
73
|
+
|
|
74
|
+
echo
|
|
75
|
+
echo "done"
|
|
76
|
+
|
|
77
|
+
[ $foundaudits != 0 ] && exit 1
|
|
78
|
+
[ $foundexpired != 0 ] && exit 1
|
|
79
|
+
|
|
80
|
+
# No audit failures or expired suppressions that need examination. Success
|
|
81
|
+
exit 0
|
|
45
82
|
fi
|
|
46
|
-
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudoplatform/sudo-common",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.5",
|
|
4
4
|
"author": "Anonyome Labs, Inc.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,31 +48,31 @@
|
|
|
48
48
|
"types"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@aws-sdk/client-s3": "
|
|
51
|
+
"@aws-sdk/client-s3": "^3.758.0",
|
|
52
52
|
"apollo-client": "^2.6.10",
|
|
53
53
|
"asn1js": "^3.0.5",
|
|
54
54
|
"browser-bunyan": "^1.8.0",
|
|
55
55
|
"fflate": "^0.8.2",
|
|
56
56
|
"graphql": "^15.9.0",
|
|
57
|
-
"pkijs": "^3.2.
|
|
57
|
+
"pkijs": "^3.2.5",
|
|
58
58
|
"tslib": "^2.8.1"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"io-ts": "^2.2.
|
|
61
|
+
"io-ts": "^2.2.22"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@types/jest": "^29.5.14",
|
|
65
65
|
"@types/node": "^20.17.9",
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
67
|
-
"@typescript-eslint/parser": "^8.
|
|
68
|
-
"concurrently": "^9.1.
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
67
|
+
"@typescript-eslint/parser": "^8.26.1",
|
|
68
|
+
"concurrently": "^9.1.2",
|
|
69
69
|
"eslint": "8.57.1",
|
|
70
70
|
"eslint-config-prettier": "^9.1.0",
|
|
71
71
|
"eslint-plugin-import": "^2.31.0",
|
|
72
|
-
"eslint-plugin-prettier": "^5.2.
|
|
72
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
73
73
|
"eslint-plugin-tree-shaking": "^1.12.2",
|
|
74
74
|
"fp-ts": "^2.16.9",
|
|
75
|
-
"io-ts": "^2.2.
|
|
75
|
+
"io-ts": "^2.2.22",
|
|
76
76
|
"io-ts-types": "^0.5.19",
|
|
77
77
|
"isomorphic-fetch": "^3.0.0",
|
|
78
78
|
"isomorphic-webcrypto": "^2.3.8",
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
"jest-environment-jsdom": "^29.7.0",
|
|
81
81
|
"monocle-ts": "^2.3.13",
|
|
82
82
|
"newtype-ts": "^0.3.5",
|
|
83
|
-
"prettier": "^3.
|
|
83
|
+
"prettier": "^3.5.3",
|
|
84
84
|
"rimraf": "^6.0.1",
|
|
85
|
-
"ts-jest": "^29.2.
|
|
85
|
+
"ts-jest": "^29.2.6",
|
|
86
86
|
"ts-mockito": "^2.6.1",
|
|
87
87
|
"ts-node": "^10.9.2",
|
|
88
|
-
"typedoc": "^0.
|
|
88
|
+
"typedoc": "^0.28.0",
|
|
89
89
|
"typescript": "~5.7.2"
|
|
90
90
|
},
|
|
91
91
|
"engines": {
|