hermes - 💡(How to fix) Fix fix(feishu): card approval buttons use _allow_group_message instead of _is_interactive_operator_authorized, rejecting all users in DM

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Feishu card approval buttons always return "Unauthorized approval click" in DM

When a user clicks an approval card button (e.g., "Always Approve", "Deny") sent via Feishu bot DM, the gateway logs show:

WARNING gateway.platforms.feishu: [Feishu] Unauthorized approval click by ou_xxx

The button click is silently ignored and no approval resolution occurs.

Root Cause

In gateway/platforms/feishu.py, the method _handle_approval_card_action() (around line 2600) calls self._allow_group_message() to check authorization:

if not self._allow_group_message(sender_id, state.get("chat_id", ""), is_bot=False):
    logger.warning("[Feishu] Unauthorized approval click by %s", open_id or "<unknown>")
    return P2CardActionTriggerResponse() if P2CardActionTriggerResponse else None

_allow_group_message() is designed for group message admission policy — it uses FEISHU_GROUP_POLICY (default "allowlist"). When FEISHU_ALLOWED_USERS is not configured, the allowlist is empty, which means everyone is rejected, even in DM context.

Fix Action

Fix

Replace the _allow_group_message call with _is_interactive_operator_authorized:

-        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

Code Example

WARNING gateway.platforms.feishu: [Feishu] Unauthorized approval click by ou_xxx

---

if not self._allow_group_message(sender_id, state.get("chat_id", ""), is_bot=False):
    logger.warning("[Feishu] Unauthorized approval click by %s", open_id or "<unknown>")
    return P2CardActionTriggerResponse() if P2CardActionTriggerResponse else None

---

def _is_interactive_operator_authorized(self, open_id: str) -> bool:
    """Return whether this card-action operator may answer gated prompts."""
    normalized = str(open_id or "").strip()
    if not normalized:
        return False
    allowed_ids = set(self._admins) | set(self._allowed_group_users)
    if not allowed_ids:
        return True  # No restrictions → allow everyone
    return "*" in allowed_ids or normalized in allowed_ids

---

-        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
RAW_BUFFERClick to expand / collapse

Description

Feishu card approval buttons always return "Unauthorized approval click" in DM

When a user clicks an approval card button (e.g., "Always Approve", "Deny") sent via Feishu bot DM, the gateway logs show:

WARNING gateway.platforms.feishu: [Feishu] Unauthorized approval click by ou_xxx

The button click is silently ignored and no approval resolution occurs.

Root Cause

In gateway/platforms/feishu.py, the method _handle_approval_card_action() (around line 2600) calls self._allow_group_message() to check authorization:

if not self._allow_group_message(sender_id, state.get("chat_id", ""), is_bot=False):
    logger.warning("[Feishu] Unauthorized approval click by %s", open_id or "<unknown>")
    return P2CardActionTriggerResponse() if P2CardActionTriggerResponse else None

_allow_group_message() is designed for group message admission policy — it uses FEISHU_GROUP_POLICY (default "allowlist"). When FEISHU_ALLOWED_USERS is not configured, the allowlist is empty, which means everyone is rejected, even in DM context.

The Fix

This release (v2026.6.5) introduced a proper function _is_interactive_operator_authorized() at line 2575 that handles card action authorization correctly:

def _is_interactive_operator_authorized(self, open_id: str) -> bool:
    """Return whether this card-action operator may answer gated prompts."""
    normalized = str(open_id or "").strip()
    if not normalized:
        return False
    allowed_ids = set(self._admins) | set(self._allowed_group_users)
    if not allowed_ids:
        return True  # No restrictions → allow everyone
    return "*" in allowed_ids or normalized in allowed_ids

However, _handle_approval_card_action() was not updated to use this new function. Two other card handlers (_handle_update_prompt_card_action ~L2658 and another at ~L2690) were correctly updated, but the main approval handler was missed.

Fix

Replace the _allow_group_message call with _is_interactive_operator_authorized:

-        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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING