fix(bluebubbles): add group chat filters - #33541
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused BlueBubbles filtering work. The feature remains distinct from the merged mention gate: the maintainer comment on #35606 explicitly calls #33541 complementary.
Problems
- The group authorization additions target the old
GatewayRunnerpath (gateway/run.py:6473in this PR). On current main, that logic was extracted togateway/authz_mixin.py:329-343and:388-391; without porting the mappings there, the claimed group-chat auth allowlist is absent. - The filters are applied at
gateway/platforms/bluebubbles.py:952-963only after attachment handling at:878-912, so ignored group traffic can still download and cache attachments. - The new controls are documented as non-secret environment variables, while
AGENTS.md:102-107requires behavioral settings inconfig.yaml; current BlueBubbles group gating usesplatforms.bluebubbles.extrainwebsite/docs/user-guide/messaging/bluebubbles.md:45-64.
Suggested changes
- Port the authorization and unauthorized-DM handling to
gateway/authz_mixin.py, move filtering before attachment retrieval, and cover an ignored attachment-bearing group webhook. - Re-scope the controls to
platforms.bluebubbles.extraand document that YAML surface.
Automated hermes-sweeper review.
| if source.chat_type in {"group", "forum", "channel"} and source.chat_id: | ||
| chat_allowlist_env = { | ||
| Platform.TELEGRAM: "TELEGRAM_GROUP_ALLOWED_CHATS", | ||
| Platform.BLUEBUBBLES: "BLUEBUBBLES_ALLOWED_CHATS", |
There was a problem hiding this comment.
Current main extracted this authorization path into gateway/authz_mixin.py:329-343 and :388-391. Please port the BlueBubbles group-chat mapping (and the related unauthorized-DM allowlist handling) to that mixin; this old GatewayRunner edit will not implement the claimed authorization behavior on current main.
|
|
||
| session_chat_id = chat_guid or chat_identifier | ||
| is_group = bool(record.get("isGroup")) or (";+;" in (chat_guid or "")) | ||
| if is_group and self._ignore_group_chats: |
There was a problem hiding this comment.
This gate runs after the attachment loop above, so an ignored group message can still download and cache inbound attachments. Resolve the chat identity and apply the filter before attachment retrieval, with a test asserting the downloader is not called for an ignored group payload.
Adds chat-level filters to the BlueBubbles adapter:
Docs and tests are updated for both env vars.
Closes #33489
Checked with pytest -o addopts='' tests/gateway/test_bluebubbles.py and git diff --check.