fixed #5154,avoid spring RCE

This commit is contained in:
jianghang.loujh
2024-06-06 15:29:17 +08:00
parent d66a15fe35
commit 7bb619cf12
7 changed files with 17 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package com.alibaba.otter.canal.instance.manager;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
@@ -69,6 +70,9 @@ public class PlainCanalInstanceGenerator implements CanalInstanceGenerator {
// ================ setter / getter ================
private BeanFactory getBeanFactory(String springXml) {
if (!StringUtils.startsWithIgnoreCase("classpath:", springXml)) {
springXml = "classpath:" + springXml;
}
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(springXml);
return applicationContext;
}