修复任意文件上传windows的&&DATA文件流安全问题
This commit is contained in:
+2
-1
@@ -253,7 +253,8 @@ public class CommonUtils {
|
||||
*/
|
||||
public static boolean limitFileSuffix(String fileName,String[] fileSuffixLimits){
|
||||
final List<String> fileNameList = Arrays.asList(fileSuffixLimits);
|
||||
return fileNameList.stream().anyMatch(name -> fileName.substring(0,fileName.lastIndexOf('.')).contains(name)||fileName.substring(fileName.lastIndexOf('.')).equals(name));
|
||||
boolean isExists = fileNameList.stream().anyMatch(name -> fileName.substring(0,fileName.lastIndexOf('.')).contains(name)||fileName.substring(fileName.lastIndexOf('.')).contains(name));
|
||||
return isExists;
|
||||
}
|
||||
/**
|
||||
* RSA 使用私钥解密
|
||||
|
||||
@@ -270,7 +270,7 @@ jero:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
# 文件限制后缀黑名单
|
||||
fileSuffixLimits : 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin
|
||||
fileSuffixLimits : 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin,$DATA
|
||||
# 跨站白名单
|
||||
whiteUrls: localhost:3000,localhost:8080
|
||||
# xss白名单
|
||||
|
||||
@@ -271,7 +271,7 @@ jero:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
# 文件限制后缀黑名单
|
||||
fileSuffixLimits : 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin
|
||||
fileSuffixLimits : 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin,$DATA
|
||||
# 跨站白名单
|
||||
whiteUrls: localhost:3000,localhost:8080
|
||||
# xss白名单
|
||||
|
||||
@@ -270,7 +270,7 @@ jero:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
# 文件限制后缀黑名单
|
||||
fileSuffixLimits : 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin
|
||||
fileSuffixLimits : 0x00,%00,\\00,.jsp,.exe,.php,.asp,.aspx,.jspx,.xml,.html,.js,.sh,.bin,$DATA
|
||||
# 跨站白名单
|
||||
whiteUrls: localhost:3000,localhost:8080
|
||||
# xss白名单
|
||||
|
||||
Reference in New Issue
Block a user