fix(feishu): gate approval/update-prompt card clicks on operator allowlist, not group policy
The synchronous card-action handlers and the update-prompt resolver authorized clicks with _allow_group_message(), which answers "may this sender chat in this group?" — with group_policy=open it returns True for everyone. The approval resolver already used the correct operator gate (_is_interactive_operator_authorized), so the three code paths disagreed: with an open group policy an out-of-allowlist click on an update-prompt card was fully executed, and approval clicks returned a resolved-looking card before being rejected asynchronously. Authorize all three paths with _is_interactive_operator_authorized(), which checks membership of admins ∪ allowed_group_users (wildcard and the empty pairing-mode allowlist keep their existing allow semantics, matching _admit's DM pairing default). A missing operator identity now fails closed on the update-prompt resolver instead of skipping the check. Fixes #96045
This commit is contained in:
@@ -2815,8 +2815,7 @@ class FeishuAdapter(BasePlatformAdapter):
|
||||
|
||||
operator = getattr(event, "operator", None)
|
||||
open_id = str(getattr(operator, "open_id", "") or "")
|
||||
sender_id = SimpleNamespace(open_id=open_id, user_id=str(getattr(operator, "user_id", "") or ""))
|
||||
if not self._allow_group_message(sender_id, state.get("chat_id", ""), is_bot=False):
|
||||
if not self._is_interactive_operator_authorized(open_id):
|
||||
logger.warning("[Feishu] Unauthorized approval click by %s", open_id or "<unknown>")
|
||||
return P2CardActionTriggerResponse() if P2CardActionTriggerResponse else None
|
||||
|
||||
@@ -2875,8 +2874,7 @@ class FeishuAdapter(BasePlatformAdapter):
|
||||
|
||||
operator = getattr(event, "operator", None)
|
||||
open_id = str(getattr(operator, "open_id", "") or "")
|
||||
sender_id = SimpleNamespace(open_id=open_id, user_id=str(getattr(operator, "user_id", "") or ""))
|
||||
if not self._allow_group_message(sender_id, state.get("chat_id", ""), is_bot=False):
|
||||
if not self._is_interactive_operator_authorized(open_id):
|
||||
logger.warning("[Feishu] Unauthorized update prompt click by %s", open_id or "<unknown>")
|
||||
return P2CardActionTriggerResponse() if P2CardActionTriggerResponse else None
|
||||
|
||||
@@ -2982,11 +2980,9 @@ class FeishuAdapter(BasePlatformAdapter):
|
||||
if not state:
|
||||
logger.debug("[Feishu] Update prompt %s already resolved or unknown", prompt_id)
|
||||
return
|
||||
if open_id:
|
||||
sender_id = SimpleNamespace(open_id=open_id, user_id="")
|
||||
if not self._allow_group_message(sender_id, state.get("chat_id", ""), is_bot=False):
|
||||
logger.warning("[Feishu] Unauthorized update prompt click by %s for prompt %s", open_id, prompt_id)
|
||||
return
|
||||
if not self._is_interactive_operator_authorized(open_id):
|
||||
logger.warning("[Feishu] Unauthorized update prompt click by %s for prompt %s", open_id, prompt_id)
|
||||
return
|
||||
expected_chat_id = str(state.get("chat_id", "") or "")
|
||||
if expected_chat_id and chat_id and expected_chat_id != chat_id:
|
||||
logger.warning(
|
||||
|
||||
Reference in New Issue
Block a user