-
Notifications
You must be signed in to change notification settings - Fork 39
/
ts-defs.schema.json
413 lines (413 loc) · 12.3 KB
/
ts-defs.schema.json
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"BCVE": {
"additionalProperties": false,
"description": "A benchmark CVE.\n\nSee docs/benchmark-CVEs.md for an in-depth explanation of this type.",
"properties": {
"CVE": {
"$ref": "#/definitions/CVEString",
"description": "The CVE identifier."
},
"CWEs": {
"description": "The relevant CWEs for the weaknesses.",
"items": {
"$ref": "#/definitions/CWEString"
},
"type": "array"
},
"postPatch": {
"$ref": "#/definitions/CommitDescription",
"description": "The postPatch commit."
},
"prePatch": {
"$ref": "#/definitions/CommitDescription",
"description": "The prePatch commit.",
"title": "prePatch"
},
"repository": {
"$ref": "#/definitions/RepositoryIdentifier",
"description": "The string that identifies the repository that hosts the commits."
},
"state": {
"$ref": "#/definitions/CVEState",
"description": "The CVE state of the CVE"
}
},
"required": [
"CVE",
"state",
"repository",
"prePatch",
"postPatch"
],
"title": "BCVE",
"type": "object"
},
"BCVEAlert": {
"additionalProperties": false,
"description": "An alert raised by an analysis tool.",
"properties": {
"location": {
"$ref": "#/definitions/SourceLocation",
"description": "The source location of the weakness, relative to the root of the vulnerable project"
},
"ruleID": {
"$ref": "#/definitions/RuleID",
"description": "The ID of the rule that produced this alert."
},
"url": {
"description": "The URL for additional information about this alert.",
"type": "string"
}
},
"required": [
"location",
"ruleID"
],
"title": "BCVEAlert",
"type": "object"
},
"BCVELog": {
"additionalProperties": false,
"description": "A collection of analysis tool runs.",
"properties": {
"runs": {
"description": "The runs.",
"items": {
"$ref": "#/definitions/StandaloneRun"
},
"type": "array"
}
},
"required": [
"runs"
],
"title": "BCVELog",
"type": "object"
},
"BCVEResultStatus": {
"description": "A simple status for a run of an analysis tool.\n\nThe run itself should contain enough information to reproduce the missing details.",
"enum": [
"SUCCESS",
"TIMEOUT",
"CRASH",
"UNSUPPORTED",
"FRAMEWORK_ERROR"
],
"title": "BCVEResultStatus",
"type": "string"
},
"BCVERun": {
"additionalProperties": false,
"description": "A run of an analysis tool on some source code.",
"properties": {
"alerts": {
"description": "The alerts produced by the tool.",
"items": {
"$ref": "#/definitions/BCVEAlert"
},
"type": "array"
},
"reproduction": {
"description": "A command-line string that enables reproduction of the run independent of the benchmarking tooling.",
"type": "string"
},
"status": {
"$ref": "#/definitions/BCVEResultStatus",
"description": "The final status for the run."
},
"toolID": {
"$ref": "#/definitions/ToolID",
"description": "An ID for the tool of the run."
}
},
"required": [
"toolID",
"status"
],
"title": "BCVERun",
"type": "object"
},
"CVEState": {
"description": "The state of a CVE. See https://cve.mitre.org/about/terminology.html#cve_record",
"enum": [
"PUBLISHED",
"DISPUTED",
"REJECTED",
"RESERVED"
],
"title": "CVEState",
"type": "string"
},
"CVEString": {
"type": "string"
},
"CWEString": {
"type": "string"
},
"CommitDescription": {
"additionalProperties": false,
"description": "A description of a commit that is related to a CVE.",
"properties": {
"commit": {
"$ref": "#/definitions/CommitID",
"description": "The commit."
},
"localSourceDirectory": {
"$ref": "#/definitions/Dir",
"description": "The local source directory whe the source code for this commit is located, if any."
},
"runs": {
"description": "A collection of analysis tool runs for this commit, if any.",
"items": {
"$ref": "#/definitions/BCVERun"
},
"type": "array"
},
"weaknesses": {
"description": "The weaknesses related to the CVE of this commit, if any.",
"items": {
"$ref": "#/definitions/Weakness"
},
"type": "array"
}
},
"required": [
"commit"
],
"title": "CommitDescription",
"type": "object"
},
"CommitID": {
"type": "string"
},
"Config": {
"additionalProperties": false,
"description": "A configuration object.",
"properties": {
"bcves": {
"$ref": "#/definitions/Dir",
"description": "The directory where the Benchmark CVEs are located."
},
"canonical-repositories-root": {
"description": "The location where canonical repositories exists for each CVE as `<root>/<CVE>.git`.",
"type": "string"
},
"config-file": {
"$ref": "#/definitions/File",
"description": "The configuration file that defines (some of) these values."
},
"export": {
"$ref": "#/definitions/File",
"description": "The file that is exported to."
},
"reports": {
"$ref": "#/definitions/Dir",
"description": "The directory where the reports are located."
},
"results": {
"$ref": "#/definitions/Dir",
"description": "The directory where the results for the analysis tool runs are located."
},
"sources": {
"$ref": "#/definitions/Dir",
"description": "The directory where the source code for the CVEs are located."
},
"tools": {
"additionalProperties": {
"$ref": "#/definitions/DriverConfig%3Cany%3E",
"description": "The name of the driver, and the associated options."
},
"description": "The configurations of the analysis tool drivers.",
"type": "object"
}
},
"title": "Config",
"type": "object"
},
"Dir": {
"description": "This file contains the types used for persistent data in this project: most notably the CVE benchmark data and analysis results for them.\n\nThis file should not contain types for values that are not going to be persisted.\n\nJSON schemas and associated documentation will be generated from this file, so everything ought to be documented thoroughly.",
"type": "string"
},
"DriverConfig<any>": {
"additionalProperties": false,
"description": "A configuration for how to run an analysis tool driver.",
"properties": {
"args": {
"description": "The leading arguments to execute the `bin` with. These arguments are followed by a single argument with a run-specific input file.",
"items": {
"type": "string"
},
"type": "array"
},
"bin": {
"description": "The binary to execute with the `run` command.",
"type": "string"
},
"options": {
"description": "Additional options for the driver (preferred over a long `args` arrray)."
},
"timeout": {
"description": "The time in milliseconds that the driver will permit the analysis tool to analyze a commit in.",
"type": "number"
}
},
"required": [
"bin",
"args"
],
"title": "DriverConfig",
"type": "object"
},
"DriverInputs": {
"additionalProperties": false,
"description": "The inputs accessible to the drivers that are executed by the `run` command (the inputs are provided as a JSON file, pointed to by the last commandline argument).",
"properties": {
"bcves": {
"description": "The benchmark CVEs to analyze.",
"items": {
"$ref": "#/definitions/BCVE"
},
"type": "array"
},
"config": {
"$ref": "#/definitions/Config",
"description": "The effective configuration used by the Benchmarker."
},
"toolID": {
"$ref": "#/definitions/ToolID",
"description": "The ID of the tool that is being run."
}
},
"required": [
"toolID",
"bcves",
"config"
],
"type": "object"
},
"Export": {
"description": "A collection of exported benchmark CVEs.",
"items": {
"$ref": "#/definitions/BCVE"
},
"title": "Export",
"type": "array"
},
"File": {
"type": "string"
},
"RepositoryIdentifier": {
"type": "string"
},
"RuleID": {
"type": "string"
},
"SourceLocation": {
"additionalProperties": false,
"description": "A source location.",
"properties": {
"file": {
"$ref": "#/definitions/File",
"description": "The path to the file."
},
"line": {
"description": "The line number.",
"type": "number"
}
},
"required": [
"file",
"line"
],
"title": "SourceLocation",
"type": "object"
},
"StandaloneRun": {
"additionalProperties": false,
"description": "A run of an analysis tool on a commit related to a CVE.",
"properties": {
"CVE": {
"$ref": "#/definitions/CVEString",
"description": "The CVE identifier."
},
"alerts": {
"description": "The alerts produced by the tool.",
"items": {
"$ref": "#/definitions/BCVEAlert"
},
"type": "array"
},
"commit": {
"$ref": "#/definitions/CommitID",
"description": "The commit."
},
"reproduction": {
"description": "A command-line string that enables reproduction of the run independent of the benchmarking tooling.",
"type": "string"
},
"status": {
"$ref": "#/definitions/BCVEResultStatus",
"description": "The final status for the run."
},
"toolID": {
"$ref": "#/definitions/ToolID",
"description": "An ID for the tool of the run."
}
},
"required": [
"CVE",
"commit",
"status",
"toolID"
],
"title": "StandaloneRun",
"type": "object"
},
"ToolID": {
"type": "string"
},
"Weakness": {
"additionalProperties": false,
"description": "A weakness in some source code.",
"properties": {
"explanation": {
"description": "An explanation for this weakness.",
"type": "string"
},
"location": {
"additionalProperties": false,
"description": "The source location of the weakness, relative to the root of the vulnerable project",
"properties": {
"file": {
"$ref": "#/definitions/File",
"description": "The path to the file."
},
"implicitExtension": {
"description": "The implicit file extension of `file`, e.g. 'js' or 'sh'",
"type": "string"
},
"line": {
"description": "The line number.",
"type": "number"
}
},
"required": [
"file",
"line"
],
"type": "object"
}
},
"required": [
"location",
"explanation"
],
"title": "Weakness",
"type": "object"
}
},
"$id": "https://github.com/ossf-cve-benchmark/ossf-cve-benchmark/schemas/ts-defs.schema.json",
"title": "Generated schema types from src/persistent-types.ts"
}