Skip to main content
Version: Next

Masking

Mask a value using one of the masking rules depending on your domain. NULL values are kept.

Parameters

NameDescriptionDefaultRequiredSupported DB types
columnThe name of the column to be affectedYestext, varchar, char, bpchar, citext
typeData type of attribute (default, password, name, addr, email, mobile, tel, id, credit, url, postcode)defaultNo-

Description

The Masking transformer replaces characters with asterisk * symbols depending on the provided data type. If the value is NULL, it is kept unchanged. It is based on ggwhite/go-masker and supports the following masking rules:

TypeDescription
defaultReturns * symbols with the same length, e.g. input: test1234 output: ********
nameMasks the second letter the third letter in a word, e. g. input: ABCD output: A**D
passwordAlways returns ************
addressKeeps first 6 letters, masks the rest, e. g. input: Larnaca, makarios st output: Larnac*************
emailKeeps a domain and the first 3 letters, masks the rest, e. g. input: ggw.chang@gmail.com output: ggw****@gmail.com
mobileMasks 3 digits starting from the 4th digit, e. g. input: 0987654321 output: 0987***321
telephoneRemoves (, ), , - chart, and masks last 4 digits of telephone number, then formats it to (??)????-????, e. g. input: 0227993078 output: (02)2799-****
idMasks last 4 digits of ID number, e. g. input: A123456789 output: A12345****
credit_cartMasks 6 digits starting from the 7th digit, e. g. input 1234567890123456 output 123456******3456
urlMasks the password part of the URL, if applicable, e. g. http://admin:mysecretpassword@localhost:1234/uri output: http://admin:xxxxx@localhost:1234/uri
postcodeKeeps first 2 characters, masks the rest, e. g. input: SW1A 1AA output: SW******

Example: Masking employee national ID number

In the following example, the national ID number of an employee is masked.

Masking transformer example
- schema: "humanresources"
name: "employee"
transformers:
- name: "Masking"
params:
column: "nationalidnumber"
type: "id"
Expected result

| column name | original value | transformed |
|------------------|----------------|-------------|
| nationalidnumber | 295847284 | 295847**** |
Copyright © GreenMask 2026