JSON Threat Protection Policy in MuleSoft

Published on
June 7, 2021
Author
MuleSoft Integration Team
JSON Threat Protection Policy in MuleSoft

JSON Threat Protection Policy in MuleSoft is a protection policy for the APIs to defend them from miscellaneous HTTP requests which are inflated to bring down the APIs server. For example, a request can contain an inflated request in which they can increase the JSON depth, object name and values, and array length, which may result in memory or performance issues. Therefore, such requests should be denied at the entry-level only.

This policy usually defines the proper structure for the JSON request we will receive, e.g., Depth, Object name and value length, and Array size.

Steps to implement the JSON Threat Policy:

  1. Select the JSON THREAT POLICY, and it’s a version from the Apply New Policy in the API Manager.

JSON threat protection

2. Configure the various properties:

  • Maximum Container Depth – Specifies the maximum nested depth. JSON allows you to nest the containers (object and array) in any order to any depth
  • Maximum String Value Length – Specifies the maximum length of a string
  • Maximum Object Entry Name Length – Specifies the maximum string length of an object’s entry name
  • Maximum Object Entry Count – Specifies the maximum number of entries in an object
  • Maximum Array Element Count – Specifies the maximum number of elements in an array

Threat protection policy

3. Now when we make a post request an error message is being shown, depicting that wrong properties are being passed according to the configured policy.

4. We need to set the properties in the following way:

  • Maximum Container Depth – 3 – which is root -> address -> (addressLine1, addressLine2, city, state,zipCode, country)
  • Maximum String Value Length – 15 – e.g. max length value in JSON – molly@mue.com
  • Maximum Object Entry Name Length – 12 – maximum string length of an object’s entry name in JSON – addressLine1
  • Maximum Object Entry Count – -1 – Specifies that there can be n number of entries in an object.
  • Maximum Array Element Count – 2

{
  "customerID": "1fe1c22",
  "firstName": "Molly",
  "lastName": "Mule",
  "displayName": "Molly ",
  "address": {
    "addressLine1": "123 Street",
    "addressLine2": "Apt.#3D",
    "city": "San Francisco",
    "state": "California",
    "zipCode": "94110",
    "country": "United States"
  },
  "phone": "415-000-0000",
  "email": "molly@mue.com",
  "ssn": "321-654-0987",
  "dateOfBirth": "1990-09-04"
}

5. Now give the post request and we are able to access the API.

Thanks for reading, find more MuleSoft best practices at Caelius Consulting Resource Centre.

Recent Blogs

Integrating Salesforce with MuleSoft: A Practical Guide
BlogApr 3, 2026

Integrating Salesforce with MuleSoft: A Practical Guide

Salesforce and MuleSoft integrations are often presented as straightforward connector setups but the real complexity lies in authentication design and access control. This guide walks through a clean, production-ready approach to setting up a secure integration between Salesforce and MuleSoft. Why This Matters More Than Ever With recent updates in Salesforce, basic authentication is being… Continue reading Integrating Salesforce with MuleSoft: A Practical Guide

Read More
Blog
5 min read

Integrating Salesforce with MuleSoft: A Practical Guide

Salesforce and MuleSoft integrations are often presented as straightforward connector setups but the real complexity lies in authentication design and access control. This guide walks through a clean, production-ready approach to setting up a secure integration between Salesforce and MuleSoft. Why This Matters More Than Ever With recent updates in Salesforce, basic authentication is being… Continue reading Integrating Salesforce with MuleSoft: A Practical Guide

Read More
Designing for Reality: Integrating 837 Claims When X12 Meets Production
BlogFeb 11, 2026

Designing for Reality: Integrating 837 Claims When X12 Meets Production

Designing 837 Claim Integration for Real-World Healthcare Systems When it comes to 837 claim integration, most architects assume the X12 specification guarantees predictability. On paper, the 837 Professional, Institutional, and Dental transactions look clean and orderly. In production? Not even close. Real-world 837 files behave differently across trading partners. Loops appear conditionally. Repeatable segments shift… Continue reading Designing for Reality: Integrating 837 Claims When X12 Meets Production

Read More
Blog
5 min read

Designing for Reality: Integrating 837 Claims When X12 Meets Production

Designing 837 Claim Integration for Real-World Healthcare Systems When it comes to 837 claim integration, most architects assume the X12 specification guarantees predictability. On paper, the 837 Professional, Institutional, and Dental transactions look clean and orderly. In production? Not even close. Real-world 837 files behave differently across trading partners. Loops appear conditionally. Repeatable segments shift… Continue reading Designing for Reality: Integrating 837 Claims When X12 Meets Production

Read More
AI-Driven PDF Parsing in Salesforce
BlogDec 4, 2025

AI-Driven PDF Parsing in Salesforce

Introduction For the current digital ecosystem, data is an important aspect for decision-making. Yet, for many organizations, a significant portion of this valuable data remains locked away in unstructured formats. Organizations handle thousands of PDF documents daily — ranging from contracts and invoices to lab reports, quotations, and service agreements. Traditionally, extracting structured data from… Continue reading AI-Driven PDF Parsing in Salesforce

Read More
Blog
6 min read

AI-Driven PDF Parsing in Salesforce

Introduction For the current digital ecosystem, data is an important aspect for decision-making. Yet, for many organizations, a significant portion of this valuable data remains locked away in unstructured formats. Organizations handle thousands of PDF documents daily — ranging from contracts and invoices to lab reports, quotations, and service agreements. Traditionally, extracting structured data from… Continue reading AI-Driven PDF Parsing in Salesforce

Read More
Compression Namespace in Apex: A Powerful New Salesforce Feature
BlogNov 5, 2025

Compression Namespace in Apex: A Powerful New Salesforce Feature

Introduction Working with documents inside Salesforce has always challenged developers because of the platform’s multitenant constraints. Previously, packaging and sending files in a compact form required external services, like an AWS Lambda function, that retrieved files via API and then compressed them. With the introduction of the Compression Namespace and the powerful pre-defined Apex functions,… Continue reading Compression Namespace in Apex: A Powerful New Salesforce Feature

Read More
Blog
5 min read

Compression Namespace in Apex: A Powerful New Salesforce Feature

Introduction Working with documents inside Salesforce has always challenged developers because of the platform’s multitenant constraints. Previously, packaging and sending files in a compact form required external services, like an AWS Lambda function, that retrieved files via API and then compressed them. With the introduction of the Compression Namespace and the powerful pre-defined Apex functions,… Continue reading Compression Namespace in Apex: A Powerful New Salesforce Feature

Read More