Skip to main content
Feedback

XML Threat Protection Policy

The xml-threat-protection policy validates an XML request body by applying limits on XML structures such as elements, entities, attributes, and string values. When an invalid request is detected (the limit is reached), the request is considered a threat and rejected with a 400 BAD REQUEST.

Timing

On RequestOn Request Content
X

Configuration

PropertyRequiredDescriptionTypeDefault
maxElementsnoMaximum number of elements allowed in an XML document. For example, <root><a>1</a>2<b></b></root> has three elements.integer (-1 to specify no limit)1000
maxDepthnoMaximum depth of the XML structure. For example, <root><a><b>1</b></a></root> has a depth of two.integer (-1 to specify no limit)100
maxLength noMaximum number of characters allowed for the whole XML document.integer (-1 to specify no limit)1000
maxAttributesPerElementnoMaximum number of attributes allowed for a single XML element.integer (-1 to specify no limit)100
maxAttributeValueLengthnoMaximum length of individual attribute values.integer (-1 to specify no limit)100
maxChildrenPerElementnoMaximum number of child elements for a given element. For example, <code><root><a><b>1</b><c>2</c></a></root></code> an element has two children.integer (-1 to specify no limit)100
maxTextValueLengthnoMaximum length of individual text value.integer (-1 to specify no limit)100
maxEntitiesnoMaximum number of entity expansions allowed. XML entities are a type of macro and are vulnerable to entity expansion attacks.integer (-1 to specify no limit)100
maxEntityDepthnoMaximum depth of nested entity expansions allowed.integer (-1 to specify no limit)100
allowExternalEntitiesnoWhether to allow the inclusion of external entities. WARNING: Since XML can be vulnerable to XXE injection, only enable this feature if necessary.booleanfalse

Errors

HTTP status code

CodeMessage
400 Bad RequestApplies to invalid XML structure, maximum xml elements exceeded, maximum xml depth exceeded, maximum xml length exceeded, maximum attributes per element exceeded, maximum attribute value length exceeded, maximum children per element exceeded, maximum text value length exceeded, maximum xml entities exceeded, maximum xml entity depth exceeded, external entity is used when prohibited.
On this Page