aboutsummaryrefslogtreecommitdiffstats
path: root/.circleci/scripts/yarn-audit
diff options
context:
space:
mode:
authorDan Finlay <542863+danfinlay@users.noreply.github.com>2019-08-07 05:53:50 +0800
committerGitHub <noreply@github.com>2019-08-07 05:53:50 +0800
commitdb08881d4527e8a037f401ef22b849e52152864f (patch)
tree6032d7a4ae67371889eece1d8490c26d5a119dd5 /.circleci/scripts/yarn-audit
parent4139019d0f4dd83f56da400ca7e0e6d1976d1716 (diff)
parent86ad9564a064fd6158dab6a3c9e5b10614ef6e68 (diff)
downloadtangerine-wallet-browser-7.0.0.tar
tangerine-wallet-browser-7.0.0.tar.gz
tangerine-wallet-browser-7.0.0.tar.bz2
tangerine-wallet-browser-7.0.0.tar.lz
tangerine-wallet-browser-7.0.0.tar.xz
tangerine-wallet-browser-7.0.0.tar.zst
tangerine-wallet-browser-7.0.0.zip
Merge pull request #6969 from MetaMask/developv7.0.0
Master Version Bump
Diffstat (limited to '.circleci/scripts/yarn-audit')
-rwxr-xr-x.circleci/scripts/yarn-audit20
1 files changed, 20 insertions, 0 deletions
diff --git a/.circleci/scripts/yarn-audit b/.circleci/scripts/yarn-audit
new file mode 100755
index 000000000..ebe036815
--- /dev/null
+++ b/.circleci/scripts/yarn-audit
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -u
+set -o pipefail
+
+yarn audit --level moderate --groups dependencies
+audit_status="$?"
+
+# Use a bitmask to ignore INFO and LOW severity audit results
+# See here: https://yarnpkg.com/lang/en/docs/cli/audit/
+audit_status="$(( audit_status & 11100 ))"
+
+if [[ "$audit_status" != 0 ]]
+then
+ count="$(yarn audit --level moderate --groups dependencies --json | tail -1 | jq '.data.vulnerabilities.moderate + .data.vulnerabilities.high + .data.vulnerabilities.critical')"
+ printf "Audit shows %s moderate or high severity advisories _in the production dependencies_\n" "$count"
+ exit 1
+else
+ printf "Audit shows _zero_ moderate or high severity advisories _in the production dependencies_\n"
+fi