public class SafeXMLConfiguration
extends org.apache.commons.configuration2.XMLConfiguration
Modifier and Type | Class and Description |
---|---|
(package private) static interface |
SafeXMLConfiguration.XMLReader |
Modifier and Type | Field and Description |
---|---|
private static String |
ALLOW_EXTERNAL_DTD |
private static String |
ALLOW_EXTERNAL_GENERAL_ENTITIES |
private static String |
ALLOW_EXTERNAL_PARAM_ENTITIES |
private static String |
DISALLOW_DOCTYPES |
private static String |
JAXP_SCHEMA_LANGUAGE |
private static String |
W3C_XML_SCHEMA |
private static String |
XXE_ERROR_MESSAGE |
Constructor and Description |
---|
SafeXMLConfiguration() |
SafeXMLConfiguration(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> c) |
Modifier and Type | Method and Description |
---|---|
DocumentBuilder |
createDocumentBuilder()
This overridden createDocumentBuilder() method sets the appropriate factory attributes to disable XXE parsing.
|
private void |
delegateRead(SafeXMLConfiguration.XMLReader superRead) |
void |
initFileLocator(org.apache.commons.configuration2.io.FileLocator loc) |
private boolean |
isXXERelatedException(org.apache.commons.configuration2.ex.ConfigurationException e)
Determine if the ConfigurationException was thrown because the XML configuration file contains an external entity (XXE).
|
void |
read(InputStream in) |
void |
read(Reader in) |
createTransformer, getDocument, getDocumentBuilder, getEntityResolver, getPublicID, getRootElementNameInternal, getSystemID, isSchemaValidation, isValidating, setDocumentBuilder, setEntityResolver, setPublicID, setRootElementName, setSchemaValidation, setSystemID, setValidating, validate, write, write
childConfigurationsAt, childConfigurationsAt, cloneNodeModel, configurationAt, configurationAt, configurationsAt, configurationsAt, createSubConfigurationForTrackedNode, getNodeModel, getSubConfigurationNodeSelector, getSubConfigurationParentModel, immutableChildConfigurationsAt, immutableConfigurationAt, immutableConfigurationAt, immutableConfigurationsAt, initSubConfigurationForThisParent, interpolatedConfiguration, subnodeConfigurationChanged, subset
addNodes, addNodesInternal, addPropertyDirect, addPropertyInternal, clearInternal, clearPropertyDirect, clearTree, clearTreeInternal, clone, containsKeyInternal, fetchNodeList, getExpressionEngine, getKeysInternal, getKeysInternal, getMaxIndex, getMaxIndexInternal, getModel, getPropertyInternal, getRootElementName, isEmptyInternal, nodeDefined, nodeKey, resolveAddKey, resolveKey, resolveNodeKey, resolveUpdateKey, setExpressionEngine, setPropertyInternal, sizeInternal, toString
addErrorLogListener, addProperty, append, beginRead, beginWrite, clear, clearProperty, cloneInterpolator, containsKey, copy, endRead, endWrite, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getConfigurationDecoder, getConversionHandler, getDouble, getDouble, getDouble, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getKeys, getList, getList, getList, getList, getListDelimiterHandler, getLogger, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getSynchronizer, immutableSubset, initLogger, installInterpolator, interpolate, interpolate, isEmpty, isScalarValue, isThrowExceptionOnMissing, lock, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setProperty, setSynchronizer, setThrowExceptionOnMissing, size, unlock
addEventListener, clearErrorListeners, clearEventListeners, copyEventListeners, createErrorEvent, createEvent, fireError, fireEvent, getEventListenerRegistrations, getEventListeners, isDetailEvents, removeEventListener, setDetailEvents
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addProperty, clear, clearProperty, getInterpolator, installInterpolator, setInterpolator, setProperty, subset
containsKey, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getDouble, getDouble, getDouble, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, immutableSubset, isEmpty, size
private static final String JAXP_SCHEMA_LANGUAGE
private static final String W3C_XML_SCHEMA
private static final String DISALLOW_DOCTYPES
private static final String ALLOW_EXTERNAL_GENERAL_ENTITIES
private static final String ALLOW_EXTERNAL_PARAM_ENTITIES
private static final String ALLOW_EXTERNAL_DTD
private static final String XXE_ERROR_MESSAGE
public SafeXMLConfiguration()
public SafeXMLConfiguration(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> c)
public void initFileLocator(org.apache.commons.configuration2.io.FileLocator loc)
initFileLocator
in interface org.apache.commons.configuration2.io.FileLocatorAware
initFileLocator
in class org.apache.commons.configuration2.XMLConfiguration
public DocumentBuilder createDocumentBuilder() throws ParserConfigurationException
createDocumentBuilder
in class org.apache.commons.configuration2.XMLConfiguration
ParserConfigurationException
- A configuration errorpublic void read(Reader in) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
read
in interface org.apache.commons.configuration2.io.FileBased
read
in class org.apache.commons.configuration2.XMLConfiguration
org.apache.commons.configuration2.ex.ConfigurationException
IOException
public void read(InputStream in) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
read
in interface org.apache.commons.configuration2.io.InputStreamSupport
read
in class org.apache.commons.configuration2.XMLConfiguration
org.apache.commons.configuration2.ex.ConfigurationException
IOException
private void delegateRead(SafeXMLConfiguration.XMLReader superRead) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
org.apache.commons.configuration2.ex.ConfigurationException
IOException
private boolean isXXERelatedException(org.apache.commons.configuration2.ex.ConfigurationException e)
e
- A ConfigurationException that was thrown when parsing the XML configuration file.Copyright © 2021 Apache NiFi Project. All rights reserved.