mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-09 17:39:12 +08:00
#903 disable DOCTYPE to fix XXE Vulnerability
This commit is contained in:
@ -39,6 +39,7 @@ public class WxCryptUtil {
|
||||
try {
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setExpandEntityReferences(false);
|
||||
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||
return factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException exc) {
|
||||
throw new IllegalArgumentException(exc);
|
||||
|
||||
Reference in New Issue
Block a user