Creating schema-specific data masks

In the Recording Studio perspective or the Schema Library view of the Architecture School perspective, you can create a schema-specific data mask in your HCL OneTest API project. The mask will replace sensitive data in specified fields in messages recorded against the schema and, thus, prevent that data from appearing in any assets created from those messages.

About this task

If permissions in HCL OneTest API are being used to control which users can create, modify, or delete data masks, you may require permissions before you can create a data mask.

When creating a schema-specific data mask, there are three possible data masking methods that can be used:
  • Creating a fixed value substitution data mask involves entering a value to mask the "real value" of a field and that value will replace any data recorded for that field.
  • Creating a data source substitution data mask involves using a data source, such as a Microsoft Excel spreadsheet or a .csv file, to supply a list of values that can be used to replace recorded data.
    Note: Before you can create a data source substitution data mask, you must complete the following tasks:
    • Create a spreadsheet or a .csv file that contains a series of "fake" values that you want to use to mask real values of the relevant message element.
    • In the Test Factory perspective, create a new Excel data source and select the spreadsheet or .csv file that you created.
  • Creating an automatic value creation data mask involves selecting or creating a regular expression (Regex) and HCL OneTest API will create new values that match that expression.
Note: This topic describes only the Schema Library method of creating a schema-specific data mask.

Procedure

  1. Open the Schema Library view of the Architecture School perspective.
  2. On the left side of the view, select the relevant schema category.
  3. Under Schemas, select the relevant schema.
  4. In the Operation list on the Config tab, select the relevant operation.
  5. Select the text node of the relevant message element.
  6. Click the Data Masking tab (if required).
  7. Click Add.
    Note: A mask icon is displayed next to the selected message element.
  8. In the Masking Technique list, click the required option:
    1. If you want to create a fixed value substitution data mask, complete the following tasks:
      1. Click Fixed Value Substitution.
      2. In the Fixed Value field, enter the value that you want to mask the "real value" of the selected element.
    2. If you want to create a data source substitution data mask, complete the following tasks:
      1. Click Data Source Substitution.

        A Technique Configuration area is displayed.

        Note: The Technique Configuration area is not displayed if there is no Excel data source associated with your project.
      2. In the Data Source list, click the relevant Excel data source.
      3. In the Column list, click the column in the spreadsheet or .csv file that contains the "fake" values.
      4. Optional: Select the Enforce Data Integrity check box if you want the same data to always be masked by the same value.
      5. Click Return to Start (default) or Use Fixed Value:
        • Clicking Return to Start means that HCL OneTest API will loop through the data source to reuse masks.
        • Clicking Use Fixed Value means that HCL OneTest API will use a fixed value if there is an insufficient number of masks in the data source.
        • If you click Use Fixed Value, you must enter a value in the Fixed Value field.
    3. If you want to create an automatic value creation data mask, complete the following tasks:
      1. Click Automatic Value Creation.

        A Technique Configuration area is displayed.

      2. In the Regex field, you have two options:
        • Enter a Regex in the field if you want to create a new Regex for this data mask. For example, to generate 16-digit numbers to mask credit card numbers, you might enter \d{16} in the Regex field.
        • Alternatively, click Discover to select a regular expression already in use in your project.
      3. Click Test to verify that the Regex entered or selected provides the correct "fake" value format.

        For example, if masking credit card numbers, verify that a 16-digit number is displayed after you click Test.

      4. Optional: Select the Enforce Data Integrity check box if you want the same data to always be masked by the same value:
        • Selecting the Enforce Data Integrity check box enables the Label list, which enables you to use the same label for a pair of data masks that use the same Regex and thus enforce data integrity across multiple fields.
        • For example, if you want to mask credit card numbers, the label could be CardNumbers.
  9. Click Save.

Results

To verify that the new data mask works, use Recording Studio to record and view new events. On the Events View window, double-click a recorded event for the relevant operation:
  • If you selected fixed value data substitution, verify that the value of the relevant message element has been replaced by the value that you entered for the data mask.
  • If you selected data source substitution, verify that the value of the relevant message element has been replaced by a fake value from the specified data source. If you record more events, you should notice that the fake values displayed change as the real values change.
  • If you selected automatic value creation, verify that the value of the relevant message element has been replaced by a fake value from the specified Regex. If you record more events, you should notice that the fake values displayed change as the real values change.