22import logging
33import ssl
44import tempfile
5+ import re
56from datetime import datetime , timedelta
67from itertools import chain
78from typing import Any , Dict , List , Optional , Set
5253ACTION_LINK = "link"
5354SlackBlock = Dict [str , Any ]
5455MAX_BLOCK_CHARS = 3000
56+ MENTION_PATTERN = re .compile (r"<[^>]+>" )
5557
5658
5759class SlackSender :
@@ -410,8 +412,12 @@ def __create_holmes_callback(self, finding: Finding) -> CallbackBlock:
410412 def __create_finding_header (
411413 self , finding : Finding , status : FindingStatus , platform_enabled : bool , include_investigate_link : bool
412414 ) -> MarkdownBlock :
413- title = (finding .title .removeprefix ("[RESOLVED] " )
414- .replace ("<" , "<" ).replace (">" , ">" ))
415+ title = finding .title .removeprefix ("[RESOLVED] " )
416+
417+ match = MENTION_PATTERN .search (title )
418+ mention = f" { match .group (0 )} " if match else ""
419+ title = MENTION_PATTERN .sub ("" , title ).strip ()
420+
415421 sev = finding .severity
416422 if finding .source == FindingSource .PROMETHEUS :
417423 status_name : str = (
@@ -427,7 +433,7 @@ def __create_finding_header(
427433 title = f"<{ finding .get_investigate_uri (self .account_id , self .cluster_name )} |*{ title } *>"
428434 return MarkdownBlock (
429435 f"""{ status_name } { sev .to_emoji ()} *{ sev .name .capitalize ()} *
430- { title } """
436+ { title } { mention } """
431437 )
432438
433439 def __create_links (
0 commit comments