forked from fedimint/fedimint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.semgrep.all.yaml
53 lines (45 loc) · 1.62 KB
/
.semgrep.all.yaml
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
rules:
- id: ban-system-time-now
languages:
- rust
message: Use fedimint_core::time::now instead of std::time::SystemTime::now for better wasm compatibility.
pattern: std::time::SystemTime::now
severity: WARNING
- id: ban-instant-now
languages:
- rust
message: Use fedimint_core::time::now instead of Instant::now for better wasm compatibility. ATM. there's no good Instant replacement for WASM, so we need to resort to SystemTime.
pattern-either:
- pattern: std::time::Instant::now
- pattern: tokio::time::Instant::now
severity: WARNING
paths:
exclude:
# doesn't run in wasm
- devimint/
# server only
- fedimint-server/
# being phased out
- fedimint-client-legacy/
- id: ban-fs-write
languages:
- rust
message: Overwriting existing files is rarely a good idea. Use fedimint-core::util::write_overwrite if you are really sure you want to overwrite existing data or `fedimint-core::util::write_overwrite::write_new` if you don't. Alternatively use `fs::File::options` and express intention explicitly.
pattern-either:
- pattern: tokio::fs::write
- pattern: std::fs::write
severity: WARNING
- id: ban-file-create
languages:
- rust
message: Overwriting existing files is rarely a good idea. `fs::File::options` and express intention explicitly.
pattern-either:
- pattern: std::fs::File::create
- pattern: tokio::fs::File::create
severity: WARNING
- id: ban-tokio-sleep
languages:
- rust
message: "`tokio::time::sleep` doesn't work in WASM. Use `fedimint_core::task::sleep` instead."
pattern: tokio::time::sleep
severity: WARNING