Commit d43feba
authored
Add Semgrep in CircleCI (#1910)
Related tiny-pilot/tinypilot-pro#1595
This PR runs [Semgrep](https://github.com/semgrep/semgrep), a Static
Application Security Testing (SAST) tool, on our code in CircleCI.
This PR also addresses Semgrep's [9 initial
findings](https://app.circleci.com/pipelines/github/tiny-pilot/tinypilot/4840/workflows/b0fb5361-fcb6-462e-bcbe-53dc42e16af9/jobs/36859?invite=true#step-104-1533_19).
Notes:
1. Seeing as Semgrep runs SAST on multiple languages (not just Python),
we run it via a new `dev-scripts/check-security` script.
2. We only use the free version of Semgrep (i.e., [local
scans](https://semgrep.dev/docs/getting-started/cli)). Otherwise,
Semgrep want us to login and pay for additional security rules.
3. Semgrep flagged `janus.js` as allowing any origin (i.e., `*`) to
listen for
[`postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#targetorigin)
messages. Looking at the Janus code, `postMessage` is only used for an
(outdated) [Janus WebRTC Screensharing chrome
extension](https://chromewebstore.google.com/detail/janus-webrtc-screensharin/hapfgfdkleiggjjpfpenajgdnfckjpaj?hl=fil&gl=001).
So I've just removed the origin wildcard:
-
https://github.com/tiny-pilot/tinypilot/blob/0276b1358f3fc976a27aa386a31e1966212dff03/app/static/third-party/janus-gateway/1.3.2/janus.js#L73
<a data-ca-tag
href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1910"><img
src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review
on CodeApprove" /></a>1 parent 5381c00 commit d43feba
File tree
13 files changed
+80
-7
lines changed- .circleci
- app
- db
- static/third-party/janus-gateway/1.3.2
- debian-pkg/opt/tinypilot-privileged/scripts
- dev-scripts
13 files changed
+80
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
152 | 169 | | |
153 | 170 | | |
154 | 171 | | |
| |||
303 | 320 | | |
304 | 321 | | |
305 | 322 | | |
| 323 | + | |
306 | 324 | | |
307 | 325 | | |
308 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
321 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
0 commit comments