Reltio Connect

 View Only
Expand all | Collapse all

Utilizing the 2025.1 Data Masking capablity to mask all but the last 4 characters

  • 1.  Utilizing the 2025.1 Data Masking capablity to mask all but the last 4 characters

    Posted 15 days ago

    We had a requirement to mask several attributes where the  mask should always leave the least four characters visible like this

    • String: 123456789
    • Masked: *****6789

    However, we ran into a scenario where a string could vary in length within the same attribute. This meant the standard masking option First "N" left more than four characters unmasked as the initial length increased, and the Last "N" option provided the opposite of the desired result:

    • First 5 Masked:
      • String: 123456789
        • Masked: *****6789
      • String: 1234567890
        • Masked: *****67890
    • Last 4 Masked
      • String: 123456789
        • Masked: 12345****

    To meet our requirement, we used the Custom Masking option with the regular expression ".{4}$" and "Masked match part" set to false, like this in the UI:

    The preview shows that the last four characters are left unmasked, and this can be directly validated with inputs of various lengths.

    The JSON config would be like this:

    "masking": {
    	"regexPattern": ".{4}$",
    	"maskMatched": false
    }

    The "4" in the curly braces determines how many characters are left unmasked and can be updated per requirement.

    Hope this helps others.



    ------------------------------
    Thanks,

    Wes Corbin
    Wex Inc
    Portland ME
    ------------------------------


  • 2.  RE: Utilizing the 2025.1 Data Masking capablity to mask all but the last 4 characters

    Posted 14 days ago

    Hi,

    Utilizing the 2025.1 Data Masking Capability to Mask All but the Last 4 Characters

    We had a requirement to mask several attributes while always leaving the last four characters visible. For example:

    • Original String: 123456789

    • Masked String: *****6789

    The Challenge

    The attribute values varied in length, which made it tricky to use standard masking options:

    • First "N" Masked:

      • Original: 123456789 → Masked: *****6789

      • Original: 1234567890 → Masked: *****67890

    • Last "N" Masked:

      • Original: 123456789 → Masked: 12345****

    Neither of these options met our requirement, as the first option masked inconsistently based on length, and the last option hid the critical trailing characters.

    The Solution

    We leveraged the Custom Masking option with a regular expression to precisely control what remained visible. The configuration looked like this:

    • Regular Expression: . {4}$

    • Masked Match Part: False

    Step-by-Step Configuration

    1. Access the Data Masking Settings:

      • Navigate to the Data Masking section in your platform's security settings.

    2. Create a New Masking Rule:

      • Click Add New Rule.

      • Enter a descriptive name for your rule (e.g., "Mask All but Last 4 Characters").

    3. Select the Custom Masking Option:

      • Choose Custom Masking from the masking options.

    4. Set Up the Regular Expression:

      • In the Regular Expression field, enter: . {4}$

    5. Configure Masking Behavior:

      • Set Masked Match Part to False to keep the matched portion (last 4 characters) visible.

      • Define your mask character (e.g., *) or leave the default.

    6. Apply the Rule to Attributes:

      • Choose the attributes you want to apply this rule to (e.g., account numbers, customer IDs).

    7. Test the Masking Rule:

      • Use sample strings of varying lengths to verify the mask works as expected.

      • Confirm the result consistently hides all but the last 4 characters.

    8. Save and Deploy:

      • Save the masking rule.

      • Deploy your changes to make the masking active in your environment.



    ------------------------------
    Varsha Periyasamy
    MDM Developer
    Majix Solutions Inc
    ------------------------------