HDFS-16410. Insecure Xml parsing in OfflineEditsXmlLoader (#3854)
Contributed by Ashutosh Gupta
This commit is contained in:
parent
e1d0aa9ee5
commit
43e5218a86
@ -86,6 +86,10 @@ public OfflineEditsXmlLoader(OfflineEditsVisitor visitor,
|
|||||||
public void loadEdits() throws IOException {
|
public void loadEdits() throws IOException {
|
||||||
try {
|
try {
|
||||||
XMLReader xr = XMLReaderFactory.createXMLReader();
|
XMLReader xr = XMLReaderFactory.createXMLReader();
|
||||||
|
xr.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||||
|
xr.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||||
|
xr.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||||
|
xr.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||||
xr.setContentHandler(this);
|
xr.setContentHandler(this);
|
||||||
xr.setErrorHandler(this);
|
xr.setErrorHandler(this);
|
||||||
xr.setDTDHandler(null);
|
xr.setDTDHandler(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user