mirror of
https://github.com/dataease/dataease.git
synced 2026-05-17 15:00:59 +08:00
fix: 修复 Mysql JDBC 连接参数未验证导致任意文件读取漏洞
This commit is contained in:
@@ -15,11 +15,11 @@ import java.util.List;
|
||||
public class Mysql extends DatasourceConfiguration {
|
||||
private String driver = "com.mysql.cj.jdbc.Driver";
|
||||
private String extraParams = "characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull";
|
||||
private List<String> illegalParameters = Arrays.asList("autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations", "allowloadlocalinfile", "allowUrlInLocalInfile", "allowLoadLocalInfileInPath");
|
||||
private List<String> illegalParameters = Arrays.asList("maxAllowedPacket", "autoDeserialize", "queryInterceptors", "statementInterceptors", "detectCustomCollations", "allowloadlocalinfile", "allowUrlInLocalInfile", "allowLoadLocalInfileInPath");
|
||||
private List<String> showTableSqls = Arrays.asList("show tables");
|
||||
|
||||
public String getJdbc() {
|
||||
if(StringUtils.isNoneEmpty(getUrlType()) && !getUrlType().equalsIgnoreCase("hostName")){
|
||||
if (StringUtils.isNoneEmpty(getUrlType()) && !getUrlType().equalsIgnoreCase("hostName")) {
|
||||
for (String illegalParameter : illegalParameters) {
|
||||
if (getJdbcUrl().toLowerCase().contains(illegalParameter.toLowerCase()) || URLDecoder.decode(getExtraParams()).contains(illegalParameter.toLowerCase())) {
|
||||
DEException.throwException("Illegal parameter: " + illegalParameter);
|
||||
|
||||
Reference in New Issue
Block a user