mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
XmlUtil.readObjectFromXml增加注入漏洞的警告注释,并标识为废弃
This commit is contained in:
parent
b4f6ffc66f
commit
554b828745
@ -6,6 +6,8 @@
|
||||
# 5.8.12.M1 (2023-01-15)
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 XmlUtil.readObjectFromXml增加注入漏洞的警告注释,并标识为废弃(issue#2857@Github)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复HexUtil.isHexNumber()对"-"的判断问题(issue#2857@Github)
|
||||
|
||||
|
@ -331,36 +331,48 @@ public class XmlUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 从XML中读取对象 Reads serialized object from the XML file.
|
||||
* 从XML中读取对象 Reads serialized object from the XML file.<br>
|
||||
* 注意,使用此方法解析不受信任 XML 字符串时,可能容易受到远程代码执行攻击!<br>
|
||||
* 见:https://gitee.com/dromara/hutool/issues/I6AEX2
|
||||
*
|
||||
* @param <T> 对象类型
|
||||
* @param source XML文件
|
||||
* @return 对象
|
||||
* @deprecated 使用此方法解析不受信任 XML 字符串时,可能容易受到远程代码执行攻击,废弃
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> T readObjectFromXml(File source) {
|
||||
return readObjectFromXml(new InputSource(FileUtil.getInputStream(source)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 从XML中读取对象 Reads serialized object from the XML file.
|
||||
* 从XML中读取对象 Reads serialized object from the XML file.<br>
|
||||
* 注意,使用此方法解析不受信任 XML 字符串时,可能容易受到远程代码执行攻击!<br>
|
||||
* 见:https://gitee.com/dromara/hutool/issues/I6AEX2
|
||||
*
|
||||
* @param <T> 对象类型
|
||||
* @param xmlStr XML内容
|
||||
* @return 对象
|
||||
* @since 3.2.0
|
||||
* @deprecated 使用此方法解析不受信任 XML 字符串时,可能容易受到远程代码执行攻击,废弃
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> T readObjectFromXml(String xmlStr) {
|
||||
return readObjectFromXml(new InputSource(StrUtil.getReader(xmlStr)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 从XML中读取对象 Reads serialized object from the XML file.
|
||||
* 从XML中读取对象 Reads serialized object from the XML file.<br>
|
||||
* 注意,使用此方法解析不受信任 XML 字符串时,可能容易受到远程代码执行攻击!<br>
|
||||
* 见:https://gitee.com/dromara/hutool/issues/I6AEX2
|
||||
*
|
||||
* @param <T> 对象类型
|
||||
* @param source {@link InputSource}
|
||||
* @return 对象
|
||||
* @since 3.2.0
|
||||
* @deprecated 使用此方法解析不受信任 XML 字符串时,可能容易受到远程代码执行攻击,废弃
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T readObjectFromXml(InputSource source) {
|
||||
Object result;
|
||||
|
Loading…
Reference in New Issue
Block a user