mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 13:32:18 +08:00
fix: 【漏洞】Dataease H2 JDBC Connection Remote Code Execution
This commit is contained in:
@@ -7,16 +7,23 @@ import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Component("h2")
|
||||
public class H2 extends DatasourceConfiguration {
|
||||
private String driver = "org.h2.Driver";
|
||||
private List<String> illegalParameters = Arrays.asList("INIT", "RUNSCRIPT");
|
||||
|
||||
public String getJdbc() {
|
||||
if (StringUtils.containsAnyIgnoreCase(jdbc, "INIT", "RUNSCRIPT")) {
|
||||
DEException.throwException("Has illegal parameter: " + jdbc);
|
||||
for (String illegalParameter : illegalParameters) {
|
||||
if (jdbc.toUpperCase().contains(illegalParameter)) {
|
||||
DEException.throwException("Has illegal parameter: " + jdbc);
|
||||
}
|
||||
}
|
||||
|
||||
return jdbc;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user