forked from rhombusgg/rhombus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.json
515 lines (515 loc) · 18.5 KB
/
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
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/product.schema.json",
"title": "Rhombus Configuration",
"description": "Configuration format for the Rhombus CTF platform",
"type": "object",
"properties": {
"title": {
"title": "Title",
"description": "Title of the CTF",
"type": "string",
"examples": ["Rhombus CTF"]
},
"description": {
"title": "Description",
"description": "Description of the CTF",
"type": "string",
"examples": ["A CTF platform built with Rust"]
},
"organizer": {
"title": "Organizer",
"description": "Name of the organizer of the CTF",
"type": "string",
"examples": ["Rhombus"]
},
"location_url": {
"title": "Location URL",
"description": "Base URL where the site is hosted at",
"type": "string",
"pattern": "^https?://.*",
"examples": ["https://demo.rhombus.gg", "http://localhost:3000"]
},
"jwt_secret": {
"title": "JWT Secret",
"description": "Secret (ideally random) value to sign and verify JWTs. Generate with\nopenssl rand -hex 16",
"type": "string",
"examples": ["long_random_value"]
},
"start_time": {
"title": "Start Time",
"description": "Time when the CTF starts. If not set, the CTF is considered to be running",
"type": "string",
"format": "date-time",
"examples": ["2024-01-01T00:00:00Z"]
},
"end_time": {
"title": "End Time",
"description": "Time when the CTF ends",
"type": "string",
"format": "date-time",
"examples": ["2024-01-02T00:00:00Z"]
},
"database_url": {
"title": "Database URL",
"description": "Database connection url. Will automatically detect from scheme",
"type": "string",
"pattern": "^(postgres|file)://.*",
"examples": [
"file://rhombus.db",
"postgres://postgres:password@localhost"
]
},
"default_ticket_template": {
"title": "Default Ticket Template",
"description": "Ticket template to default to for challenges which do not define a custom ticket template",
"type": "string"
},
"live_reload": {
"title": "Live Reload",
"description": "Automatically inject javascript to reload the page on save. Defaults to `true` when compiled in debug mode",
"type": "boolean",
"default": true,
"examples": [false]
},
"immutable_config": {
"title": "Immutable Configuration",
"description": "Allow configuration to be changed at runtime, from the Discord server or Admin dashboard",
"type": "boolean",
"default": false,
"examples": [true]
},
"in_memory_cache": {
"title": "In Memory Cache",
"description": "Cache results from the database in memory for short periods of time to reduce load on database (recommended). false will disable the in memory cache. true will enable the in memory cache with default 360 second interval. Integers above 5 will be the number in seconds that values are considered valid for. Other values are invalid and will disable the in memory cache.",
"type": ["boolean", "number"],
"minimum": 5,
"default": true,
"examples": [false, 120]
},
"ip_preset": {
"title": "IP Preset",
"description": "Choose from a few default ways to extract the client IP address. For more advanced configuration, omit this option and write a custom function in Rust",
"type": "string",
"default": "peer-ip",
"enum": [
"rightmost-x-forwarded-for",
"x-real-ip",
"fly-client-ip",
"true-client-ip",
"cf-connecting-ip",
"peer-ip"
],
"examples": [
"rightmost-x-forwarded-for",
"x-real-ip",
"fly-client-ip",
"true-client-ip",
"cf-connecting-ip",
"peer-ip"
]
},
"auth": {
"title": "Authentication Providers",
"description": "Enable different authentication providers on the signin page. Each option must be further configured in their respective sections.",
"type": "array",
"items": {
"type": "string",
"enum": ["discord", "email", "ctftime", "credentials"]
}
},
"ctftime": {
"client_id": {
"title": "Client ID",
"description": "Client ID for the CTFtime OAuth2 application, also is the ID of the CTF on CTFtime",
"type": "string",
"examples": ["1234"]
},
"client_secret": {
"title": "Client Secret",
"description": "Client Secret for the CTFtime OAuth2 application",
"type": "string",
"examples": [
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
]
}
},
"turso": {
"title": "Turso",
"description": "Configuration for 3rd party database provider https://turso.tech\ndatabase_url must be a libsql:// scheme url for Turso to have an effect",
"type": "object",
"properties": {
"auth_token": {
"title": "Auth Token",
"description": "Authentication token to access the database",
"type": "string",
"pattern": ".+\\..+\\..+"
},
"local_replica_path": {
"title": "Local Replica Path",
"description": "Optional file path to where the local db replica should be stored",
"type": "string",
"examples": ["replica.db"]
}
},
"required": ["auth_token"]
},
"uploads": {
"title": "Upload Provider",
"description": "Choose where to store and serve challenge assets from",
"type": "object",
"properties": {
"local": {
"title": "Local Upload Provider",
"description": "An upload provider which saves and serves from a specified local folder on the filesystem",
"type": "object",
"properties": {
"folder": {
"title": "Folder",
"description": "Destination folder to save and serve challenge assets from",
"type": "string",
"examples": ["uploads"]
}
}
},
"database": {
"title": "Database Upload Provider",
"description": "An upload provider which saves and serves from the currently configured database in blobs",
"type": "boolean"
},
"s3": {
"title": "S3 Upload Provider",
"description": "An upload provider which saves and serves from an S3 bucket",
"type": "object",
"properties": {
"bucket_name": {
"title": "Bucket Name",
"description": "S3 bucket name",
"type": "string",
"examples": ["my-bucket-name"]
},
"bucket_region": {
"title": "Region",
"description": "Region of the S3 bucket (does not have to be AWS)",
"type": "string",
"examples": ["us-east-2"]
},
"access_key": {
"title": "Access Key",
"description": "Access key to authenticate with the S3 bucket",
"type": "string",
"examples": ["xxxxxxxxxxxxxxxxxxxx"]
},
"secret_key": {
"title": "Secret Key",
"description": "Secret key to authenticate with the S3 bucket",
"type": "string",
"examples": ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]
},
"security_token": {
"title": "Security Token",
"description": "Security token to authenticate with the S3 bucket",
"type": "string",
"examples": ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]
},
"session_token": {
"title": "Session Token",
"description": "Session token to authenticate with the S3 bucket",
"type": "string",
"examples": ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]
},
"profile": {
"title": "Profile",
"description": "Profile to use from the AWS credentials file",
"type": "string",
"examples": ["default"]
},
"endpoint": {
"title": "Endpoint",
"description": "Endpoint to connect to the S3 bucket at",
"type": "string",
"examples": ["http://localhost:9000"]
},
"prefix": {
"title": "Path Prefix",
"description": "Prefix to prepend to all keys in the S3 bucket",
"type": "string",
"examples": ["rhombus/"]
},
"path_style": {
"title": "Path Style",
"description": "Use path style addressing for S3 requests",
"type": "boolean",
"examples": [true],
"default": false
},
"presigned_get_expiry": {
"title": "Presigned Get Expiry",
"description": "If set, creates presign GETs for this many seconds. Otherwise will generate the url for the asset assuming it is public for anonymous users",
"type": "integer",
"minimum": 1,
"examples": [3600]
}
}
}
}
},
"ratelimit": {
"title": "Rate limit",
"description": "Configuration related to built in rate limiting",
"type": "object",
"properties": {
"per_millisecond": {
"title": "Per Millisecond",
"description": "Set the interval after which one element of the quota is replenished in milliseconds",
"type": "integer",
"minimum": 1,
"default": 500,
"examples": [500]
},
"burst_size": {
"title": "Burst Size",
"description": "Set quota size that defines how many requests can occur before the governor middleware starts blocking requests from an IP address and clients have to wait until the elements of the quota are replenished",
"type": "integer",
"minimum": 1,
"default": 8,
"examples": [8]
}
}
},
"divisions": {
"title": "Divisions",
"description": "Configuration for the different divisions of the CTF",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "Name of the division",
"type": "string",
"examples": ["Open"]
},
"description": {
"title": "Description",
"description": "Description of the division",
"type": "string",
"examples": ["Open division for everyone"]
},
"email_regex": {
"title": "Email Regex",
"description": "Regular expression to validate email addresses for this division",
"type": "string",
"format": "regex",
"examples": ["^[email protected]$"]
},
"requirement": {
"title": "Requirement",
"description": "Nice error message to show when a user is ineligible to join this division",
"type": "string",
"examples": [
"Must have a verified email from an @example.com domain"
]
},
"max_players": {
"title": "Max Players",
"description": "Maximum number of players allowed in this division",
"type": ["integer", "string"],
"minimum": 1,
"examples": [4, 1, "any"]
}
},
"required": ["name", "description"]
}
},
"email": {
"title": "Email",
"description": "Email configuration properties",
"type": "object",
"properties": {
"from": {
"title": "From",
"description": "Email address to send emails from",
"type": "string",
"examples": ["Rhombus <[email protected]>"]
},
"smtp_connection_url": {
"title": "SMTP Connection URL",
"description": "SMTP Connection URL for the email provider",
"type": "string",
"examples": ["smtps://user:password@localhost"]
},
"mailgun": {
"title": "Mailgun",
"description": "Mailgun configuration as the email provider (both sending and receiving",
"type": "object",
"properties": {
"api_key": {
"title": "API Key",
"description": "API key to authenticate with the Mailgun API",
"type": "string",
"examples": ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxx-xxxxxxxx"]
},
"domain": {
"title": "Domain",
"description": "Domain to send emails from",
"type": "string",
"examples": [
"sandboxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mailgun.org"
]
},
"endpoint": {
"title": "Mailgun API Endpoint",
"description": "Mailgun API endpoint to send emails to. Useful to change to EU servers.",
"type": "string",
"examples": [
"https://api.mailgun.net",
"https://api.eu.mailgun.net"
],
"default": "https://api.mailgun.net"
},
"webhook_signing_key": {
"title": "Webhook Signing Key",
"description": "Key to verify incoming webhooks from Mailgun",
"type": "string",
"examples": ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],
"pattern": "[0-9a-f]{32}"
}
}
},
"imap": {
"title": "IMAP",
"description": "IMAP configuration for the email provider",
"type": "object",
"properties": {
"poll_interval": {
"title": "Poll Interval",
"description": "Interval in seconds to poll the inbox for new emails when IDLE is not supported",
"type": "integer",
"minimum": 1,
"examples": [60]
},
"idle": {
"title": "IDLE",
"description": "Override default auto detection of IDLE command to receive emails in real time",
"type": "boolean",
"examples": [true]
},
"inbox": {
"title": "Inbox",
"description": "Inbox to watch for incoming emails",
"type": "string",
"examples": ["inbox"]
},
"username": {
"title": "Username",
"description": "Username to authenticate with the IMAP server",
"type": "string",
"examples": ["user"]
},
"password": {
"title": "Password",
"description": "Password to authenticate with the IMAP server",
"type": "string",
"examples": ["password"]
},
"domain": {
"title": "Domain",
"description": "Domain to find the IMAP server at",
"type": "string",
"examples": ["example.com"]
},
"port": {
"title": "Port",
"description": "Port to connect to the IMAP server on",
"type": "integer",
"minimum": 1,
"examples": [993]
}
}
}
}
},
"discord": {
"title": "Discord",
"description": "Discord configuration properties",
"type": "object",
"properties": {
"guild_id": {
"title": "Guild ID",
"description": "Snowflake developer discord ID of guild (server) for support",
"type": ["string", "integer"],
"pattern": "^\\d{19}$",
"minimum": 1000000000000000000,
"maximum": 9999999999999999999,
"examples": ["1160610137703186636"]
},
"client_id": {
"title": "Client ID",
"description": "OAuth2 Client ID (discord snowflake)",
"type": ["string", "integer"],
"pattern": "^\\d{19}$",
"minimum": 1000000000000000000,
"maximum": 9999999999999999999,
"examples": ["1160076447977848945"]
},
"client_secret": {
"title": "Client Secret",
"description": "OAuth2 Client Secret",
"type": "string"
},
"bot_token": {
"title": "Bot Token",
"description": "Bot token",
"type": "string",
"pattern": ".+\\..+\\..+"
},
"autojoin": {
"title": "Automatically Join Guild",
"description": "Uses the \"Join servers for you\" OAuth permission to automatically join users to the configured server when they authenticate with Discord.",
"type": "boolean",
"default": true,
"examples": [false]
},
"first_blood_channel_id": {
"title": "First Blood Channel ID",
"description": "Snowflake Discord ID for the channel which first bloods should be sent to",
"type": ["string", "integer"],
"pattern": "^\\d{19}$",
"minimum": 1000000000000000000,
"maximum": 9999999999999999999
},
"support_channel_id": {
"title": "Support Channel ID",
"description": "Snowflake Discord ID for the channel which support threads should be branched off of",
"type": ["string", "integer"],
"pattern": "^\\d{19}$",
"minimum": 1000000000000000000,
"maximum": 9999999999999999999
},
"author_role_id": {
"title": "Author Role ID",
"description": "Snowflake Discord ID for the author role to link authors",
"type": ["string", "integer"],
"pattern": "^\\d{19}$",
"minimum": 1000000000000000000,
"maximum": 9999999999999999999
},
"verified_role_id": {
"title": "Author Role ID",
"description": "Snowflake Discord ID for the verified role to give to users who sign in to the CTF website",
"type": ["string", "integer"],
"pattern": "^\\d{19}$",
"minimum": 1000000000000000000,
"maximum": 9999999999999999999
},
"invite_url": {
"title": "Invite URL",
"description": "URL to invite players to your discord server. Will be automatically created by the bot if not provided",
"type": "string",
"examples": ["https://discord.gg/E2CcvJxq"]
}
}
}
}
}