Skip to content

fix(auth): prevent allowlist bypass via sender_id token splitting#1677

Merged
Re-bin merged 1 commit intomainfrom
fix/telegram-allowlist-bypass
Mar 7, 2026
Merged

fix(auth): prevent allowlist bypass via sender_id token splitting#1677
Re-bin merged 1 commit intomainfrom
fix/telegram-allowlist-bypass

Conversation

@Re-bin
Copy link
Copy Markdown
Collaborator

@Re-bin Re-bin commented Mar 7, 2026

Summary

  • fix an allowlist bypass in BaseChannel.is_allowed() caused by global | token splitting on sender_id
  • keep Telegram backward compatibility by handling legacy id|username matching inside TelegramChannel.is_allowed()
  • add regression tests for both the security fix and Telegram legacy allowlist behavior

Why

BaseChannel.is_allowed() previously treated sender_id as a tokenized string and allowed any |-separated segment to satisfy allow_from. This made the authorization boundary too permissive for channels that pass externally controlled sender identifiers.
This change removes that global behavior from the base class and scopes Telegram's legacy compatibility logic to the Telegram channel only, where the historical id|username format originated.

Backward Compatibility

  • Telegram allowlists remain backward compatible for:
    • numeric user IDs
    • usernames
    • legacy id|username entries
  • Non-Telegram channels now require exact allow_from matches
  • This may affect undocumented configurations that relied on | token splitting outside Telegram, but that behavior is now treated as unsafe and is intentionally removed

Security Impact

This change closes an authorization bypass where attacker-controlled composite sender_id values could match allowlisted tokens through global | splitting.

@Re-bin Re-bin merged commit 55fb771 into main Mar 7, 2026
@Re-bin Re-bin deleted the fix/telegram-allowlist-bypass branch March 7, 2026 16:37
Mazahir26 added a commit to Mazahir26/nanobot that referenced this pull request Mar 8, 2026
Upstream changes integrated:
- PR HKUDS#1635: Agent config/workspace CLI support
- PR HKUDS#1677: Fix auth allowlist bypass via sender_id token splitting
- PR HKUDS#1467: DingTalk group chat support
- PR HKUDS#436: Preserve Telegram document extension
- PR HKUDS#1482: Telegram topic support
- PR HKUDS#1535: Fix Telegram proxy crash
- PR HKUDS#332: Feishu event handlers
- Azure OpenAI provider support
- Multi-instance path cleanup and workspace override preservation
- Slack empty text response handling
- QQ group @message support

Conflicts resolved:
- .gitignore: Preserved user's tests/ and QWEN.md entries
- nanobot/agent/tools/mcp.py: Merged upstream's SSE transport support with user's dict compatibility for backward compatibility

Tests: 169 passed

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
linziyanleo added a commit to linziyanleo/nanobot__ava that referenced this pull request Mar 12, 2026
合并上游 165 commits(52 文件,+3288/-377 行),解决 6 个冲突文件:
- agent/loop.py: 保留 fork 的多模型/工具扩展,接纳上游变量名规范
- channels/telegram.py: 合并 fork 的 proxy 优化 + 上游的 streaming/table/stop/topic
- cli/commands.py: 合并 fork 的 console server + 上游的 Windows/Azure/multi-instance
- config/schema.py: 合并双方 Config 扩展(fork 压缩/心跳 + 上游 Discord/Azure)
- providers/registry.py: 保留 fork 的 zenmux/yunwu + 引入上游 Azure provider
- skills/memory/SKILL.md: 保留 fork 三维度记忆架构

上游关键合入:
- 安全修复 HKUDS#1677 allowlist bypass
- 稳定性修复 HKUDS#1728 MCP CancelledError
- MCP SSE 传输 HKUDS#1488
- Azure OpenAI provider HKUDS#1618
- 工具参数自动类型转换 HKUDS#1610
- read_file 大小限制 HKUDS#1511

适配测试以匹配 fork 自定义行为(206 tests passed)。
robottwo pushed a commit to robottwo/nanobot that referenced this pull request Mar 13, 2026
…d token splitting

fix(auth): prevent allowlist bypass via sender_id token splitting
sorker pushed a commit to sorker/nanobot that referenced this pull request Mar 24, 2026
…d token splitting

fix(auth): prevent allowlist bypass via sender_id token splitting
Wattysaid pushed a commit to kieran-assistant/nanobot that referenced this pull request Apr 3, 2026
…d token splitting

fix(auth): prevent allowlist bypass via sender_id token splitting
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.

1 participant