Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit aed448d

Browse files
committed
Setup Snyk
Snyk monitors for vulnerable dependencies and notifies us if any were to be found. This fails the build if any high priority vulnerabilities are found in analytics.js-core. It runs as a seperate CI job to speed up builds. To reduce the copy paste between the different jobs, I moved the common bits into a defaults section that is shared between the jobs.
1 parent 39f8e57 commit aed448d

File tree

3 files changed

+963
-339
lines changed

3 files changed

+963
-339
lines changed

.circleci/config.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
defaults: &defaults
2+
working_directory: ~/analytics.js-core
3+
docker:
4+
- image: circleci/node:8-browsers
5+
16
version: 2
27
jobs:
38
test:
4-
docker:
5-
- image: circleci/node:8-browsers
9+
<<: *defaults
610
steps:
711
- checkout
812
- run: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
@@ -17,8 +21,7 @@ jobs:
1721
- store_test_results:
1822
path: junit-reports
1923
coverage:
20-
docker:
21-
- image: circleci/node:8-browsers
24+
<<: *defaults
2225
steps:
2326
- checkout
2427
- run: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
@@ -33,6 +36,17 @@ jobs:
3336
- store_test_results:
3437
path: junit-reports
3538
- run: yarn run codecov
39+
- persist_to_workspace:
40+
root: .
41+
paths:
42+
- .
43+
snyk:
44+
<<: *defaults
45+
steps:
46+
- checkout
47+
- attach_workspace: { at: . }
48+
- run: yarn run snyk test --severity-threshold=high
49+
- run: yarn run snyk monitor
3650
publish:
3751
docker:
3852
- image: circleci/node:8-browsers
@@ -52,6 +66,10 @@ workflows:
5266
filters:
5367
tags:
5468
only: /.*/
69+
- snyk:
70+
context: snyk
71+
requires:
72+
- coverage
5573
- deploy:
5674
requires:
5775
- test

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"prettier-eslint-cli": "^4.7.1",
103103
"proclaim": "^3.4.1",
104104
"sinon": "^1.7.3",
105+
"snyk": "^1.83.0",
105106
"watchify": "^3.7.0"
106107
}
107108
}

0 commit comments

Comments
 (0)