Skip to content

fix(telegram): use group allowlist for native command auth in groups#30272

Closed
pushkarsingh32 wants to merge 1 commit intoopenclaw:mainfrom
pushkarsingh32:fix/telegram-group-command-auth-allowlist
Closed

fix(telegram): use group allowlist for native command auth in groups#30272
pushkarsingh32 wants to merge 1 commit intoopenclaw:mainfrom
pushkarsingh32:fix/telegram-group-command-auth-allowlist

Conversation

@pushkarsingh32
Copy link
Copy Markdown
Contributor

Summary

  • Fixes native Telegram slash commands in groups rejecting authorized senders because the auth check used the DM allowlist instead of the group allowlist

Root cause: resolveTelegramCommandAuth always used normalizeDmAllowFromWithStore (DM allowlist) for the final sender authorization, even in group contexts. Users in groupAllowFrom but not in allowFrom were rejected.

Fix: Use effectiveGroupAllow (already resolved from groupAllowFrom and per-group/topic overrides) for group contexts. Keep DM allowlist logic only for direct messages.

Changes

  • src/telegram/bot-native-commands.ts: Branch auth logic based on isGroup — use effectiveGroupAllow for groups, normalizeDmAllowFromWithStore for DMs

Test plan

  • Configure a Telegram group with groupAllowFrom: [userId] but no top-level allowFrom
  • Send a native slash command (e.g. /status) in the group
  • Verify the command is authorized (no "not authorized" rejection)
  • Verify DM commands still work with the DM allowlist

Fixes #30234

Native Telegram slash commands in groups incorrectly checked the DM
allowlist (allowFrom) instead of the group allowlist (groupAllowFrom).
This caused authorized group members to be rejected with "You are not
authorized" when they weren't in the DM allowlist.

Use effectiveGroupAllow (already resolved from groupAllowFrom and
per-group/topic overrides) for group contexts, keeping DM allowlist
logic only for direct messages.

Fixes openclaw#30234
@openclaw-barnacle openclaw-barnacle bot added channel: telegram Channel integration: telegram size: XS labels Mar 1, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 1, 2026

Greptile Summary

This PR fixes a bug where native Telegram slash commands in group chats were incorrectly using the DM allowlist (normalizeDmAllowFromWithStore) for sender authorization, causing users listed only in groupAllowFrom to be rejected. The fix branches the allowlist selection on isGroup — using effectiveGroupAllow (already resolved from groupAllowFrom and per-group/topic overrides) for groups, and normalizeDmAllowFromWithStore only for DMs.

  • The change is minimal and surgical — only the final allow resolution is affected.
  • The DM code path preserves identical behavior to before (storeAllowFrom is passed unchanged in the non-group branch).
  • The effectiveGroupAllow variable was already being correctly computed higher up in the function via resolveTelegramGroupAllowFromContext, so no new logic is introduced.
  • No issues found with edge cases (e.g. unconfigured allowlists still result in hasEntries: false, maintaining open access parity with the old behavior).

Confidence Score: 5/5

  • This PR is safe to merge — the fix is minimal, well-scoped, and correctly addresses the root cause.
  • The change is a single, focused branch on isGroup to select the correct allowlist. The effectiveGroupAllow value was already computed correctly earlier in the same function, so the fix reuses existing logic without introducing new complexity. DM behavior is unchanged. No regressions were identified.
  • No files require special attention.

Last reviewed commit: 63e5644

@steipete
Copy link
Copy Markdown
Contributor

steipete commented Mar 2, 2026

Thanks for the PR! This duplicates #29175, which was submitted first with the same group allowlist fix for native command auth. Closing in favor of the earlier submission. This is an AI-assisted triage review. If we got this wrong, feel free to reopen or start a new PR — happy to revisit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram native command auth in groups checks DM allowlist instead of groupAllowFrom

2 participants