discourse/plugins/chat/spec/services
Joffrey JAFFEUX 769f438f0d SECURITY: Harden chat DM channel creation and expansion
Two issues fixed:

1. **Group visibility bypass** — the `target_groups` parameter was passed directly to the user resolution query without checking group or member visibility for the acting user. An authenticated chat user could craft an API request with a known private/hidden group name and receive a channel containing that group's members, leaking their identities. Fix: filter `target_groups` through `visible_groups` and `members_visible_groups` scopes before resolving users in both `CreateDirectMessageChannel` and `AddUsersToChannel` services.

2. **Chat-disabled user bypass** — `can_chat?` only checked group membership, not the `chat_enabled` user preference. A chat-disabled user could create or query DM channels between other users via the direct messages API, potentially exposing private `last_message` content. Fix: add `chat_enabled` check to `can_chat?` and add an actor inclusion guard in `fetch_target_users` so the service fails if the acting user gets filtered out of the resolved user set.

---

**Security Advisory:** https://github.com/discourse/discourse/security/advisories/GHSA-2m5j-6v2r-cq2h
2026-03-31 15:12:45 +01:00
..
actions DEV: Replace Ruby numbered parameters by it where applicable (#37810) 2026-02-13 13:59:07 +01:00
chat SECURITY: Harden chat DM channel creation and expansion 2026-03-31 15:12:45 +01:00
video_conversion DEV: Add video conversion support for chat messages (#36275) 2025-12-01 12:34:56 -07:00
hashtag_autocomplete_service_spec.rb DEV: Chat hashtag test (#25638) 2024-02-12 12:32:52 +10:00