Redact masking policy (predefined)

The predefined Redact policy masks sensitive data in a selected column by replacing a specified number of leading characters with a redaction character of your choice.

The Redact policy replaces a specified number of leading characters in the input value with a redaction character. You can optionally wrap the redacted portion with a prefix and suffix string. The remainder of the input value beyond the redacted length is always preserved verbatim.

The output formula is: [Prefix] + [Redact Char × N] + [Suffix] + [Remaining input characters], where N is the Length value, or the full input length when Length is 0.

The policy accepts any non-NULL string value. There are no character set or length constraints on the input.

Invalid input values

The following input values are not valid for the Redact policy.

Table 1. Invalid input values for the Redact policy
Value Reason Behavior
NULL Null input value Output is NULL. No redaction is applied and no error is raised.

Configuration options

Use the following options to configure the Redact policy.

Redact Character (required)

The character or characters used to replace each individual input character in the redacted region. The replacement is applied one-for-one per input character — each input character in the redacted range is replaced by one full copy of the Redact Char string.

Important: If the Redact Char is more than 1 character (for example, *+), each single input character in the redacted region becomes multiple output characters, multiplying the length of the redacted portion by the length of the Redact Char string.
Length (required)

The number of characters to redact from the beginning of the input value.

Table 2. Length values and behavior
Value Behavior
0 Redacts the entire value. All input characters are replaced.
N (≤ input length) Redacts the first N characters. Remaining characters are preserved verbatim.
N (> input length) The redacted portion is padded to exactly N repetitions of the Redact Char, even if the input is shorter. No remainder characters exist.
Prefix (optional)
A literal string prepended to the output. The final output is: [Prefix][Redacted portion][Suffix][Remaining characters].
Suffix (optional)

A literal string inserted between the redacted portion and any remaining (non-redacted) characters. The final output is: [Prefix][Redacted portion][Suffix][Remaining characters].

Note: If Length is 0 (full redaction) or N exceeds the input length (padding case), there are no remaining characters. The Suffix is still emitted but appears at the end of the output with nothing after it.

Examples

All examples use the input value Example (7 characters).

Table 3. Redact policy examples
Input Redact Char Length Prefix Suffix Output
Example * 0 NA NA *******
Example * 4 NA NA ****ple
Example * 4 Before NA Before****ple
Example * 4 Before After Before****Afterple
Example * 10 NA NA **********
Example *+ 3 NA NA *+*+*+mple

API configuration

The API configuration is split across 2 locations. Only length is set in policy_metadata. All other options — charMask, prefix, and suffix — are set in the processor configuration block.

Configure the following fields in policy_metadata:

Table 4. Redact policy_metadata fields
Key UI field Type Description
length Length string Number of leading characters to redact. "0" redacts the entire value.

Configure the following fields in the processor configuration block:

Table 5. Redact processor configuration fields
Key UI field Type Description
charMask Redact Char String One or more characters used to replace each input character in the redacted region.
prefix Prefix String String prepended to the output. Use "" to apply no prefix.
suffix Suffix String String inserted between the redacted portion and the remainder. Use "" to apply no suffix.

The processor also contains preProcessorConfiguration and postProcessorConfiguration blocks, each with a javaScript field. These implement the length and remainder logic and must not be modified unless the redaction behavior itself is being changed.

Known limitations

The Redact masking policy has the following limitations.

Only leading characters are redacted
The Redact policy always redacts from the beginning of the value. There is no option to redact from the end, from a specific position in the middle, or to redact non-contiguous characters. If trailing or mid-string redaction is required, a custom transformation is needed.
Redact Char length multiplies output length
If the Redact Char is more than 1 character, the redacted portion of the output is longer than the corresponding portion of the input. For example, a 7-character input with a 2-character Redact Char and Length 0 produces a 14-character output. Downstream systems with fixed-width column constraints may be affected.
Suffix is emitted even when there is no remainder
When Length is 0 (full redaction) or Length exceeds the input length (padding case), there are no remaining characters after the redacted portion. The Suffix is still appended to the output. If a Suffix is only meaningful as a separator before remaining characters, this may produce unexpected output in those edge cases.