docs(pairing): address reviewer comments — comments, error msg, __all__ test
- Clarify SystemExit message for missing/null allowFrom (manager.py) - Document why Feishu passes content="" for unauthorized DMs - Document exact-match semantics in BaseChannel.is_allowed() - Document negligible collision probability in generate_code() - Add test_all_exports_are_importable for nanobot.pairing.__all__
This commit is contained in:
@@ -202,6 +202,7 @@ class BaseChannel(ABC):
|
||||
allow_list = getattr(self.config, "allow_from", []) or []
|
||||
if "*" in allow_list:
|
||||
return True
|
||||
# allowFrom entries are opaque tokens — must match exactly.
|
||||
if str(sender_id) in allow_list:
|
||||
return True
|
||||
if is_approved(self.name, str(sender_id)):
|
||||
|
||||
@@ -1716,6 +1716,8 @@ class FeishuChannel(BaseChannel):
|
||||
# Group chats are silently ignored; DMs get a pairing code.
|
||||
if not self.is_allowed(sender_id):
|
||||
if chat_type == "p2p":
|
||||
# content="" because the pairing reply is generated by
|
||||
# BaseChannel._handle_message, not from the original message.
|
||||
await self._handle_message(
|
||||
sender_id=sender_id,
|
||||
chat_id=sender_id,
|
||||
|
||||
@@ -145,7 +145,7 @@ class ChannelManager:
|
||||
allow = getattr(cfg, "allow_from", None)
|
||||
if allow is None:
|
||||
raise SystemExit(
|
||||
f'Error: "{name}" is missing allowFrom. '
|
||||
f'Error: "{name}" is missing or null allowFrom. '
|
||||
f'Set ["*"] to allow everyone, or add specific user IDs.'
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user