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): enforce bind gate on Slack DM slash commands, validate expiring bind codes

cyh19b5b1f548bc
diff --git a/modules/im/slack.py b/modules/im/slack.py
index 9f51f4961..386a9baf9 100644
--- a/modules/im/slack.py
+++ b/modules/im/slack.py
@@ -1042,7 +1042,20 @@ class SlackBot(BaseIMClient):
# Check if channel is authorized based on whitelist
# 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):
+ if is_dm:
+ # DM slash commands require the user to be bound (except /bind itself)
+ user_id = payload.get("user_id", "")
+ if self.settings_manager and command != "bind":
+ store = self.settings_manager.store
+ if not store.is_bound_user(user_id):
+ response_url = payload.get("response_url")
+ if response_url:
+ await self.send_slash_response(
+ response_url,
+ f"🔑 {self._t('bind.dmNotBound', channel_id)}",
+ )
+ return
+ elif 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")
diff --git a/vibe/api.py b/vibe/api.py
index 0b0e197c3..3de0066e8 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -1196,6 +1196,8 @@ def create_bind_code(code_type: str = "one_time", expires_at: Optional[str] = No
"""Create a new bind code."""
if code_type not in ("one_time", "expiring"):
return {"ok": False, "error": "type must be 'one_time' or 'expiring'"}
+ if code_type == "expiring" and not expires_at:
+ return {"ok": False, "error": "expires_at is required for expiring bind codes"}
store = SettingsStore()
bc = store.create_bind_code(code_type, expires_at)
return {