Data Masking Functions
This feature is only available after version 2.8.0
Canner Enterprise currently provides built-in data masking functions, allowing users to directly use these functions to mask personal data during data analysis, in order to protect sensitive data.
Currently, the supported types of personal data that can be masked include:
- Address
- Phone Number
- Name
- Date of Birth
- Identification Number
Data Masking Functions
In Canner Enterprise, you can use redact
to replace original data, such as replacing phone numbers with *
symbols. Currently, the following types of replacement methods are supported:
1. redact(string, pattern, replacement)
Redact the value with the replacement if matching the pattern that includes a regular expression or a built-in pattern.
regular expression
demo=> select redact('johndoe@example.com','^(.*)@(.*)$', '*****@***.com');
redact
---------------
*****@***.com
(1 row)
built-in pattern
Refer for all built-in patterns.
demo=> select redact('johndoe@example.com','EMAIL_NAME', '*****');
redact
-------------------
*****@example.com
(1 row)
2. redact(string, struct)
Redact the value by the struct that is a JSON object with a pattern as key and a replacement as value. Here is an example of struct: {"EMAIL_NAME":"OOO", "^(.)([0-9]{3})(.+)$": "XXXX"}
demo=> select redact('johndoe@example.com','{"EMAIL_NAME":"*****","EMAIL_DOMAIN_LAST_3_PRESERVED":"yyds."}');
redact
----------------
*****@yyds.com
(1 row)
Built-in pattern
Category | Pattern Name | Input | Output | Replacement |
---|---|---|---|---|
Address | TAIWAN_ADDRESS_WITH_CITY_AND_DISTRICT_AND_STREET_KEPT | 台北市中正區忠孝東路一段1號 | 台北市中正區忠孝東路一段* | * |
Address | TAIWAN_ADDRESS_WITH_CITY_AND_DISTRICT_KEPT | 台北市中正區忠孝東路一段1號 | 台北市中正區* | * |
Address | TAIWAN_ADDRESS_WITH_CITY_KEPT | 台北市中正區忠孝東路一段1號 | 台北市* | * |
Address | ADDRESS_WITH_COUNTRY_ZIPCODE_STATE_KEPT | 725 5th Ave, New York, NY 10022, United States | * , * , NY 10022, United States | * |
Address | ADDRESS_WITH_COUNTRY_KEPT | 725 5th Ave, New York, NY 10022, United States | * , * , * * , United States | * |
Phone Number | TAIWAN_PHONE_NUMBER | 0912345678 | 09* | * |
Phone Number | PHONE_NUMBER_WITH_LAST_3_KEPT | 886912345678 | * 678 | * |
Phone Number | PHONE_NUMBER_WITH_LAST_4_KEPT | 02 2321 4311 | * 4311 | * |
Phone Number | PHONE_NUMBER_WITH_COUNTRY_CODE_KEPT | +886912345678 | +886* | * |
Name | CHINESE_NAME_SECOND_CHAR | 王大錘 | 王* 錘 | * |
Name | CHINESE_NAME_LAST_PRESERVED | 王大錘 | * 錘 | * |
Name | CHINESE_NAME_FIRST_PRESERVED | 王大錘 | 王* | * |
Name | LAST_NAME_PRESERVED | John Doe | * Doe | * |
Name | FIRST_NAME_PRESERVED | John Doe | John * | * |
Date of Birth | DATE_OF_BIRTH_WITH_MONTH_AND_DAY_KEPT_ROC_ERA | 84/04/01 | * /04/01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_AND_DAY_KEPT_ROC_ERA | 84/04/01 | 84/* /01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_AND_MONTH_KEPT_ROC_ERA | 84/04/01 | 84/04/* | * |
Date of Birth | DATE_OF_BIRTH_WITH_DAY_KEPT_ROC_ERA | 84/04/01 | * /* /01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_MONTH_KEPT_ROC_ERA | 84/04/01 | * /04/* | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_KEPT_ROC_ERA | 84/04/01 | 84/* /* | * |
Date of Birth | DATE_OF_BIRTH_WITH_MONTH_AND_DAY_KEPT_ISO_8601 | 1970-01-01 | * -01-01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_AND_DAY_KEPT_ISO_8601 | 1970-01-01 | 1970-* -01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_AND_MONTH_KEPT_ISO_8601 | 1970-01-01 | 1970-01-* | * |
Date of Birth | DATE_OF_BIRTH_WITH_DAY_KEPT_ISO_8601 | 1970-01-01 | * -* -01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_MONTH_KEPT_ISO_8601 | 1970-01-01 | * -01-* | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_KEPT_ISO_8601 | 1970-01-01 | 1970-* -* | * |
Date of Birth | DATE_OF_BIRTH_WITH_MONTH_AND_DAY_KEPT | 1970/01/01 | * /01/01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_AND_DAY_KEPT | 1970/01/01 | 1970/* /01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_AND_MONTH_KEPT | 1970/01/01 | 1970/01/* | * |
Date of Birth | DATE_OF_BIRTH_WITH_MONTH_KEPT | 1970/01/01 | * /01/* | * |
Date of Birth | DATE_OF_BIRTH_WITH_DAY_KEPT | 1970/01/01 | * /* /01 | * |
Date of Birth | DATE_OF_BIRTH_WITH_YEAR_KEPT | 1970/01/01 | 1970/* /* | * |
Identification Number | TAIWAN_ID_NUMBER_KEEP_LETTER_AND_LAST_4_PRESERVED | F123456789 | F* 6789 | * |
Identification Number | TAIWAN_ID_NUMBER_LETTER_PRESERVED | F123456789 | F* | * |
Email | EMAIL_DOMAIN_LAST_3_PRESERVED | johndoe@example.com | johndoe@* com | * |
Email | EMAIL_DOMAIN_LAST_1_PRESERVED | johndoe@example.com | johndoe@* m | * |
Email | EMAIL_DOMAIN_FIRST_3_PRESERVED | johndoe@example.com | johndoe@exa* | * |
Email | EMAIL_DOMAIN_FIRST_1_PRESERVED | johndoe@example.com | johndoe@e* | * |
Email | EMAIL_DOMAIN | johndoe@example.com | johndoe@* | * |
Email | EMAIL_NAME_LAST_3_PRESERVED | johndoe@example.com | * doe@example.com | * |
Email | EMAIL_NAME_LAST_1_PRESERVED | johndoe@example.com | * e@example.com | * |
Email | EMAIL_NAME | johndoe@example.com | * @example.com | * |
Email | EMAIL_NAME_FIRST_1_PRESERVED | johndoe@example.com | j* @example.com | * |
Email | EMAIL_NAME_FIRST_3_PRESERVED | johndoe@example.com | joh* @example.com | * |