How to mask numbers in Zendesk

Answered

4 Comments

  • Brett - Community Manager
    Comment actions Permalink

    Hey Anton,

    It looks like there's an online regex tester that you can try using to generate your code. Here's an example here: RegularExpressions101

    This was actually pointed out to me by one of our Moderators and seems to come in handy :) 

    I hope this helps!

    0
  • Kay
    Comment actions Permalink

    Hi Anton,

    You probably need development for this, because you need to alter the script.js on your HelpCenter theme.
    The regex type of custom field only allows for checking the input, not replacing.

    1. Make sure that str get's the value from your specific custom field
    2. Set the subst character with the character you want to replace
    3. Replace the field value with the masked value.
    4. Attach the function to form on submit, or custom field keypress event listener.

    const regex = /(?=\d{5})\d/gmi;
    const str = `166557649435345`;
    const subst = `*`;

    // The substituted value will be contained in the result variable
    const masked = str.replace(regex, subst);
    console.log('Masked result: ', masked);


    - Kay
    Ps. Thanks to @Dan R. co-created this response!

     

    1
  • Dan Cooper
    Comment actions Permalink

    Hi Anton, 

    The Credit Card field provided by Zendesk is a field that has some extra security layered into it that makes it PCI compliant. This field goes to an extent that it doesn't store the full credit card at all in order to make sure that credit card data can't be breached. While you can do things to hide values with javascript in a help center theme, you might also want to be sensitive to any implementation used to hide characters in the help center theme that doesn't take into consideration the sensitive nature of SSN for end users.  Typically being able to hide a value via javascript can also be reversed using similar javascript.

    0
  • Anton Van der meyden
    Comment actions Permalink

    Hello,

     

    @Bret @Kay @Dan Thank you all for your help.

     

    Bret the the link is really good. Dan I had hoped to edit the credit card field as  this has extra layer of security. For example instead of using 12-16 digits for a credit card use 9 for an SSN and mask the first 5 digits.

    As this is not possible at the moment and you advised the security risk of masking numbers through Javascript I will wait until the possibility of the credit card field can be edited for extra security.

     

    Thank you all for your help.

    Anton

    0

Please sign in to leave a comment.

Powered by Zendesk