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(feishu): address re-review — fail-closed auth, dedup granularity, truncation flag

cyhhaod4bb0d2bdf9e
diff --git a/modules/im/feishu.py b/modules/im/feishu.py
index edd806e11..fa4446fbd 100644
--- a/modules/im/feishu.py
+++ b/modules/im/feishu.py
@@ -1145,13 +1145,21 @@ class FeishuBot(BaseIMClient):
chat_id = ctx_data.get("open_chat_id", "") or event_data.get("open_chat_id", "")
# --- Dedup: prevent re-delivery of the same card action ---
- dedup_key = f"card:{message_id}:{button_name or callback_data}:{user_id}"
+ # Include a hash of form values so that intentional re-submissions
+ # with different selections are not mistakenly deduplicated.
+ form_hash = ""
+ if form_value:
+ try:
+ form_hash = str(hash(json.dumps(form_value, sort_keys=True)))
+ except Exception:
+ form_hash = str(id(form_value))
+ dedup_key = f"card:{message_id}:{button_name or callback_data}:{user_id}:{form_hash}"
if self._is_duplicate_event(dedup_key):
return
# --- Channel authorization (same as message handler) ---
- if chat_id and not await self._is_authorized_channel(chat_id):
- logger.info("Card action from unauthorized channel %s, ignoring", chat_id)
+ 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(
diff --git a/vibe/api.py b/vibe/api.py
index c7153db2a..1ff5204dd 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -1048,7 +1048,8 @@ def lark_list_chats(app_id: str, app_secret: str, domain: str = "feishu") -> dic
break # server returned the same token — avoid loop
seen_page_tokens.add(page_token)
page += 1
- return {"ok": True, "channels": channels}
+ truncated = page >= max_pages
+ return {"ok": True, "channels": channels, "truncated": truncated}
except Exception as exc:
return {"ok": False, "error": str(exc)}