修复漏洞问题

This commit is contained in:
sh
2026-05-02 20:41:29 +08:00
parent 0b3a3b4da6
commit 35feb9a147
7 changed files with 235 additions and 10 deletions

View File

@@ -117,10 +117,14 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements IF
throw new SecurityException("非法路径,禁止访问");
}
// 保存文件到服务器
Files.copy(file.getInputStream(), filePath);
java.io.File destFile = filePath.toFile();
destFile.setReadable(true, false); // 所有用户可读
destFile.setWritable(false); // 禁止写入
destFile.setExecutable(false);
// 保存文件信息到数据库
saveFileInfo(fileName, bussinessid);
@@ -163,6 +167,11 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements IF
// 保存文件到服务器
Files.copy(file.getInputStream(), filePath);
java.io.File destFile = filePath.toFile();
destFile.setReadable(true, false); // 所有用户可读
destFile.setWritable(false); // 禁止写入
destFile.setExecutable(false);
// 保存文件信息到数据库
File svFile=saveFileInfo(fileName, bussinessid);
AjaxResult ajaxResult=AjaxResult.success();