-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathslack.py
More file actions
712 lines (593 loc) · 29.5 KB
/
slack.py
File metadata and controls
712 lines (593 loc) · 29.5 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
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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
import logging
import os
import requests
from socketsecurity.config import CliConfig
from .base import Plugin
from socketsecurity.core.classes import Diff
from socketsecurity.core.messages import Messages
from socketsecurity.core.helper.socket_facts_loader import (
load_socket_facts,
get_components_with_vulnerabilities,
convert_to_alerts
)
from socketsecurity.plugins.formatters.slack import format_socket_facts_for_slack
logger = logging.getLogger(__name__)
class SlackPlugin(Plugin):
@staticmethod
def get_name():
return "slack"
def send(self, diff, config: CliConfig):
# Check mode and route to appropriate handler
mode = self.config.get("mode", "webhook")
if mode == "webhook":
self._send_webhook_alerts(diff, config)
elif mode == "bot":
self._send_bot_alerts(diff, config)
else:
logger.error(f"Invalid Slack mode '{mode}'. Valid modes are 'webhook' or 'bot'.")
return
def _send_webhook_alerts(self, diff, config: CliConfig):
"""Send alerts using webhook mode."""
if not self.config.get("url"):
logger.warning("Slack webhook URL not configured.")
if config.enable_debug:
logger.debug("Slack webhook URL is missing from configuration")
return
# Normalize URL configuration to list of dicts
url_configs = self._normalize_url_config(self.config.get("url"))
if not url_configs:
logger.warning("No valid Slack webhook URLs configured.")
return
logger.debug("Slack Plugin Enabled (webhook mode)")
logger.debug("Alert levels: %s", self.config.get("levels"))
# Get url_configs parameter (filtering configuration)
webhook_configs = self.config.get("url_configs", {})
# Validate that all URLs have corresponding configs
valid_webhooks = []
for url_config in url_configs:
name = url_config["name"]
if name not in webhook_configs:
logger.warning(f"No url_configs entry found for webhook '{name}'. This webhook will be disabled.")
continue
valid_webhooks.append(url_config)
if not valid_webhooks:
logger.warning("No valid Slack webhooks with configurations. All webhooks disabled.")
return
# Get repo name from config
repo_name = config.repo or ""
# Handle reachability data if --reach is enabled
if config.reach:
self._send_reachability_alerts(valid_webhooks, webhook_configs, repo_name, config, diff)
# Handle diff alerts (if any)
if not diff.new_alerts:
logger.debug("No new diff alerts to notify via Slack.")
else:
# Send to each configured webhook with filtering
for url_config in valid_webhooks:
url = url_config["url"]
name = url_config["name"]
webhook_config = webhook_configs[name]
# Filter alerts based on webhook config
# When --reach is used, reachability_alerts_only applies to diff alerts
filtered_alerts = self._filter_alerts(
diff.new_alerts,
webhook_config,
repo_name,
config,
is_reachability_data=False,
apply_reachability_only_filter=config.reach
)
if not filtered_alerts:
logger.debug(f"No diff alerts match filter criteria for webhook '{name}'. Skipping.")
continue
# Create a temporary diff object with filtered alerts for message creation
filtered_diff = Diff(
new_alerts=filtered_alerts,
diff_url=getattr(diff, "diff_url", ""),
new_packages=getattr(diff, "new_packages", []),
removed_packages=getattr(diff, "removed_packages", []),
packages=getattr(diff, "packages", {})
)
message = self.create_slack_blocks_from_diff(filtered_diff, config)
logger.debug(f"Sending diff alerts message to {name} ({url})")
if config.enable_debug:
logger.debug(f"Slack webhook URL: {url}")
logger.debug(f"Slack webhook name: {name}")
logger.debug(f"Total diff alerts: {len(diff.new_alerts)}, Filtered alerts: {len(filtered_alerts)}")
logger.debug(f"Message blocks count: {len(message)}")
response = requests.post(
url,
json={"blocks": message}
)
if response.status_code >= 400:
logger.error("Slack error for %s: %s - %s", name, response.status_code, response.text)
elif config.enable_debug:
logger.debug(f"Slack webhook response for {name}: {response.status_code}")
def _send_bot_alerts(self, diff, config: CliConfig):
"""Send alerts using bot mode with Slack API."""
# Get bot token from environment
bot_token = os.getenv("SOCKET_SLACK_BOT_TOKEN")
if not bot_token:
logger.error("SOCKET_SLACK_BOT_TOKEN environment variable not set for bot mode.")
return
if not bot_token.startswith("xoxb-"):
logger.error("SOCKET_SLACK_BOT_TOKEN must start with 'xoxb-' (Bot User OAuth Token).")
return
# Get bot_configs from configuration
bot_configs = self.config.get("bot_configs", [])
if not bot_configs:
logger.warning("No bot_configs configured for bot mode.")
return
logger.debug("Slack Plugin Enabled (bot mode)")
logger.debug("Alert levels: %s", self.config.get("levels"))
logger.debug(f"Number of bot_configs: {len(bot_configs)}")
logger.debug(f"config.reach: {config.reach}")
logger.debug(f"len(diff.new_alerts): {len(diff.new_alerts) if diff.new_alerts else 0}")
# Get repo name from config
repo_name = config.repo or ""
# Handle reachability data if --reach is enabled
if config.reach:
self._send_bot_reachability_alerts(bot_configs, bot_token, repo_name, config, diff)
# Handle diff alerts (if any)
if not diff.new_alerts:
logger.debug("No new diff alerts to notify via Slack.")
else:
# Send to each configured bot_config with filtering
for bot_config in bot_configs:
name = bot_config.get("name", "unnamed")
channels = bot_config.get("channels", [])
if not channels:
logger.warning(f"No channels configured for bot_config '{name}'. Skipping.")
continue
# Filter alerts based on bot config
# When --reach is used, reachability_alerts_only applies to diff alerts
filtered_alerts = self._filter_alerts(
diff.new_alerts,
bot_config,
repo_name,
config,
is_reachability_data=False,
apply_reachability_only_filter=config.reach
)
if not filtered_alerts:
logger.debug(f"No diff alerts match filter criteria for bot_config '{name}'. Skipping.")
continue
# Create a temporary diff object with filtered alerts for message creation
filtered_diff = Diff(
new_alerts=filtered_alerts,
diff_url=getattr(diff, "diff_url", ""),
new_packages=getattr(diff, "new_packages", []),
removed_packages=getattr(diff, "removed_packages", []),
packages=getattr(diff, "packages", {})
)
message = self.create_slack_blocks_from_diff(filtered_diff, config)
if config.enable_debug:
logger.debug(f"Bot config '{name}': Total diff alerts: {len(diff.new_alerts)}, Filtered alerts: {len(filtered_alerts)}")
logger.debug(f"Message blocks count: {len(message)}")
# Send to each channel in the bot_config
for channel in channels:
logger.debug(f"Sending diff alerts message to channel '{channel}' (bot_config: {name})")
self._post_to_slack_api(bot_token, channel, message, config, name)
def _send_bot_reachability_alerts(self, bot_configs: list, bot_token: str, repo_name: str, config: CliConfig, diff=None):
"""Send reachability alerts using bot mode with Slack API."""
# Construct path to socket facts file
facts_file_path = os.path.join(config.target_path or ".", f"{config.reach_output_file}")
logger.debug(f"Loading reachability data from {facts_file_path}")
# Load socket facts file
facts_data = load_socket_facts(facts_file_path)
if not facts_data:
logger.debug("No .socket.facts.json file found or failed to load")
return
# Get components with vulnerabilities
components_with_vulns = get_components_with_vulnerabilities(facts_data)
if not components_with_vulns:
logger.debug("No components with vulnerabilities found in .socket.facts.json")
return
# Convert to alerts format
components_with_alerts = convert_to_alerts(components_with_vulns)
if not components_with_alerts:
logger.debug("No alerts generated from .socket.facts.json")
return
logger.debug(f"Found {len(components_with_alerts)} components with reachability alerts")
# Send to each configured bot_config with filtering
for bot_config in bot_configs:
name = bot_config.get("name", "unnamed")
channels = bot_config.get("channels", [])
if not channels:
logger.warning(f"No channels configured for bot_config '{name}'. Skipping.")
continue
# Filter components based on severities only (for reachability data)
filtered_components = []
for component in components_with_alerts:
component_alerts = component.get('alerts', [])
# Filter alerts using only severities
filtered_component_alerts = self._filter_alerts(
component_alerts,
bot_config,
repo_name,
config,
is_reachability_data=True
)
if filtered_component_alerts:
# Create a copy of component with only filtered alerts
filtered_component = component.copy()
filtered_component['alerts'] = filtered_component_alerts
filtered_components.append(filtered_component)
if not filtered_components:
logger.debug(f"No reachability alerts match filter criteria for bot_config '{name}'. Skipping.")
continue
# Format for Slack using the formatter (max 45 blocks for findings + 5 for header/footer)
slack_notifications = format_socket_facts_for_slack(
filtered_components,
max_blocks=45,
include_traces=True
)
# Convert to Slack blocks format and send
for notification in slack_notifications:
blocks = self._create_reachability_slack_blocks_from_structured(
notification,
config,
diff
)
if config.enable_debug:
logger.debug(f"Bot config '{name}': Reachability components: {len(filtered_components)}")
logger.debug(f"Message blocks count: {len(blocks)}")
# Send to each channel in the bot_config
for channel in channels:
logger.debug(f"Sending reachability alerts message to channel '{channel}' (bot_config: {name})")
self._post_to_slack_api(bot_token, channel, blocks, config, name)
def _post_to_slack_api(self, bot_token: str, channel: str, blocks: list, config: CliConfig, config_name: str = None):
"""Post message to Slack using chat.postMessage API.
Args:
bot_token: Slack bot token (starts with xoxb-)
channel: Channel name (without #) or channel ID (C1234567890)
blocks: List of Slack blocks to send
config: CliConfig object for debug logging
config_name: Name of the bot_config for logging
Returns:
Response dict from Slack API
"""
url = "https://slack.com/api/chat.postMessage"
headers = {
"Authorization": f"Bearer {bot_token}",
"Content-Type": "application/json"
}
payload = {
"channel": channel,
"blocks": blocks
}
try:
response = requests.post(url, headers=headers, json=payload)
response_data = response.json()
# Slack returns 200 even on errors, check response JSON
if not response_data.get("ok", False):
error_msg = response_data.get("error", "unknown error")
logger.error(f"Slack API error for channel '{channel}': {error_msg}")
if config.enable_debug:
logger.debug(f"Full response: {response_data}")
elif config.enable_debug:
logger.debug(f"Successfully posted to channel '{channel}' (config: {config_name})")
return response_data
except Exception as e:
logger.error(f"Exception posting to Slack channel '{channel}': {str(e)}")
return {"ok": False, "error": str(e)}
def _filter_alerts(
self,
alerts: list,
webhook_config: dict,
repo_name: str,
config: CliConfig,
is_reachability_data: bool = False,
apply_reachability_only_filter: bool = False
) -> list:
"""
Filter alerts based on webhook configuration.
Empty lists or missing keys mean no filtering for that criteria:
- repos: [] or missing → all repos allowed
- alert_types: [] or missing → no alert_type filtering
- severities: [] or missing → no severity filtering
- reachability_alerts_only: missing → defaults to False
Args:
alerts: List of Issue objects to filter
webhook_config: Config dict with optional keys: repos, alert_types, severities, reachability_alerts_only
repo_name: Current repository name from config
config: CliConfig object
is_reachability_data: If True, only apply severities filter (for .socket.facts.json data)
apply_reachability_only_filter: If True, apply reachability_alerts_only filter (only when --reach is used)
Returns:
Filtered list of alerts matching the criteria
"""
filtered = []
# Extract filter configs (empty list/False means no filtering)
repos_filter = webhook_config.get("repos", [])
alert_types = webhook_config.get("alert_types", [])
severities = webhook_config.get("severities", [])
reachability_only = webhook_config.get("reachability_alerts_only", False)
if config.enable_debug:
logger.debug(f"Filtering {'reachability' if is_reachability_data else 'diff'} alerts with: "
f"repos={repos_filter}, alert_types={alert_types}, "
f"severities={severities}, reachability_only={reachability_only}, "
f"apply_reachability_only={apply_reachability_only_filter}")
for alert in alerts:
# For reachability data, only apply severities filter
if is_reachability_data:
# Filter by severities only (empty list = all severities allowed)
if severities:
alert_severity = getattr(alert, "severity", "")
if alert_severity not in severities:
continue
filtered.append(alert)
continue
# For diff alerts, apply all filters
# Filter by repos (empty list = all repos allowed)
if repos_filter and repo_name not in repos_filter:
continue
# Filter by reachability_alerts_only (only when --reach is used)
if apply_reachability_only_filter and reachability_only:
# Only include alerts that have error=True (blocking issues)
if not getattr(alert, "error", False):
continue
# Filter by alert_types (overrides severity, empty list = no filtering)
if alert_types:
alert_type = getattr(alert, "type", "")
if alert_type not in alert_types:
continue
else:
# Only apply severity filter if alert_types is not specified
# Empty severities list = all severities allowed
if severities:
alert_severity = getattr(alert, "severity", "")
if alert_severity not in severities:
continue
filtered.append(alert)
return filtered
def _send_reachability_alerts(self, valid_webhooks: list, webhook_configs: dict, repo_name: str, config: CliConfig, diff=None):
"""
Load and send reachability alerts from .socket.facts.json file.
Args:
valid_webhooks: List of validated webhook configurations
webhook_configs: Dictionary of webhook configurations with filters
repo_name: Current repository name
config: CliConfig object
diff: Diff object containing diff_url for report link
"""
# Construct path to socket facts file
import os as os_module
facts_file_path = os_module.path.join(config.target_path or ".", config.reach_output_file)
logger.debug(f"Loading reachability data from {facts_file_path}")
# Load socket facts file
facts_data = load_socket_facts(facts_file_path)
if not facts_data:
logger.debug("No .socket.facts.json file found or failed to load")
return
# Get components with vulnerabilities
components_with_vulns = get_components_with_vulnerabilities(facts_data)
if not components_with_vulns:
logger.debug("No components with vulnerabilities found in .socket.facts.json")
return
# Convert to alerts format
components_with_alerts = convert_to_alerts(components_with_vulns)
if not components_with_alerts:
logger.debug("No alerts generated from .socket.facts.json")
return
logger.debug(f"Found {len(components_with_alerts)} components with reachability alerts")
# Send to each configured webhook with filtering
for url_config in valid_webhooks:
url = url_config["url"]
name = url_config["name"]
webhook_config = webhook_configs[name]
# Filter components based on severities only (for reachability data)
filtered_components = []
for component in components_with_alerts:
component_alerts = component.get('alerts', [])
# Filter alerts using only severities
filtered_component_alerts = self._filter_alerts(
component_alerts,
webhook_config,
repo_name,
config,
is_reachability_data=True
)
if filtered_component_alerts:
# Create a copy of component with only filtered alerts
filtered_component = component.copy()
filtered_component['alerts'] = filtered_component_alerts
filtered_components.append(filtered_component)
if not filtered_components:
logger.debug(f"No reachability alerts match filter criteria for webhook '{name}'. Skipping.")
continue
# Format for Slack using the formatter (max 45 blocks for findings + 5 for header/footer)
slack_notifications = format_socket_facts_for_slack(
filtered_components,
max_blocks=45,
include_traces=True
)
# Convert to Slack blocks format
for notification in slack_notifications:
blocks = self._create_reachability_slack_blocks_from_structured(
notification,
config,
diff
)
logger.debug(f"Sending reachability alerts message to {name} ({url})")
if config.enable_debug:
logger.debug(f"Slack webhook URL: {url}")
logger.debug(f"Slack webhook name: {name}")
logger.debug(f"Reachability components: {len(filtered_components)}")
logger.debug(f"Message blocks count: {len(blocks)}")
response = requests.post(
url,
json={"blocks": blocks}
)
if response.status_code >= 400:
logger.error("Slack error for %s: %s - %s", name, response.status_code, response.text)
elif config.enable_debug:
logger.debug(f"Slack webhook response for {name}: {response.status_code}")
def _create_reachability_slack_blocks_from_structured(self, notification: dict, config: CliConfig, diff=None) -> list:
"""
Create Slack blocks from structured reachability notification data.
Respects Slack's 50 block limit by prioritizing critical findings.
Args:
notification: Structured notification dict from format_socket_facts_for_slack
config: CliConfig object
diff: Diff object containing diff_url for report link
Returns:
List of Slack block dictionaries (max 50 blocks)
"""
pr = getattr(config, "pr_number", None)
sha = getattr(config, "commit_sha", None)
diff_url = getattr(diff, "diff_url", "") if diff else ""
title_part = ""
if pr:
title_part += f" for PR {pr}"
if sha:
title_part += f" - {sha[:8]}"
# Header blocks (2 blocks)
blocks = [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"*{notification['title']}*{title_part}"
}
},
{"type": "divider"}
]
# Summary block (2 blocks)
blocks.append({
"type": "section",
"text": {
"type": "mrkdwn",
"text": notification['summary']
}
})
blocks.append({"type": "divider"})
# Vulnerability blocks (1 block per vulnerability, max ~45)
include_traces = notification.get('include_traces', True)
for vuln in notification.get('vulnerabilities', []):
finding = vuln['finding']
reachability = vuln['reachability']
# Reachability indicator
reach_indicator = {
'reachable': '🎯 *Reachable*',
'unreachable': '✓ *Unreachable*',
'unknown': '❓ *Unknown*',
'error': '⚠️ *Error*'
}.get(reachability, '')
# Build vulnerability text
vuln_text = f"*Package:* `{vuln['purl']}`\n\n{reach_indicator}\n"
vuln_text += f"{finding['severity_emoji']} *{finding['cve_id']}*: {finding['severity'].upper()}"
# Add trace if enabled and available
if include_traces and reachability == 'reachable' and finding.get('trace'):
# Format trace lines with indentation
trace_lines = finding['trace'].split('\n')
trace_text = '\n'.join(f" {line}" for line in trace_lines if line.strip())
if trace_text:
vuln_text += f"\n```\n{trace_text}\n```"
blocks.append({
"type": "section",
"text": {
"type": "mrkdwn",
"text": vuln_text
}
})
blocks.append({"type": "divider"})
# Footer with omission notice and link (1-2 blocks)
omitted_count = notification.get('omitted_count', 0)
if omitted_count > 0:
omitted_unreachable = notification.get('omitted_unreachable', 0)
omitted_low = notification.get('omitted_low', 0)
footer_parts = []
if omitted_unreachable > 0:
footer_parts.append(f"{omitted_unreachable} unreachable")
if omitted_low > 0:
footer_parts.append(f"{omitted_low} low severity")
omission_text = f"⚠️ *{omitted_count} findings not shown*"
if footer_parts:
omission_text += f" ({', '.join(footer_parts)})"
blocks.append({
"type": "section",
"text": {
"type": "mrkdwn",
"text": omission_text
}
})
# Add link to full report if available
if diff_url:
blocks.append({
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"<{diff_url}|View full report >"
}
})
return blocks
def _normalize_url_config(self, url_input):
"""
Normalize URL configuration to a consistent list of dicts format.
Args:
url_input: Can be:
- string: "https://webhook.url"
- list of strings: ["https://webhook1.url", "https://webhook2.url"]
- list of dicts: [{"url": "https://webhook.url", "name": "unique_name"}]
Returns:
List of dicts with 'url' and 'name' keys
"""
if isinstance(url_input, str):
return [{"url": url_input, "name": "default"}]
if isinstance(url_input, list):
normalized = []
for idx, item in enumerate(url_input):
if isinstance(item, str):
normalized.append({"url": item, "name": f"webhook_{idx}"})
elif isinstance(item, dict):
if "url" not in item:
logger.warning(f"URL config item missing 'url' key: {item}")
continue
name = item.get("name", f"webhook_{idx}")
normalized.append({"url": item["url"], "name": name})
else:
logger.warning(f"Invalid URL config item type: {type(item)}")
return normalized
logger.warning(f"Invalid URL config type: {type(url_input)}")
return []
@staticmethod
def create_slack_blocks_from_diff(diff: Diff, config: CliConfig):
pr = getattr(config, "pr_number", None)
sha = getattr(config, "commit_sha", None)
scan_link = getattr(diff, "diff_url", "")
scan = f"<{scan_link}|scan>"
title_part = ""
if pr:
title_part += f" for PR {pr}"
if sha:
title_part += f" - {sha[:8]}"
blocks = [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"*Socket Security issues were found in this *{scan}*{title_part}*"
}
},
{"type": "divider"}
]
for alert in diff.new_alerts:
manifest_str, source_str = Messages.create_sources(alert, "plain")
manifest_str = manifest_str.lstrip("• ")
source_str = source_str.lstrip("• ")
blocks.append({
"type": "section",
"text": {
"type": "mrkdwn",
"text": (
f"*{alert.title}*\n"
f"<{alert.url}|{alert.purl}>\n"
f"*Introduced by:* `{source_str}`\n"
f"*Manifest:* `{manifest_str}`\n"
f"*CI Status:* {'Block' if alert.error else 'Warn'}"
)
}
})
blocks.append({"type": "divider"})
return blocks