Skip to content

Commit b567dcd

Browse files
hotcodemachaaajisaka
authored andcommitted
HDFS-16410. Insecure Xml parsing in OfflineEditsXmlLoader (apache#3854)
Contributed by Ashutosh Gupta (cherry picked from commit 43e5218)
1 parent d10bbaf commit b567dcd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/OfflineEditsXmlLoader.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public OfflineEditsXmlLoader(OfflineEditsVisitor visitor,
8686
public void loadEdits() throws IOException {
8787
try {
8888
XMLReader xr = XMLReaderFactory.createXMLReader();
89+
xr.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
90+
xr.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
91+
xr.setFeature("http://xml.org/sax/features/external-general-entities", false);
92+
xr.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
8993
xr.setContentHandler(this);
9094
xr.setErrorHandler(this);
9195
xr.setDTDHandler(null);

0 commit comments

Comments
 (0)