Skip to content

feat(bot): check Telegram admin rights before honouring group commands - #582

Open
Dev-Savio-hub wants to merge 4 commits into
mimir-stellar:mainfrom
Dev-Savio-hub:feat/group-admin-check
Open

Dev-Savio-hub wants to merge 4 commits into
mimir-stellar:mainfrom
Dev-Savio-hub:feat/group-admin-check

Conversation

@Dev-Savio-hub

Copy link
Copy Markdown
Contributor

this pr closes #406

Summary

  • Add src/commands/admin-check.ts with isChatAdmin using getChatMember, backed by a bounded TTL cache (AdminCache) and in-flight request deduplication.
  • Treat anonymous group admins (sender_chat.id === chat.id) as authorised administrators without requiring a from.id or extra API call.
  • Expose canControl(ctx, config, api) and wire it into operator commands and callbacks in src/bot.ts, keeping private-chat authorization restricted strictly to OPERATOR_TELEGRAM_USER_ID.
  • Fail closed (false) on getChatMember errors and log warnings with secret redaction via safeErrorMessage.
  • Add tests/admin-check.test.mjs covering administrator/creator, regular member, anonymous admin, API errors (with token redaction), TTL cache hits/expiry, and bounded cache eviction.

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Dev-Savio-hub Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@enliven17

Copy link
Copy Markdown
Contributor

Thanks for the contribution. The PR is currently blocked because the main branch has advanced and GitHub reports a merge conflict. Please update or rebase the branch against main, resolve the conflict, and rerun the checks. We will be happy to merge it after that.

@enliven17

Copy link
Copy Markdown
Contributor

Hi @Dev-Savio-hub, thank you for your contribution.

This PR is not currently in a mergeable state on GitHub, and its mergeability cannot be confirmed after recent repository updates, so I cannot merge it as-is.

Please recreate or rebase your branch from the current main branch and push an updated branch so we can review it again.

This is a mergeability/update note, not a malware finding. Once the branch is updated, we will review it again.

Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(bot): check Telegram admin rights before honouring group commands

2 participants