Skip to content

Commit

Permalink
fix: 防范XML注入漏洞
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Jul 5, 2018
1 parent 82f541d commit fb52b06
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/org/nutz/lang/Xmls.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public abstract class Xmls {
* @throws ParserConfigurationException
*/
public static DocumentBuilder xmls() throws ParserConfigurationException {
return DocumentBuilderFactory.newInstance().newDocumentBuilder();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setExpandEntityReferences(false);
return factory.newDocumentBuilder();
}

public static Document xml(InputStream ins) {
Expand Down

0 comments on commit fb52b06

Please sign in to comment.