-
Notifications
You must be signed in to change notification settings - Fork 328
149 lines (128 loc) · 5.41 KB
/
snyk-scan.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Snyk Security Vulnerability Scan
on:
workflow_dispatch:
pull_request:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- "main"
jobs:
snyk_scan_test:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: Check changed Deps files
uses: tj-actions/changed-files@v35
id: changed-files
with:
files: |
go.mod
ui/package-lock.json
website/package-lock.json
py/examples/requirements.txt
py/Makefile
- uses: snyk/actions/setup@master
- uses: actions/setup-go@v3
with:
go-version: "1.19.4"
- name: Snyk scan for Go dependencies
if: contains(steps.changed-files.outputs.all_changed_and_modified_files, 'go.mod')
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
GOFLAGS="-e" snyk test --file=go.mod -d --fail-on=all
- name: Snyk scan for Node dependencies
if: contains(steps.changed-files.outputs.all_changed_and_modified_files, 'ui/package-lock.json')
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --file=ui/package-lock.json -d --fail-on=all
- name: Snyk scan for Node dependencies
if: contains(steps.changed-files.outputs.all_changed_and_modified_files, 'website/package-lock.json')
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --file=website/package-lock.json -d --fail-on=all
- name: Check python deps files
id: changed-py-deps
if: |
contains(steps.changed-files.outputs.all_changed_and_modified_files, 'py/Makefile') ||
contains(steps.changed-files.outputs.all_changed_and_modified_files, 'py/examples/requirements.txt')
shell: bash
run: echo "any_changed=true" >> $GITHUB_OUTPUT
- uses: snyk/actions/setup@master
if: steps.changed-py-deps.outputs.any_changed == 'true'
- uses: actions/setup-python@v4
if: steps.changed-py-deps.outputs.any_changed == 'true'
with:
python-version: "3.8"
- name: pip install
if: steps.changed-py-deps.outputs.any_changed == 'true'
run: |
pip install build httpx uvicorn starlette pdoc3 pytest flake8
pip install -r py/examples/requirements.txt
pip freeze > py/requirements.txt
cat py/requirements.txt
- name: Snyk scan for Python dependencies
if: steps.changed-py-deps.outputs.any_changed == 'true'
run: snyk test --org=wave --remote-repo-url=wave/${{ steps.extract_ref.outputs.ref }} --file=py/requirements.txt --project-name=WAVE/wave/${{ steps.extract_ref.outputs.ref }}/py/requirements.txt -d --fail-on=all --policy-path=.snyk
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
snyk_scan_monitor:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Extract github branch/tag name
shell: bash
run: echo "ref=$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT
id: extract_ref
- uses: actions/checkout@master
- uses: snyk/actions/setup@master
- uses: actions/setup-go@v3
with:
go-version: "1.19.4"
- name: Snyk scan for Go dependencies
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
GOFLAGS="-e" snyk monitor --org=wave --remote-repo-url=wave/${{ steps.extract_ref.outputs.ref }} --file=go.mod --project-name=WAVE/wave/${{ steps.extract_ref.outputs.ref }}/go.mod -d --fail-on=all
- name: Snyk scan for Node dependencies
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor
args: --org=wave --remote-repo-url=wave/${{ steps.extract_ref.outputs.ref }} --file=ui/package-lock.json --project-name=WAVE/wave/${{ steps.extract_ref.outputs.ref }}/ui/package-lock.json -d --fail-on=all
- name: Snyk scan for Node dependencies
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor
args: --org=wave --remote-repo-url=wave/${{ steps.extract_ref.outputs.ref }} --file=website/package-lock.json --project-name=WAVE/wave/${{ steps.extract_ref.outputs.ref }}/website/package-lock.json -d --fail-on=all
- uses: snyk/actions/setup@master
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install python depedency packages to scan
run: |
pip install build httpx uvicorn starlette pdoc3 pytest flake8
pip install -r py/examples/requirements.txt
pip freeze > py/requirements.txt
cat py/requirements.txt
- name: Snyk scan for Python dependencies
run: snyk monitor --org=wave --remote-repo-url=wave/${{ steps.extract_ref.outputs.ref }} --file=py/requirements.txt --project-name=WAVE/wave/${{ steps.extract_ref.outputs.ref }}/py/requirements.txt -d --fail-on=all
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}