Skip to content

Commit 2ce702a

Browse files
Merge branch 'main' into renovate_updates
2 parents 0122b72 + 29d4aeb commit 2ce702a

File tree

150 files changed

+3024
-1548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+3024
-1548
lines changed

detection_rules/cli_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ def _convert_type(_val: Any) -> Any:
9292
)
9393

9494
while True:
95-
result = value or input(prompt) or default
95+
result = value if value is not None else input(prompt) or default
9696
if result == "n/a":
9797
result = None
9898

99-
if not result:
99+
if result is None:
100100
if is_required:
101101
value = None
102102
continue
@@ -318,7 +318,7 @@ def rule_prompt( # noqa: PLR0912, PLR0913, PLR0915
318318
contents[name] = threat_map
319319
continue
320320

321-
if kwargs.get(name):
321+
if name in kwargs:
322322
contents[name] = schema_prompt(name, value=kwargs.pop(name))
323323
continue
324324

detection_rules/etc/api_schemas/master/master.base.json

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@
8383
]
8484
},
8585
"interval": {
86-
"type": [
87-
"string"
88-
]
86+
"pattern": "^\\d+[mshd]$",
87+
"type": "string"
8988
},
9089
"investigation_fields": {
9190
"additionalProperties": false,
9291
"properties": {
9392
"field_names": {
9493
"items": {
94+
"minLength": 1,
9595
"type": "string"
9696
},
9797
"type": "array"
@@ -108,9 +108,8 @@
108108
]
109109
},
110110
"max_signals": {
111-
"type": [
112-
"integer"
113-
]
111+
"minimum": 1,
112+
"type": "integer"
114113
},
115114
"meta": {
116115
"additionalProperties": {
@@ -147,22 +146,11 @@
147146
"items": {
148147
"additionalProperties": false,
149148
"properties": {
150-
"integration": {
151-
"type": [
152-
"string"
153-
]
154-
},
155149
"package": {
156-
"type": "string"
157-
},
158-
"version": {
150+
"minLength": 1,
159151
"type": "string"
160152
}
161153
},
162-
"required": [
163-
"package",
164-
"version"
165-
],
166154
"type": "object"
167155
},
168156
"min_compat": "8.3",
@@ -178,16 +166,12 @@
178166
"type": "boolean"
179167
},
180168
"name": {
181-
"type": "string"
182-
},
183-
"type": {
169+
"minLength": 1,
184170
"type": "string"
185171
}
186172
},
187173
"required": [
188-
"ecs",
189-
"name",
190-
"type"
174+
"ecs"
191175
],
192176
"type": "object"
193177
},
@@ -203,6 +187,8 @@
203187
]
204188
},
205189
"risk_score": {
190+
"maximum": 100,
191+
"minimum": 1,
206192
"type": "integer"
207193
},
208194
"risk_score_mapping": {
@@ -236,6 +222,7 @@
236222
]
237223
},
238224
"rule_id": {
225+
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$|^7eb54028-ca72-4eb7-8185-b6864572347db$",
239226
"type": "string"
240227
},
241228
"rule_name_override": {
@@ -323,13 +310,13 @@
323310
"type": "string"
324311
},
325312
"reference": {
313+
"pattern": "^https://attack.mitre.org/tactics/TA[0-9]+/$",
326314
"type": "string"
327315
}
328316
},
329317
"required": [
330318
"id",
331-
"name",
332-
"reference"
319+
"name"
333320
],
334321
"type": "object"
335322
},
@@ -344,6 +331,7 @@
344331
"type": "string"
345332
},
346333
"reference": {
334+
"pattern": "^https://attack.mitre.org/techniques/T[0-9]+/$",
347335
"type": "string"
348336
},
349337
"subtechnique": {
@@ -357,13 +345,13 @@
357345
"type": "string"
358346
},
359347
"reference": {
348+
"pattern": "^https://attack.mitre.org/techniques/T[0-9]+/[0-9]+/$",
360349
"type": "string"
361350
}
362351
},
363352
"required": [
364353
"id",
365-
"name",
366-
"reference"
354+
"name"
367355
],
368356
"type": "object"
369357
},
@@ -374,8 +362,7 @@
374362
},
375363
"required": [
376364
"id",
377-
"name",
378-
"reference"
365+
"name"
379366
],
380367
"type": "object"
381368
},
@@ -400,14 +387,10 @@
400387
]
401388
},
402389
"timeline_id": {
403-
"type": [
404-
"string"
405-
]
390+
"type": "string"
406391
},
407392
"timeline_title": {
408-
"type": [
409-
"string"
410-
]
393+
"type": "string"
411394
},
412395
"timestamp_override": {
413396
"type": [
@@ -434,17 +417,13 @@
434417
"type": "string"
435418
},
436419
"version": {
437-
"type": [
438-
"integer"
439-
]
420+
"minimum": 1,
421+
"type": "integer"
440422
}
441423
},
442424
"required": [
443425
"author",
444426
"description",
445-
"name",
446-
"risk_score",
447-
"rule_id",
448427
"severity",
449428
"type"
450429
],

0 commit comments

Comments
 (0)