forked from beenuar/AiSOC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaybook.schema.json
More file actions
249 lines (244 loc) · 7.65 KB
/
Copy pathplaybook.schema.json
File metadata and controls
249 lines (244 loc) · 7.65 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
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/beenuar/aisoc/blob/main/playbook.schema.json",
"title": "AiSOC Playbook",
"description": "JSON Schema 2020-12 for AiSOC playbook definitions (Pillar 2, v4.0). Portable across file format (YAML / JSON) and CI-lintable.",
"type": "object",
"required": ["id", "name", "version", "trigger", "steps"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-]{2,62}$",
"description": "Stable, globally-unique kebab-case identifier."
},
"name": { "type": "string", "minLength": 3, "maxLength": 120 },
"description": { "type": "string", "maxLength": 1000 },
"version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+$",
"description": "Semantic version string."
},
"author": { "type": "string" },
"tags": {
"type": "array",
"items": { "type": "string", "pattern": "^[a-z0-9-]+$" },
"uniqueItems": true
},
"enabled": { "type": "boolean", "default": true },
"trigger": {
"type": "object",
"required": ["on"],
"additionalProperties": false,
"properties": {
"on": {
"type": "string",
"enum": ["alert", "case", "schedule", "manual", "webhook"]
},
"severity": {
"type": "array",
"items": { "type": "string", "enum": ["info", "low", "medium", "high", "critical"] }
},
"alert_types": { "type": "array", "items": { "type": "string" } },
"cron": {
"type": "string",
"description": "Cron expression; only valid when on=schedule."
},
"filters": {
"type": "object",
"description": "Key/value filters applied to the trigger event.",
"additionalProperties": { "type": "string" }
}
}
},
"steps": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/step" }
},
"on_failure": { "$ref": "#/$defs/failure_policy" },
"timeout_seconds": {
"type": "integer",
"minimum": 1,
"maximum": 86400,
"default": 3600
},
"metadata": {
"type": "object",
"description": "Arbitrary key/value metadata; not processed by the engine.",
"additionalProperties": true
}
},
"$defs": {
"step": {
"type": "object",
"required": ["id", "name", "type"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
},
"name": { "type": "string", "minLength": 1, "maxLength": 120 },
"type": {
"type": "string",
"enum": [
"trigger",
"condition",
"action",
"loop",
"parallel",
"human_approval",
"wait",
"notify",
"enrich",
"isolate",
"block",
"close_case",
"create_case",
"run_playbook",
"script"
]
},
"description": { "type": "string" },
"params": {
"type": "object",
"description": "Step-type-specific parameters; validated at runtime.",
"additionalProperties": true
},
"condition": { "$ref": "#/$defs/condition_expr" },
"on_failure": { "$ref": "#/$defs/failure_policy" },
"retry": { "$ref": "#/$defs/retry_policy" },
"timeout_seconds": { "type": "integer", "minimum": 1, "maximum": 3600 },
"depends_on": {
"type": "array",
"items": { "type": "string" },
"description": "Step IDs that must complete before this step starts (DAG edges)."
},
"blast_radius": {
"type": "string",
"enum": ["dry_run", "reversible", "destructive"],
"default": "dry_run",
"description": "Declared impact level; engine enforces analyst approval for destructive steps."
},
"output_key": {
"type": "string",
"description": "Variable name under which this step's output is stored in the run context."
}
}
},
"condition_expr": {
"oneOf": [
{
"type": "object",
"required": ["field", "op", "value"],
"additionalProperties": false,
"properties": {
"field": { "type": "string" },
"op": {
"type": "string",
"enum": ["eq", "ne", "lt", "lte", "gt", "gte", "contains", "startswith", "endswith", "in", "not_in", "exists", "not_exists"]
},
"value": {}
}
},
{
"type": "object",
"required": ["and"],
"additionalProperties": false,
"properties": {
"and": { "type": "array", "items": { "$ref": "#/$defs/condition_expr" }, "minItems": 2 }
}
},
{
"type": "object",
"required": ["or"],
"additionalProperties": false,
"properties": {
"or": { "type": "array", "items": { "$ref": "#/$defs/condition_expr" }, "minItems": 2 }
}
},
{
"type": "object",
"required": ["not"],
"additionalProperties": false,
"properties": {
"not": { "$ref": "#/$defs/condition_expr" }
}
}
]
},
"retry_policy": {
"type": "object",
"additionalProperties": false,
"properties": {
"max_attempts": { "type": "integer", "minimum": 1, "maximum": 10, "default": 3 },
"backoff_seconds": { "type": "number", "minimum": 0, "default": 2 },
"backoff_multiplier": { "type": "number", "minimum": 1, "default": 2 },
"retry_on": {
"type": "array",
"items": { "type": "string" },
"description": "Exception class names that trigger a retry; empty = retry on any error."
}
}
},
"failure_policy": {
"type": "object",
"additionalProperties": false,
"properties": {
"action": {
"type": "string",
"enum": ["abort", "continue", "fallback"],
"default": "abort"
},
"fallback_step": {
"type": "string",
"description": "Step ID to jump to when action=fallback."
},
"notify": {
"type": "object",
"additionalProperties": false,
"properties": {
"channel": { "type": "string" },
"message": { "type": "string" }
}
}
}
}
},
"examples": [
{
"id": "phishing-triage-v1",
"name": "Phishing Email Triage",
"description": "Enrich sender, notify SOC, auto-close low-risk.",
"version": "1.0.0",
"author": "AiSOC Core Team",
"tags": ["phishing", "email", "triage"],
"trigger": { "on": "alert", "severity": ["low", "medium"] },
"steps": [
{
"id": "enrich-ip",
"name": "Enrich sender IP",
"type": "enrich",
"params": { "ioc_type": "ip", "providers": ["virustotal", "greynoise"] },
"blast_radius": "dry_run"
},
{
"id": "notify-soc",
"name": "Notify SOC channel",
"type": "notify",
"params": { "channel": "webhook", "template": "alert_summary" },
"depends_on": ["enrich-ip"]
},
{
"id": "close-if-clean",
"name": "Auto-close clean alerts",
"type": "close_case",
"condition": { "field": "enrich-ip.malicious_score", "op": "lte", "value": 20 },
"depends_on": ["notify-soc"],
"blast_radius": "reversible"
}
]
}
]
}