fix(telegram): include group allowlist in native command auth for forum topics#29230
fix(telegram): include group allowlist in native command auth for forum topics#29230i314nk wants to merge 1 commit intoopenclaw:mainfrom
Conversation
…um topics Native slash commands (/status, /reasoning, etc.) returned 'not authorized' in forum topic chats because resolveTelegramCommandAuth only checked the DM allowlist (allowFrom) when authorizing senders. In groups, the DM pairing store is excluded, so senders authorized via per-group allowFrom or groupAllowFrom were incorrectly rejected. Add effectiveGroupAllow as a second authorizer when isGroup is true, mirroring how bot-handlers.ts authorizes regular group messages. Fixes openclaw#29135
Greptile SummaryThis PR fixes authorization for native slash commands in Telegram forum topics by adding group allowlist checking to Key changes:
How it works: The implementation is clean, minimal (+7 lines), and aligns with existing authorization patterns in the codebase. Confidence Score: 5/5
Last reviewed commit: c84c79c |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Still relevant — this fixes a real bug where native slash commands (like |
|
Closing — this fix has been superseded by the broader auth refactoring on main, particularly the group auth boundary enforcement (Feb 26) and the native command auth hardening in #34873 (Mar 5). The underlying code has been significantly reworked since this PR was opened. Thanks for the review, Greptile! |
Problem
Native slash commands (
/status,/reasoning, etc.) return "You are not authorized to use this command." in Telegram forum topic chats, even when the sender is authorized via per-groupallowFromorgroupAllowFrom.Regular messages in the same forum work correctly.
Root Cause
resolveTelegramCommandAuthinbot-native-commands.tsonly passes the DM allowlist (allowFrom) as an authorizer toresolveCommandAuthorizedFromAuthorizers. For group messages, the DM pairing store is excluded (storeAllowFrom: isGroup ? [] : storeAllowFrom), so senders authorized via per-group config are incorrectly rejected.Compare with
bot-handlers.tswhich correctly checkseffectiveGroupAllowfor group messages.Fix
Add
effectiveGroupAllowas a second authorizer whenisGroupis true. SinceresolveCommandAuthorizedFromAuthorizersusesauthorizers.some(e => e.configured && e.allowed), either the DM allowlist OR the group allowlist matching is sufficient — mirroring regular message auth behavior.+7 lines in
bot-native-commands.ts.Test
Added test: "allows native commands in forum topic when sender is in group allowFrom" — verifies
/statussucceeds in a forum supergroup when the sender is in the group'sallowFromlist.All 41 existing bot tests pass, zero regressions. Formatting clean (
oxfmt --check).AI Disclosure
Fixes #29135