Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(slack): narrow existing token URL guard

cyh392997939f6f
diff --git a/modules/im/slack.py b/modules/im/slack.py
index 82cb979d3..8e4ea086d 100644
--- a/modules/im/slack.py
+++ b/modules/im/slack.py
@@ -44,6 +44,7 @@ _UNSET = object()
_SLACK_SECTION_TEXT_LIMIT = 3000
_BARE_HTTP_URL_RE = re.compile(r"https?://[^\s<>\|]+")
_TRAILING_URL_PUNCTUATION = ".,!?;:"
+_SLACK_TOKEN_PREFIXES = ("http://", "https://", "@", "#", "!", "!date^")
class SlackBot(BaseIMClient):
@@ -554,7 +555,7 @@ class SlackBot(BaseIMClient):
end = match.end()
last_lt = segment.rfind("<", 0, start)
last_gt = segment.rfind(">", 0, start)
- if last_lt > last_gt:
+ if last_lt > last_gt and segment[last_lt + 1 :].startswith(_SLACK_TOKEN_PREFIXES):
return url
trailing = ""
diff --git a/tests/test_slack_dm_mentions.py b/tests/test_slack_dm_mentions.py
index e25c1c12d..cfff7c080 100644
--- a/tests/test_slack_dm_mentions.py
+++ b/tests/test_slack_dm_mentions.py
@@ -243,6 +243,7 @@ class SlackDmMentionTests(unittest.IsolatedAsyncioTestCase):
"Open https://example.com/path?a=1&b=2.\n"
"Existing <https://example.org|Example>.\n"
"Date <!date^1392734382^{date_short}^https://date.example/|Feb 18>.\n"
+ "Comparison 1 < 2 https://compare.example.\n"
"Inline `https://code.example`.\n"
"```\nhttps://block.example\n```"
)
@@ -253,6 +254,7 @@ class SlackDmMentionTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("<https://example.com/path?a=1&b=2>.", block_text)
self.assertIn("<https://example.org|Example>", block_text)
self.assertIn("<!date^1392734382^{date_short}^https://date.example/|Feb 18>", block_text)
+ self.assertIn("Comparison 1 < 2 <https://compare.example>.", block_text)
self.assertIn("`https://code.example`", block_text)
self.assertIn("```\nhttps://block.example\n```", block_text)
self.assertNotIn("<<https://example.org", block_text)