Skip to content

Commit 7c43fda

Browse files
Fix code scanning alert no. 6: Resolving XML external entity in user-controlled data
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent d21e71b commit 7c43fda

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/org/apache/ibatis/parsing/XPathParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ private Document createDocument(InputSource inputSource) {
231231
try {
232232
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
233233
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
234+
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
235+
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
236+
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
234237
factory.setValidating(validation);
235238

236239
factory.setNamespaceAware(false);

0 commit comments

Comments
 (0)