Skip to content

Commit d031816

Browse files
committed
feat(security): add snyk scan
1 parent 1c9356a commit d031816

File tree

4 files changed

+69
-3
lines changed

4 files changed

+69
-3
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Checkout source
3838
uses: actions/checkout@v3
3939

40-
- name: Setup node
40+
- name: Setup Node
4141
uses: actions/setup-node@v3
4242
with:
4343
node-version-file: .nvmrc

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
fetch-depth: 0
3636
persist-credentials: false
3737

38-
- name: Setup node
38+
- name: Setup Node
3939
uses: actions/setup-node@v3
4040
with:
4141
node-version-file: .nvmrc

.github/workflows/snyk.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Use Snyk to find and fix vulnerabilities in your GitHub repository.
2+
# https://github.com/snyk/actions/
3+
4+
name: Snyk Security
5+
6+
on:
7+
# Scan every Sunday at 1am
8+
schedule:
9+
- cron: '0 1 * * SUN'
10+
# Scan every push to main branch
11+
push:
12+
branches:
13+
- main
14+
# Scan every pull request to main branch
15+
pull_request:
16+
branches:
17+
- main
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
snyk:
24+
permissions:
25+
contents: read # for actions/checkout to fetch code
26+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
27+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
28+
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout source
33+
uses: actions/checkout@v3
34+
35+
- name: Setup Node
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version-file: .nvmrc
39+
cache: yarn
40+
cache-dependency-path: yarn.lock
41+
42+
- name: Install dependencies
43+
run: yarn install
44+
45+
- name: Setup Snyk
46+
uses: snyk/actions/setup@master
47+
env:
48+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
49+
50+
- name: Snyk Code Scan
51+
run: snyk code test --sarif > snyk-code.sarif
52+
continue-on-error: true # so that the SARIF upload gets called
53+
env:
54+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
55+
56+
- name: Snyk Open Source Monitor
57+
run: snyk monitor --all-projects
58+
continue-on-error: true # so that the SARIF upload gets called
59+
env:
60+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
61+
62+
- name: Upload results to GitHub Code Scanning
63+
uses: github/codeql-action/upload-sarif@v2
64+
with:
65+
sarif_file: snyk-code.sarif
66+
category: Snyk

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Checkout source
1111
uses: actions/checkout@v3
1212

13-
- name: Setup node
13+
- name: Setup Node
1414
uses: actions/setup-node@v3
1515
with:
1616
node-version-file: .nvmrc

0 commit comments

Comments
 (0)