deerflow2/backend/app/channels
Nan Gao 0966131b31
fix(channels): require bound identity for user-owned IM messages (#3578)
* fix(channels): require bound identity for user-owned IM messages

* make format

* docs: document bound identity channel config

* refactor: reuse channel connection config

* refactor _requires_bound_identity()

* refactor from_app_config()

* make format

* fix: reject unbound channel chats before semaphore

* security enhancement

* make format

* fix: enforce bound-identity admission at command entry point

The bound-identity gate only ran for non-command messages in
_handle_message() and as a fallback inside _handle_chat(). Commands had
no equivalent boundary, so an unbound platform user could send /new and
reach _create_thread() directly, creating an unowned Gateway thread and
empty checkpoint. Info commands (/status, /models, /memory) likewise
leaked Gateway state to unbound users.

Add the same _requires_bound_identity() check at the top of
_handle_command(), rejecting via _reject_unbound_channel_message() before
any thread creation or Gateway query. The gate is a no-op in legacy
open-bot mode (require_bound_identity=False) and auth-disabled mode.
Provider-level binding flows (/connect, /start) are consumed by the
provider adapter before reaching the manager, so they are unaffected.

Tests:
- unbound auth-enabled /new is rejected before threads.create
- bound auth-enabled /new still creates the thread

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(channels): carry workspace fallback decision on inbound messages

* fix(channels): recheck bound identity by normalized workspace

* fix(channels): avoid duplicate bound identity checks

* fix(channels): preserve verified routing for bound identity rejects

* fix(channels): clarify bound identity upgrade failures

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-06-16 23:04:39 +08:00
..
__init__.py Refactor DeerFlow to use Gateway's LangGraph-compatible API 2026-04-26 20:38:34 +08:00
base.py feat(channels): add DingTalk channel integration (#2628) 2026-04-30 11:25:33 +08:00
commands.py feat(im): Add user-owned IM channel connections (#3487) 2026-06-12 15:24:58 +08:00
connection_identity.py feat(im): Add user-owned IM channel connections (#3487) 2026-06-12 15:24:58 +08:00
dingtalk.py feat(im): Add user-owned IM channel connections (#3487) 2026-06-12 15:24:58 +08:00
discord.py fix(channels): close Discord file handle after upload (#3561) 2026-06-13 23:27:17 +08:00
feishu.py feat(im): Add user-owned IM channel connections (#3487) 2026-06-12 15:24:58 +08:00
manager.py fix(channels): require bound identity for user-owned IM messages (#3578) 2026-06-16 23:04:39 +08:00
message_bus.py feat(im): Add user-owned IM channel connections (#3487) 2026-06-12 15:24:58 +08:00
runtime_config_store.py feat(im): Add user-owned IM channel connections (#3487) 2026-06-12 15:24:58 +08:00
service.py fix(channels): require bound identity for user-owned IM messages (#3578) 2026-06-16 23:04:39 +08:00
slack.py feat(im): Add user-owned IM channel connections (#3487) 2026-06-12 15:24:58 +08:00
store.py refactor: split backend into harness (deerflow.*) and app (app.*) (#1131) 2026-03-14 22:55:52 +08:00
telegram.py feat(telegram): stream agent replies by editing the placeholder message in place (#3534) 2026-06-13 08:38:28 +08:00
wechat.py feat(im): Add user-owned IM channel connections (#3487) 2026-06-12 15:24:58 +08:00
wecom.py fix(channels): surface WeCom WebSocket connection failures (#2000) (#3526) 2026-06-13 22:34:00 +08:00