@sudoplatform/sudo-common 8.9.0 → 8.9.1
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/suppress-audit.sh
CHANGED
|
@@ -14,16 +14,71 @@
|
|
|
14
14
|
# }
|
|
15
15
|
#
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
usage() {
|
|
18
|
+
echo 1>&2 "Usage: $cmd [-d <days-to-suppress>] audit-id reasonwords as remaining args"
|
|
19
|
+
echo 1>&2
|
|
20
|
+
echo 1>&2 " -d Number of days to suppress vulnerability for. Default: 30."
|
|
21
|
+
echo 1>&2
|
|
22
|
+
echo 1>&2 " Example:"
|
|
23
|
+
echo 1>&2 " suppress-audit.sh 12345 suppressing for a while"
|
|
24
|
+
echo 1>&2
|
|
25
|
+
echo 1>&2 " Suppresses vulnerability 12345 for default 30 days recording"
|
|
26
|
+
echo 1>&2 " 'suppressing for a while' as the reason."
|
|
27
|
+
echo 1>&2
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
DAYS_TO_SUPPRESS=30
|
|
31
|
+
|
|
32
|
+
cmd=$(basename "$0")
|
|
33
|
+
# shellcheck disable=SC2048,SC2086
|
|
34
|
+
if ! args=$(getopt d: $*); then
|
|
35
|
+
usage
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# shellcheck disable=SC2086
|
|
40
|
+
set -- $args
|
|
41
|
+
|
|
42
|
+
while [ "$#" -gt 0 ] && [ "$1" != "--" ]; do
|
|
43
|
+
case "$1" in
|
|
44
|
+
-d) if ! expr "$2" : '[0-9][0-9]*$' >/dev/null || [ "$(($2 > 0))" -eq 0 ]; then
|
|
45
|
+
echo 1>&2 "ERROR: suppression days must be positive integer"
|
|
46
|
+
echo 1>&2
|
|
47
|
+
usage
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
DAYS_TO_SUPPRESS=$2
|
|
51
|
+
shift
|
|
52
|
+
shift
|
|
53
|
+
;;
|
|
54
|
+
esac
|
|
55
|
+
done
|
|
56
|
+
if [ "$1" = "--" ]; then
|
|
57
|
+
shift
|
|
58
|
+
fi
|
|
59
|
+
auditid="$1"
|
|
18
60
|
shift
|
|
19
61
|
reason="${*}"
|
|
20
|
-
PACKAGE_JSON="package.json"
|
|
21
62
|
|
|
22
|
-
if [ -z "$auditid" ]
|
|
23
|
-
echo "
|
|
63
|
+
if [ -z "$auditid" ]; then
|
|
64
|
+
echo 1>&2 "ERROR: No audit-id specified"
|
|
65
|
+
echo 1>&2
|
|
66
|
+
usage
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
if [ -z "$reason" ]; then
|
|
71
|
+
echo 1>&2 "ERROR: No suppression reason specified"
|
|
72
|
+
echo 1>&2
|
|
73
|
+
usage
|
|
24
74
|
exit 1
|
|
25
75
|
fi
|
|
26
76
|
|
|
77
|
+
SECONDS_TO_SUPPRESS=$((DAYS_TO_SUPPRESS * 3600 * 24))
|
|
78
|
+
PACKAGE_JSON="package.json"
|
|
79
|
+
|
|
80
|
+
set -e
|
|
27
81
|
cp $PACKAGE_JSON $PACKAGE_JSON.old
|
|
28
|
-
cat $PACKAGE_JSON | jq '(now | floor | . +
|
|
82
|
+
cat $PACKAGE_JSON | jq '(now | floor | . + '$SECONDS_TO_SUPPRESS') as $expiry | .auditSuppressions."'"$auditid"'" = {"until": $expiry,"untilISO":($expiry | strftime("%FT%TZ") ),"reason":"'"${reason}"'"}' > $PACKAGE_JSON.staging
|
|
29
83
|
mv $PACKAGE_JSON.staging $PACKAGE_JSON
|
|
84
|
+
set +e
|
|
@@ -26,7 +26,7 @@ yarn audit --json --groups "dependencies devDependencies" | \
|
|
|
26
26
|
echo "${advisory}" | jq .
|
|
27
27
|
new=1
|
|
28
28
|
else
|
|
29
|
-
if expr "$suppression" : '
|
|
29
|
+
if expr "$suppression" : '[0-9][0-9]*$' >/dev/null ; then
|
|
30
30
|
# Old style suppression that was just the expiry timestamp
|
|
31
31
|
expiry="$suppression"
|
|
32
32
|
else
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudoplatform/sudo-common",
|
|
3
|
-
"version": "8.9.
|
|
3
|
+
"version": "8.9.1",
|
|
4
4
|
"author": "Anonyome Labs, Inc.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -90,6 +90,6 @@
|
|
|
90
90
|
"ts-mockito": "^2.6.1",
|
|
91
91
|
"ts-node": "^10.9.2",
|
|
92
92
|
"typedoc": "^0.25.13",
|
|
93
|
-
"typescript": "
|
|
93
|
+
"typescript": "~5.4.x"
|
|
94
94
|
}
|
|
95
95
|
}
|