Commit 41762f0ae5cfe49d6acfcfd87f293cd30c50c33f

Authored by YunaiV
1 parent 53fc9ae4

✨ feat(im): 优化【消息引用】的功能,来自第二波 code review,解决安全性问题

yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/message/ImGroupMessageServiceImpl.java
... ... @@ -461,7 +461,11 @@ public class ImGroupMessageServiceImpl implements ImGroupMessageService {
461 461 if (ObjUtil.notEqual(original.getGroupId(), reqVO.getGroupId())) {
462 462 throw exception(MESSAGE_QUOTE_INVALID);
463 463 }
464   - // 校验对发送人可见(入群时间 / 退群时间 / 定向接收)
  464 + // 拒绝定向消息(仅发送人可见的内容若被全员广播 quote.content,会泄漏给原本看不到的成员)
  465 + if (CollUtil.isNotEmpty(original.getReceiverUserIds())) {
  466 + throw exception(MESSAGE_QUOTE_INVALID);
  467 + }
  468 + // 校验对发送人可见(入群时间 / 退群时间)
465 469 if (!isMessageVisible(original, senderMember, senderMember.getUserId())) {
466 470 throw exception(MESSAGE_QUOTE_INVALID);
467 471 }
... ...