-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathschema.json
More file actions
432 lines (432 loc) · 16.8 KB
/
Copy pathschema.json
File metadata and controls
432 lines (432 loc) · 16.8 KB
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
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/grafana/sigma-rule-deployment",
"title": "Sigma Rule Deployment Configuration v1.0.0 (2025-09-10)",
"description": "Configuration schema for sigma rule conversion, integration, and deployment",
"type": "object",
"required": [
"folders"
],
"properties": {
"folders": {
"type": "object",
"description": "Paths for conversion and deployment outputs",
"required": [
"conversion_path",
"deployment_path"
],
"properties": {
"conversion_path": {
"type": "string",
"description": "Path where converted rules will be stored",
"examples": [
"./conversions"
]
},
"deployment_path": {
"type": "string",
"description": "Path where deployment configurations will be stored",
"examples": [
"./deployments"
]
}
},
"additionalProperties": false
},
"conversion_defaults": {
"$ref": "#/$defs/conversionConfigBase",
"description": "Default settings applied to all conversions unless overridden by conversions"
},
"conversions": {
"type": "array",
"description": "List of rule conversion configurations",
"minItems": 1,
"items": {
"$ref": "#/$defs/conversionConfigBase",
"required": [
"name",
"input"
],
"properties": {
"name": {
"type": "string",
"description": "Unique identifier for this conversion configuration",
"pattern": "^[a-zA-Z0-9_-]+$",
"examples": [
"aws_cloudtrail",
"github_audit",
"okta_audit"
]
},
"input": {
"anyOf": [
{
"type": "string",
"description": "Single input path pattern for sigma rules, relative to the root of the repository"
},
{
"type": "array",
"description": "Multiple input path patterns for sigma rules, relative to the root of the repository",
"items": {
"type": "string"
},
"minItems": 1
}
],
"examples": [
"rules-development/cloud/aws/cloudtrail/*",
[
"rules-private/grafana/grafana-com/file1.yml",
"rules-correlation/grafana/grafana-com/file2.yml"
]
]
},
"rule_group": {
"type": "string",
"description": "Name of the alert rule group in Grafana",
"examples": [
"Every 5 Minutes",
"Every 1 Hour",
"Every 6 Hours"
]
},
"time_window": {
"$ref": "#/$defs/timeWindow",
"description": "Time window for alert evaluation",
"examples": [
"5m",
"1h",
"6h",
"30m"
]
},
"lookback": {
"$ref": "#/$defs/lookback",
"description": "Lookback period to account for log delays. Adjusts the alert query time range backwards by this duration",
"examples": [
"1m",
"2m",
"10m",
"1h"
]
}
}
}
},
"integration": {
"type": "object",
"description": "Settings for integrating with Grafana",
"required": [
"folder_id",
"org_id"
],
"properties": {
"folder_id": {
"$ref": "#/$defs/grafanaId",
"description": "Grafana folder ID where alerts will be created",
"examples": [
"my48wfae9ojcgw",
"XXXX"
]
},
"org_id": {
"type": "integer",
"description": "Grafana organization ID",
"minimum": 1,
"examples": [
1
]
},
"test_queries": {
"type": "boolean",
"description": "Whether to test queries against the datasource before deployment",
"default": true
},
"from": {
"type": "string",
"description": "Start time for query testing",
"pattern": "^now(-[0-9]+[smhd])?$",
"default": "now-1h",
"examples": [
"now-1h",
"now-24h"
]
},
"to": {
"type": "string",
"description": "End time for query testing",
"pattern": "^now(-[0-9]+[smhd])?$",
"default": "now",
"examples": [
"now"
]
},
"show_log_lines": {
"type": "boolean",
"description": "Whether to include log line content in query test results",
"default": false
},
"show_sample_values": {
"type": "boolean",
"description": "Whether to include sample label values in query test results",
"default": false
},
"template_annotations": {
"type": "object",
"description": "Annotations to add to the alert rule, using text/tempate format strings",
"additionalProperties": {"type": "string"}
},
"template_labels": {
"type": "object",
"description": "Labels to add to the alert rule, using text/tempate format strings",
"additionalProperties": {"type": "string"}
},
"template_all_rules": {
"type": "boolean",
"description": "Whether to use all the rules in a Sigma rule file for templated annotations and labels, or just the first rule",
"default": false
}
},
"additionalProperties": false
},
"deployment": {
"type": "object",
"description": "Deployment configuration settings",
"required": [
"grafana_instance"
],
"properties": {
"grafana_instance": {
"$ref": "#/$defs/urlPattern",
"description": "URL of the target Grafana instance",
"examples": [
"https://myinstance.grafana.com"
]
},
"timeout": {
"$ref": "#/$defs/timeWindow",
"description": "HTTP request timeout for testing queries",
"default": "10s",
"examples": [
"10s",
"30s",
"1m"
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"$defs": {
"timeWindow": {
"type": "string",
"pattern": "^[0-9]+[smhd]$",
"description": "Time duration with units (s=seconds, m=minutes, h=hours, d=days)"
},
"urlPattern": {
"type": "string",
"format": "uri",
"pattern": "^http[s]?://",
"description": "HTTP or HTTPS URL pattern"
},
"grafanaId": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]+$",
"description": "Grafana identifier pattern"
},
"backendType": {
"type": "string",
"description": "Supported Sigma backend types for rule conversion. Based on available pySigma backends from https://sigmahq.io/docs/digging-deeper/backends.html"
},
"conversionConfigBase": {
"type": "object",
"description": "Base configuration properties shared between conversion defaults and individual conversions",
"properties": {
"target": {
"$ref": "#/$defs/backendType",
"description": "Target backend for rule conversion"
},
"format": {
"type": "string",
"description": "Output format for converted rules",
"examples": [
"default",
"json",
"yaml"
]
},
"skip_unsupported": {
"type": "boolean",
"description": "Skip conversion of rules that can't be handled by the backend"
},
"file_pattern": {
"type": "string",
"description": "File pattern to match when processing rules",
"pattern": "^\\*\\.[a-zA-Z0-9]+$",
"examples": [
"*.yml",
"*.yaml"
]
},
"data_source": {
"type": "string",
"description": "Grafana data source identifier"
},
"fail_unsupported": {
"type": "boolean",
"description": "Whether to fail on unsupported rule features during conversion"
},
"encoding": {
"type": "string",
"description": "Output encoding for string backend outputs. This is ignored for backends that return binary output.",
"enum": [
"utf-8",
"utf-16",
"ascii",
"latin1"
]
},
"pipeline_check": {
"type": "boolean",
"description": "Whether to validate pipeline configurations"
},
"correlation_method": {
"type": "string",
"description": "Select method for generation of correlation queries. If not given the default method of the backend is used",
"examples": [
"default"
]
},
"filters": {
"type": "array",
"description": "Filters to apply during conversion",
"items": {
"type": "string"
}
},
"backend_options": {
"type": "object",
"description": "Backend-specific options for rule conversion",
"properties": {
"case_sensitive": {
"type": "boolean",
"description": "Whether string matching should be case sensitive"
},
"add_line_filters": {
"type": "boolean",
"description": "Whether to add line-based filtering to queries"
}
},
"additionalProperties": {
"type": [
"string",
"number",
"boolean",
"array",
"object"
]
}
},
"without_pipeline": {
"type": "boolean",
"description": "Proceed with conversion without processing pipeline, even if it is mandatory for the target."
},
"pipelines": {
"type": "array",
"description": "Processing pipelines to apply during conversion",
"items": {
"type": "string",
"description": "Name of the pipeline or path to pipeline configuration file, relative to the root of the repository"
}
},
"json_indent": {
"type": "integer",
"description": "JSON indentation for output formatting",
"minimum": 0,
"examples": [
0,
2,
4
]
},
"verbose": {
"type": "boolean",
"description": "Enable verbose output"
},
"data_source_type": {
"$ref": "#/$defs/backendType",
"description": "Data source type for conversions"
},
"query_model": {
"type": "string",
"description": "Custom sprintf format string for query model (refID, datasource, query)",
"examples": [
"{\"refId\":\"%s\",\"datasource\":{\"type\":\"loki\",\"uid\":\"%s\"},\"query\":\"%s\"}"
]
},
"required_rule_fields": {
"type": "array",
"description": "A list of the Sigma rule fields to include in the converter output files",
"items": {
"type": "string",
"examples": [
"title",
"description",
"logsource",
"detection",
"fields",
"falsepositives"
]
}
}
}
},
"lookback": {
"type": "string",
"description": "The period to lookback for data, accounts for ingestion delay in some log sources"
}
},
"examples": [
{
"folders": {
"conversion_path": "./conversions",
"deployment_path": "./deployments"
},
"conversion_defaults": {
"target": "loki",
"format": "default",
"skip_unsupported": true,
"file_pattern": "*.yml",
"data_source": "loki-logs"
},
"conversions": [
{
"name": "aws_cloudtrail",
"input": "rules-development/cloud/aws/cloudtrail/*",
"backend_options": {
"case_sensitive": true
},
"pipelines": [
"pipelines/cloud/aws/cloudtrail/filter_permitted_aws_accounts.yml",
"pipelines/datasources/aws_cloudtrail.yml"
],
"rule_group": "Every 5 Minutes",
"time_window": "5m",
"lookback": "2m"
}
],
"integration": {
"folder_id": "my48wfae9ojcgw",
"org_id": 1,
"test_queries": true,
"from": "now-1h",
"to": "now"
},
"deployment": {
"grafana_instance": "https://myinstance.grafana.com",
"timeout": "10s"
}
}
]
}