mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-15 21:06:30 +08:00
#903 disable DOCTYPE to fix XXE Vulnerability
This commit is contained in:
@@ -189,6 +189,7 @@ public abstract class BaseWxPayResult implements Serializable {
|
||||
try {
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setExpandEntityReferences(false);
|
||||
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||
this.xmlDoc = factory.newDocumentBuilder()
|
||||
.parse(new ByteArrayInputStream(this.xmlString.getBytes(StandardCharsets.UTF_8)));
|
||||
return xmlDoc;
|
||||
|
||||
Reference in New Issue
Block a user