fix 修复 有某些无聊人士 对一个demo案例提漏洞 CVE-2025-6925

dev
疯狂的狮子Li 6 months ago
parent df7f282e41
commit c846fad872

@ -39,14 +39,14 @@ public class MailController {
/** /**
* *
* *
* @param to * @param to
* @param subject * @param subject
* @param text * @param text
* @param filePath
*/ */
@GetMapping("/sendMessageWithAttachment") @GetMapping("/sendMessageWithAttachment")
public R<Void> sendMessageWithAttachment(String to, String subject, String text, String filePath) { public R<Void> sendMessageWithAttachment(String to, String subject, String text) {
MailUtils.sendText(to, subject, text, new File(filePath)); // 附件路径 禁止前端传递 有任意读取系统文件风险
MailUtils.sendText(to, subject, text, new File("/xxx/xxx"));
return R.ok(); return R.ok();
} }
@ -56,10 +56,11 @@ public class MailController {
* @param to * @param to
* @param subject * @param subject
* @param text * @param text
* @param paths
*/ */
@GetMapping("/sendMessageWithAttachments") @GetMapping("/sendMessageWithAttachments")
public R<Void> sendMessageWithAttachments(String to, String subject, String text, String[] paths) { public R<Void> sendMessageWithAttachments(String to, String subject, String text) {
// 附件路径 禁止前端传递 有任意读取系统文件风险
String[] paths = new String[]{"/xxx/xxx", "/xxx/xxx"};
File[] array = Arrays.stream(paths).map(File::new).toArray(File[]::new); File[] array = Arrays.stream(paths).map(File::new).toArray(File[]::new);
MailUtils.sendText(to, subject, text, array); MailUtils.sendText(to, subject, text, array);
return R.ok(); return R.ok();

Loading…
Cancel
Save