Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion gateway/platforms/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,19 @@ async def _fetch_thread_context(
is_parent = msg_ts == thread_ts
prefix = "[thread parent] " if is_parent else ""
name = await self._resolve_user_name(msg_user, chat_id=channel_id)
context_parts.append(f"{prefix}{name}: {msg_text}")

# Tag messages from users not on the allowlist
trust_tag = ""
allow_all = os.getenv("SLACK_ALLOW_ALL_USERS", "").lower() in ("true", "1", "yes") or \
os.getenv("GATEWAY_ALLOW_ALL_USERS", "").lower() in ("true", "1", "yes")
if not allow_all:
allowed_csv = os.getenv("SLACK_ALLOWED_USERS", "").strip()
if allowed_csv:
allowed_ids = {uid.strip() for uid in allowed_csv.split(",") if uid.strip()}
if "*" not in allowed_ids and msg_user not in allowed_ids:
trust_tag = "[Message from untrusted user] "

context_parts.append(f"{prefix}{trust_tag}{name}: {msg_text}")

content = ""
if context_parts:
Expand Down