Description

The FileMaskMultiBlockReceiver will mask targeted values within an existing document using Synthetic Data Masking (SDM). The document may contain one or more blocks (as a set of lines that make up one report) where each block contains a number of lines 1 to N, where N is the same number of lines within each report. 


In this Article


When Should this Receiver Be Used?

  • Any time sensitive values within a fixed file need to be masked. 
  • Masking can be performed when the values are on a single line (single block) or multiple lines (multiblock).

How to Mask a Fixed File

Note: Use cases are provided later in this article.

  1. Select a Project and Project Version.
  2. Create a Domain with Attributes (i.e., Values) to be masked.
  3. Remove the id Attribute from the Domain if not being used.
  4. Change the Domain's loopCount to match the number of records in the source file. 
  5. (Optional) Modify assigned Generators. 
  6. Assign the FileMaskMultiBlockReceiver to the Domain.
  7. Configure the Receiver's Parameters (source file Location, etc.).
  8. Configure the Receiver Attribute Property Keys.
  9. Create a Scenario for the Domain and download it.
  10. Run the command at the command line to generate a masked fixed file. 

 

Receiver Parameters

The following parameters may be configured for the FileMaskMultiBlockReceiver. Items with an asterisk* are required. 

  • sourceFileName* - Defines the name of the file to mask. 
  • sourcePath* - Defines the base path where the source file to be masked is located. 
  • sourceSubDirectory - Defines an optional subdirectory under sourcePath where the source file is located. 
  • destPath* - Defines the base path where the clean masked file will be stored. 
  • destSubDirectory - Defines an optional subdirectory under destPath where the clean masked file will be stored. 
    • IMPORTANT: If no value is entered for the destSubDirectory parameter, the source file will be overwritten with the masked values. 
  • linesPerBlock* - Defines the number of lines within a block of lines before the next block of lines starts within the file. 
  • skipTopLineCount - Defines the number of lines to skip for masking from the top.
  • skipBottomLineCount - Defines the number of lines to skip for masking from the bottom. 
  • skipUnmaskedLines - Defines whether to skip the unmasked line from your destination file or not.
  • removeOnDisable - Defines whether to remove the disabled line from your destination file or not.


Receiver Attribute Property Keys

The Receiver defines four property keys that can be modified on any of its associated Domain Attributes:

  • include - Defines whether the Domain Attribute will be used for masking. When 'true', the values will be masked for that Attribute.
  • lineNumber - Defines the line number within a block of lines where the target is located. 
  • startPosition - Defines the column position within a given line where the target starts. The first value should be '0'.
  • length - Defines the length of the target.


Use Case 1 - Mask Single Block in File

Record information is on a single line within the file. The last name, username, and password for each record must be masked in the generated output file. 



Step 1- Add a Domain with the Attribute(s) to be Masked

A Mask Domain has been created with the three required Attributes: lastName, username, and password



Step 2 - Remove the id Attribute from the Domain

An id Attribute will be created automatically when the Domain is created. This Attribute needs to be removed from the Domain if it will not be used. You can use the Trash Can icon to do that.
 

Step 3 - Change the Domain loopCount

The loopCount will need to match the number of records within the file.


Step 4 - (Optional) Assign or Modify the Generator

Generator parameters can be modified, or a different Generator can be assigned for each Attribute (i.e., value) before generating the masked output file. To learn more, please see the following pages: 


Step 5 - Add FileMaskMultiBlockReceiver to Domain

Add the Receiver to the Domain from the Domain Dashboard:


Step 6 - Configure Receiver Parameters

The following Parameters have been configured in this example: 

  • sourceFileName - SampleFixedFile.txt
  • destSubDirectory - Masked Output (where the masked output file will be saved)
  • linesPerBlock - '1' has been entered since the data is in a single block.


Step 7 - Configure the Receiver Attributes Property Keys

You will need to configure the Receiver Attribute's Property Keys. Click on the first Attribute (i.e., lastName) as shown below. 



Modify each parameter as needed. Click the Save & Next button to save the change and move to the next Attribute.



Note: The startPosition parameter value can be determined by placing the cursor at the starting position of the value to be masked within the file. (see below)


The completed configuration is shown below.


 

Step 8 - Create a Scenario for the Domain

A Scenario must be created for the Domain and downloaded to the user's local machine from the dashboard.



Step 9 - Use the genrocket -r Command to Generate the Masked Output File


Source File

 

Masked Output File

Items highlighted in yellow have been masked.


Use Case 2 - Mask Single Block in File with a Header/Footer

The record information is still in a single line; however, the file has a header and footer. They should appear in the output file and not be masked. 

Note: The project setup and the same data will be masked in the file as shown in Use Case 1 above.

 

Additional Receiver Parameters to Configure

To skip a header or footer within the file during masking, use the following parameters:

  • skipTopLine - Enter a value for the number of lines from the top of the file that should not be masked.
  • skipBottomLine - Enter a value for the number of lines from the bottom of the file that should not be masked.
    .


Masked Output File

The lastName, username, and password values are still masked with synthetically generated data; however, the header and footer were skipped and still appear the same in the output file.


Use Case 3 - Skip Unmasked Lines within the Source File

The skipUnmaskedLines parameter can be set to 'true' to skip unmasked lines in the generated output file. This example builds on Use Case 2 above. The header/footer in the source file should be excluded from the output file. 


When this parameter is 'true,' unmasked lines will not appear within the generated output file. In this case, the header and footer will not be included.



Source File

 

Masked Output File

Items highlighted in yellow have been masked.


Example 4 - Multiblock File Mask (Mask Multiple Values)

Record information may exist in multiple lines of a fixed file (multiblock). The source file will appear as shown below. Items in black must be masked for each record in the file. 



Note: All the steps are the same as in previous examples, except those outlined below.


Step 1 - Create Additional Attributes

An additional planNumber Attribute has been added to mask the required value on line 2. 



Step 2 - Change linesPerBlock Receiver Parameter Value

The linesPerBlock Parameter must be set to "2" because each record's information spans two lines within the file. 



Step 3 - Configure the New Attribute(s) Property Keys

The planNumber Attribute's Property Keys must be configured: lineNumber, startPosition, and length.



Source File


Masked Output File

The data values highlighted in yellow have been masked for each record in the file: