Skip to main content

What is Body Data?

Body data is the main content sent in POST, PUT, and PATCH requests. It contains the actual information being submitted - form data, JSON payloads, file uploads, or API commands.
MDN Web DocsRead more on HTTP message body.

Common Body Data Formats

JSON (application/json)

Form Data (application/x-www-form-urlencoded)

Multipart (multipart/form-data)

XML (application/xml)

Plain Text (text/plain)

Using Body Data in Policies

Basic Examples

Check for specific field:
Validate required fields:

Advanced JSON Navigation

For nested JSON objects, use path notation:
Access with: user.profile.email or user->profile->email

Array Access

Access with:
  • items[0].name - First item’s name
  • items[].name - Any item’s name

Security Patterns

SQL Injection Detection

XSS Prevention

Command Injection

Security AlertNever trust body data! Always validate and sanitize on the server side, even with Esper policies in place.

Size and Content Validation

Prevent Large Payloads

Enforce Content Types

Best Practices

DO:

  • Validate structure - Ensure expected fields exist
  • Check data types - Numbers should be numbers
  • Limit sizes - Prevent resource exhaustion
  • Sanitize inputs - Block dangerous characters
  • Log suspicious patterns - For security analysis
  • Use specific paths - Target exact fields in JSON

DON’T:

  • Parse complex formats in policies - Do that server-side
  • Store sensitive data in logs
  • Trust client validation - Always verify server-side
  • Block common words - Too many false positives
  • Ignore encoding - Base64 can hide attacks

Working with Different Content Types

JSON API Protection

Form Submission Validation

File Upload Security

Common Attack Patterns

Password Spraying

Credential Stuffing

API Abuse

Encoding Challenges

Base64 Detection

URL Encoding

Troubleshooting

“Can’t access nested fields”
  • Check JSON structure
  • Verify path notation
  • Ensure proper parsing
  • Look for array vs object
“Policy not matching body content”
  • Confirm Content-Type header
  • Check encoding (UTF-8, etc.)
  • Verify body size limits
  • Test with exact payload

Advanced Patterns

Business Logic Validation

Data Consistency Checks