Skip to main content
bkashava
Staff
Staff
July 28, 2026

Technical Tip: Mask sensitive fields in JSON payloads using Sensitive Data Logging

  • July 28, 2026
  • 0 replies
  • 94 views

Description

This article describes how to mask sensitive information contained in JSON request payloads using the Sensitive Data Logging feature in FortiWeb.

Scope

FortiWeb.

Solution

Applications frequently send sensitive information in JSON request bodies, including passwords, API tokens, authorization headers, device identifiers, and other confidential values.


If these requests trigger security events, the request payload may be retained in Attack Logs. To reduce the exposure of sensitive information, FortiWeb supports Sensitive Data Logging, which masks matching values before they are displayed in the GUI or forwarded to external logging platforms.


Examples of sensitive fields include:

  • Password.

  • Token.

  • accessToken.

  • refreshToken.

  • Authorization.

  • apiKey.

  • Secret.

  • OTP.

  • Pin.

  • imeiNum.

  • deviceId.


For JSON payloads, configure a General Mask rule.

  1. Go to Log & Report -> Log Config -> Sensitive Data Logging.

  2. Select Create New.

  3. Select General Mask.

  4. Configure a regular expression that matches the required JSON fields.


Example:

"(password|token|accessToken|refreshToken|authorization|apiKey|secret|otp|pin|imeiNum|deviceId)":"[^"]*"


abb936bb.png


The following example masks several sensitive JSON fields.


After the rule is enabled, newly generated logs replace matching values with masked characters while preserving the remainder of the troubleshooting request. For example:


Before masking:

ed8a9f2c.png


After masking:

4cd7237b.png


Limitations:

  • Sensitive Data Logging applies only to newly generated logs.

  • Existing logs are not modified.

  • For application/json payloads, General Mask is recommended because Field Mask is intended for HTTP form parameters such as application/x-www-form-urlencoded.

  • Masked values remain masked when included in subsequent log forwarding to supported destinations such as FortiAnalyzer and Syslog.

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!