@zeroroot-ai/zerocool 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dispatch.d.ts +116 -1
- package/dist/dispatch.js +319 -3
- package/dist/findings.d.ts +9 -1
- package/dist/findings.js +36 -0
- package/dist/gitlab.d.ts +74 -0
- package/dist/gitlab.js +82 -0
- package/dist/knowledge-source.js +2 -2
- package/dist/semgrep.d.ts +76 -0
- package/dist/semgrep.js +111 -0
- package/dist/source-analysis.d.ts +134 -0
- package/dist/source-analysis.js +251 -0
- package/dist/watch.d.ts +214 -0
- package/dist/watch.js +341 -0
- package/package.json +4 -3
- package/semgrep/rules.yaml +178 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# The pinned semgrep ruleset the zerocool source-analysis task runs
|
|
2
|
+
# (zerocool-plugins#87). Vendored, not fetched: the sandbox must produce the
|
|
3
|
+
# same candidate list for the same checkout on every run, with no registry
|
|
4
|
+
# call and no telemetry. Every rule names the CWE it detects in metadata.cwe;
|
|
5
|
+
# the task turns that into the Finding's Vulnerability id. A rule without a
|
|
6
|
+
# CWE gets a platform id instead (zerocool:semgrep:<rule id>).
|
|
7
|
+
#
|
|
8
|
+
# Rules are candidates, not verdicts. The model triages each match; a rule
|
|
9
|
+
# here may be noisy on purpose as long as the match carries enough context
|
|
10
|
+
# to be judged. Keep the set small and cross-language; a rule that never
|
|
11
|
+
# yields a real finding in the demo fixture or a real repository is removed.
|
|
12
|
+
rules:
|
|
13
|
+
- id: js-eval-of-request-input
|
|
14
|
+
languages: [javascript, typescript]
|
|
15
|
+
severity: ERROR
|
|
16
|
+
message: >-
|
|
17
|
+
eval() runs a string that comes from request input. An attacker who
|
|
18
|
+
controls that input runs arbitrary code in the server process.
|
|
19
|
+
patterns:
|
|
20
|
+
- pattern-either:
|
|
21
|
+
- pattern: eval($ARG)
|
|
22
|
+
- pattern: new Function($ARG)
|
|
23
|
+
- metavariable-pattern:
|
|
24
|
+
metavariable: $ARG
|
|
25
|
+
pattern-either:
|
|
26
|
+
- pattern: $REQ.body.$X
|
|
27
|
+
- pattern: $REQ.query.$X
|
|
28
|
+
- pattern: $REQ.params.$X
|
|
29
|
+
- pattern: $REQ.body
|
|
30
|
+
- pattern: $REQ.query
|
|
31
|
+
metadata:
|
|
32
|
+
cwe: "CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code"
|
|
33
|
+
category: injection
|
|
34
|
+
|
|
35
|
+
- id: js-eval-any
|
|
36
|
+
languages: [javascript, typescript]
|
|
37
|
+
severity: WARNING
|
|
38
|
+
message: >-
|
|
39
|
+
eval() on a value. Real when the value can be influenced by a caller;
|
|
40
|
+
noise when it is a constant.
|
|
41
|
+
pattern: eval($ARG)
|
|
42
|
+
metadata:
|
|
43
|
+
cwe: "CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code"
|
|
44
|
+
category: injection
|
|
45
|
+
|
|
46
|
+
- id: js-child-process-shell-concat
|
|
47
|
+
languages: [javascript, typescript]
|
|
48
|
+
severity: ERROR
|
|
49
|
+
message: >-
|
|
50
|
+
A shell command is built by string concatenation and run through
|
|
51
|
+
child_process. Input in the string becomes shell syntax.
|
|
52
|
+
patterns:
|
|
53
|
+
- pattern-either:
|
|
54
|
+
- pattern: $CP.exec($CMD, ...)
|
|
55
|
+
- pattern: $CP.execSync($CMD, ...)
|
|
56
|
+
- pattern: exec($CMD, ...)
|
|
57
|
+
- pattern: execSync($CMD, ...)
|
|
58
|
+
- metavariable-pattern:
|
|
59
|
+
metavariable: $CMD
|
|
60
|
+
pattern-either:
|
|
61
|
+
- pattern: $A + $B
|
|
62
|
+
- pattern: "`...${$X}...`"
|
|
63
|
+
metadata:
|
|
64
|
+
cwe: "CWE-78: Improper Neutralization of Special Elements used in an OS Command"
|
|
65
|
+
category: injection
|
|
66
|
+
|
|
67
|
+
- id: js-sql-string-concat
|
|
68
|
+
languages: [javascript, typescript]
|
|
69
|
+
severity: ERROR
|
|
70
|
+
message: >-
|
|
71
|
+
A SQL query is built by string concatenation or interpolation and passed
|
|
72
|
+
to a query function. Use a parameterized query.
|
|
73
|
+
patterns:
|
|
74
|
+
- pattern-either:
|
|
75
|
+
- pattern: $DB.query($SQL, ...)
|
|
76
|
+
- pattern: $DB.raw($SQL, ...)
|
|
77
|
+
- pattern: $DB.execute($SQL, ...)
|
|
78
|
+
- metavariable-pattern:
|
|
79
|
+
metavariable: $SQL
|
|
80
|
+
pattern-either:
|
|
81
|
+
- pattern: $A + $B
|
|
82
|
+
- pattern: "`...${$X}...`"
|
|
83
|
+
metadata:
|
|
84
|
+
cwe: "CWE-89: Improper Neutralization of Special Elements used in an SQL Command"
|
|
85
|
+
category: injection
|
|
86
|
+
|
|
87
|
+
- id: js-hardcoded-jwt-secret
|
|
88
|
+
languages: [javascript, typescript]
|
|
89
|
+
severity: ERROR
|
|
90
|
+
message: >-
|
|
91
|
+
A JWT is signed or verified with a string literal secret. Anyone who
|
|
92
|
+
reads the source can forge tokens.
|
|
93
|
+
patterns:
|
|
94
|
+
- pattern-either:
|
|
95
|
+
- pattern: $JWT.sign($P, "$SECRET", ...)
|
|
96
|
+
- pattern: $JWT.verify($T, "$SECRET", ...)
|
|
97
|
+
metadata:
|
|
98
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
99
|
+
category: secrets-exposure
|
|
100
|
+
|
|
101
|
+
- id: js-express-res-send-request-input
|
|
102
|
+
languages: [javascript, typescript]
|
|
103
|
+
severity: WARNING
|
|
104
|
+
message: >-
|
|
105
|
+
Request input is written straight into the response body. If the
|
|
106
|
+
response is HTML this is reflected cross-site scripting.
|
|
107
|
+
patterns:
|
|
108
|
+
- pattern-either:
|
|
109
|
+
- pattern: $RES.send($ARG)
|
|
110
|
+
- pattern: $RES.write($ARG)
|
|
111
|
+
- metavariable-pattern:
|
|
112
|
+
metavariable: $ARG
|
|
113
|
+
pattern-either:
|
|
114
|
+
- pattern: $REQ.query.$X
|
|
115
|
+
- pattern: $REQ.params.$X
|
|
116
|
+
- pattern: $REQ.body.$X
|
|
117
|
+
- pattern: "`...${$REQ.query.$X}...`"
|
|
118
|
+
- pattern: "`...${$REQ.params.$X}...`"
|
|
119
|
+
- pattern: $A + $REQ.query.$X
|
|
120
|
+
- pattern: $A + $REQ.params.$X
|
|
121
|
+
metadata:
|
|
122
|
+
cwe: "CWE-79: Improper Neutralization of Input During Web Page Generation"
|
|
123
|
+
category: injection
|
|
124
|
+
|
|
125
|
+
- id: py-subprocess-shell-true
|
|
126
|
+
languages: [python]
|
|
127
|
+
severity: ERROR
|
|
128
|
+
message: >-
|
|
129
|
+
subprocess is called with shell=True and a command that is not a
|
|
130
|
+
constant. Input in the command becomes shell syntax.
|
|
131
|
+
patterns:
|
|
132
|
+
- pattern-either:
|
|
133
|
+
- pattern: subprocess.$F($CMD, ..., shell=True, ...)
|
|
134
|
+
- pattern-not: subprocess.$F("...", ..., shell=True, ...)
|
|
135
|
+
metadata:
|
|
136
|
+
cwe: "CWE-78: Improper Neutralization of Special Elements used in an OS Command"
|
|
137
|
+
category: injection
|
|
138
|
+
|
|
139
|
+
- id: py-yaml-unsafe-load
|
|
140
|
+
languages: [python]
|
|
141
|
+
severity: ERROR
|
|
142
|
+
message: yaml.load without a safe Loader deserializes arbitrary objects.
|
|
143
|
+
patterns:
|
|
144
|
+
- pattern: yaml.load($X)
|
|
145
|
+
metadata:
|
|
146
|
+
cwe: "CWE-502: Deserialization of Untrusted Data"
|
|
147
|
+
category: deserialization
|
|
148
|
+
|
|
149
|
+
- id: go-sql-string-concat
|
|
150
|
+
languages: [go]
|
|
151
|
+
severity: ERROR
|
|
152
|
+
message: >-
|
|
153
|
+
A SQL query is built with fmt.Sprintf or concatenation and passed to the
|
|
154
|
+
database. Use placeholders.
|
|
155
|
+
patterns:
|
|
156
|
+
- pattern-either:
|
|
157
|
+
- pattern: $DB.Query(fmt.Sprintf(...), ...)
|
|
158
|
+
- pattern: $DB.Exec(fmt.Sprintf(...), ...)
|
|
159
|
+
- pattern: $DB.QueryRow(fmt.Sprintf(...), ...)
|
|
160
|
+
- pattern: $DB.Query($A + $B, ...)
|
|
161
|
+
- pattern: $DB.Exec($A + $B, ...)
|
|
162
|
+
metadata:
|
|
163
|
+
cwe: "CWE-89: Improper Neutralization of Special Elements used in an SQL Command"
|
|
164
|
+
category: injection
|
|
165
|
+
|
|
166
|
+
- id: go-exec-command-shell
|
|
167
|
+
languages: [go]
|
|
168
|
+
severity: WARNING
|
|
169
|
+
message: >-
|
|
170
|
+
A shell is invoked with -c and a command that is not a constant.
|
|
171
|
+
patterns:
|
|
172
|
+
- pattern-either:
|
|
173
|
+
- pattern: exec.Command("sh", "-c", $CMD, ...)
|
|
174
|
+
- pattern: exec.Command("bash", "-c", $CMD, ...)
|
|
175
|
+
- pattern-not: exec.Command("...", "-c", "...", ...)
|
|
176
|
+
metadata:
|
|
177
|
+
cwe: "CWE-78: Improper Neutralization of Special Elements used in an OS Command"
|
|
178
|
+
category: injection
|