MM-67049: Fix unauthorized access to public channels in private teams (#34886) (#34994)

Automatic Merge
Этот коммит содержится в:
Mattermost Build
2026-01-20 13:54:38 +02:00
коммит произвёл GitHub
родитель 06c6ee2566
Коммит 17635d33d8
2 изменённых файлов: 23 добавлений и 4 удалений

Просмотреть файл

@@ -3176,11 +3176,12 @@ func (s SqlChannelStore) Autocomplete(rctx request.CTX, userID, term string, inc
OrderBy("c.DisplayName").
Limit(model.ChannelSearchDefaultLimit)
// Always filter out soft-deleted team memberships - users removed from
// a team should not see channels from that team regardless of includeDeleted
query = query.Where(sq.Eq{"tm.DeleteAt": 0})
if !includeDeleted {
query = query.Where(sq.And{
sq.Eq{"c.DeleteAt": 0},
sq.Eq{"tm.DeleteAt": 0},
})
query = query.Where(sq.Eq{"c.DeleteAt": 0})
}
if isGuest {