---
schema_version: "1"
id: d5b5feb04fa90994b85ffbd02d393878492a480eb8f09382bbd45d1aad5e94b0
title: JSON Threat Protection Policy
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-gateway/policies-included-json-threat-protection.md
canonical_url: https://docs.mulesoft.com/mule-gateway/policies-included-json-threat-protection
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 33a724177213da224fc33c10f652ac3f7d895686ebe0d86edbd648f8a7e4f2fb
description: MuleSoft Documentation Site
latest: true
---
---
product: Mule Gateway
keywords: json threat protection, api gateway, mule gateway, gateway, policy
---

# JSON Threat Protection Policy

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

<table><colgroup><col> <col></colgroup><tbody><tr><td><p><strong>Policy Name</strong></p></td><td><p>JSON Threat Protection</p></td></tr><tr><td><p><strong>Summary</strong></p></td><td><p>Protects against malicious JSON in API requests</p></td></tr><tr><td><p><strong>Category</strong></p></td><td><p>Security</p></td></tr><tr><td><p><strong>First Mule version available</strong></p></td><td><p>v3.8.0</p></td></tr><tr><td><p><strong>Returned Status Codes</strong></p></td><td><p>400 - Bad Request</p></td></tr></tbody></table>

## Summary

> [!NOTE] The JSON Threat Protection policy does not support SOAP APIs.

Applications processing JSON requests are susceptible to attacks characterized by unusual inflation
of elements and nesting levels. Attackers use recursive techniques to consume memory resources.
Dramatic swings in the size of the application data often signal a security problem. The JSON Threat
Protection policy helps protect your applications from such intrusions.

If you find that attacks on your Anypoint Platform setup are difficult to detect, design your
services architecture with layers of protection in addition to JSON Threat Protection.

> [!NOTE] The JSON Threat Protection policy doesn’t support multi-part form requests.

## Configuring Policy Parameters

### Mule Gateway

When you apply the JSON Threat Protection policy to your API from the UI, the following parameters
are displayed:

<table><colgroup><col> <col> <col> <col></colgroup><tbody><tr><td><p><strong>Field</strong></p></td><td><p><strong>Description</strong></p></td><td><p><strong>Default</strong></p></td><td><p><strong>Required</strong></p></td></tr><tr><td><p>Maximum Container Depth</p></td><td><p>Specifies the maximum nested depth. JSON allows you to nest the containers (object and array) in any order to any depth</p></td><td><p>-1</p></td><td><p>false</p></td></tr><tr><td><p>Maximum String Value Length</p></td><td><p>Specifies the maximum length of a string value</p></td><td><p>-1</p></td><td><p>false</p></td></tr><tr><td><p>Maximum Object Entry Name Length</p></td><td><p>Specifies the maximum string length of an object’s entry name</p></td><td><p>-1</p></td><td><p>false</p></td></tr><tr><td><p>Maximum Object Entry Count</p></td><td><p>Specifies the maximum number of entries in an object</p></td><td><p>-1</p></td><td><p>false</p></td></tr><tr><td><p>Maximum Array Element Count</p></td><td><p>Specifies the maximum number of elements in an array</p></td><td><p>-1</p></td><td><p>false</p></td></tr></tbody></table>

> [!NOTE] A value of -1 indicates that the field value has no limits.

## Payload Example

If your payload contains the following example JSON:

{ "Players":\[ { "Name":"Sachin", "Email":"sachin.tendulkar@example.com" }, { "Name":"Suryakumar",
"email":"Surya@example.com" }, { "Name":"Bhuvi", "email":"bhuvi@example.com" }, { "Name":"Jonty",
"Email":"jonty@example.com" } \] }

The policy defines the example parameter values as follows:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Value</th><th>Explanation</th></tr></thead><tbody><tr><td><p>Maximum Container Depth</p></td><td><p>3</p></td><td><p>The depth of the <code>Name</code> and <code>Email</code> entries</p></td></tr><tr><td><p>Maximum String Value Length</p></td><td><p>28</p></td><td><p>The length of <code>sachin.tendulkar@example.com</code></p></td></tr><tr><td><p>Maximum Object Entry Name Length</p></td><td><p>7</p></td><td><p>The length of the <code>Players</code> object entry name</p></td></tr><tr><td><p>Maximum Object Entry Count</p></td><td><p>2</p></td><td><p>The number of entries in each <code>Players</code> object</p></td></tr><tr><td><p>Maximum Array Element Count</p></td><td><p>4</p></td><td><p>The number of elements in the <code>Players</code> array</p></td></tr></tbody></table>
