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(admin): skip channel authorization for DM interactive/slash-command paths

cyhb66b0d0ecbfb
diff --git a/modules/im/discord.py b/modules/im/discord.py
index 96fc0e9a7..c1e3cb783 100644
--- a/modules/im/discord.py
+++ b/modules/im/discord.py
@@ -1492,7 +1492,9 @@ class _PersistentStartView(discord.ui.View):
guild_id = str(interaction.guild_id) if interaction.guild_id else None
if guild_id and not self.outer._is_allowed_guild(guild_id):
return
- if not await self.outer._is_authorized_channel(channel_id):
+ # Skip channel auth for DM interactions (authorized via bind system)
+ is_dm = interaction.guild is None or isinstance(interaction.channel, discord.DMChannel)
+ if not is_dm and not await self.outer._is_authorized_channel(channel_id):
await self.outer._send_unauthorized_message(channel_id)
return
context = MessageContext(
@@ -1572,7 +1574,9 @@ class _DiscordButtonView(discord.ui.View):
guild_id = str(interaction.guild_id) if interaction.guild_id else None
if guild_id and not self.outer._is_allowed_guild(guild_id):
return
- if not await self.outer._is_authorized_channel(channel_id):
+ # Skip channel auth for DM interactions
+ is_dm = interaction.guild is None or isinstance(interaction.channel, discord.DMChannel)
+ if not is_dm and not await self.outer._is_authorized_channel(channel_id):
await self.outer._send_unauthorized_message(channel_id)
return
context = MessageContext(
diff --git a/modules/im/feishu.py b/modules/im/feishu.py
index 3577bcdf7..04f7b723b 100644
--- a/modules/im/feishu.py
+++ b/modules/im/feishu.py
@@ -1213,10 +1213,19 @@ class FeishuBot(BaseIMClient):
if self._is_duplicate_event(dedup_key):
return
- # --- Channel authorization (same as message handler) ---
- if not chat_id or not await self._is_authorized_channel(chat_id):
- logger.info("Card action from unauthorized/unknown channel %s, ignoring", chat_id)
- return
+ # --- Channel authorization ---
+ # Skip for bound users in DM (p2p) contexts.
+ # Feishu card actions don't carry chat_type, so we check if the user
+ # is a bound user — bound users are explicitly authorized for DM access.
+ is_bound_dm = False
+ if self.settings_manager and user_id:
+ store = self.settings_manager.store
+ if store.is_bound_user(user_id):
+ is_bound_dm = True
+ if not is_bound_dm:
+ if not chat_id or not await self._is_authorized_channel(chat_id):
+ logger.info("Card action from unauthorized/unknown channel %s, ignoring", chat_id)
+ return
context = MessageContext(
user_id=user_id,
diff --git a/modules/im/slack.py b/modules/im/slack.py
index c9b088e29..9f51f4961 100644
--- a/modules/im/slack.py
+++ b/modules/im/slack.py
@@ -1040,7 +1040,9 @@ class SlackBot(BaseIMClient):
channel_id = payload.get("channel_id")
# Check if channel is authorized based on whitelist
- if not await self._is_authorized_channel(channel_id):
+ # Skip channel auth for DM channels (authorized via bind system)
+ is_dm = isinstance(channel_id, str) and channel_id.startswith("D")
+ if not is_dm and not await self._is_authorized_channel(channel_id):
logger.info(f"Unauthorized slash command from channel: {channel_id}")
# Send a response to user about unauthorized channel
response_url = payload.get("response_url")
@@ -1145,7 +1147,9 @@ class SlackBot(BaseIMClient):
channel_id = private_metadata
# Check if channel is authorized for interactive components
- if not await self._is_authorized_channel(channel_id):
+ # Skip channel auth for DM channels (authorized via bind system)
+ is_dm = isinstance(channel_id, str) and channel_id.startswith("D")
+ if not is_dm and not await self._is_authorized_channel(channel_id):
logger.info(f"Unauthorized interactive action from channel: {channel_id}")
try:
await self._send_unauthorized_message(channel_id)