Managing Dynamic Masking Policies
After a dynamic masking policy is created in DataArts Security, the system synchronizes the policy to the data source. The data source dynamically masks data columns based on specified rules. When the users and user groups specified in the policy access sensitive data, the system returns the data that is dynamically masked by the data source to protect sensitive data from being disclosed.
Note that dynamic masking policies configured for a DataArts Studio instance are visible to and take effect for all the workspaces of the instance.
Prerequisites
- Before creating an MRS Hive data masking policy, ensure that:
- An MRS Ranger data connection has been created in Management Center. For details, see Creating a DataArts Studio Data Connection.
- User information has been synchronized from IAM to the data source. For details, see Synchronizing IAM Users to the Data Source.
- Before creating a GaussDB(DWS) data masking policy, ensure that:
- A GaussDB(DWS) data connection has been created in Management Center. For details, see Creating a DataArts Studio Data Connection.
- User information has been synchronized from IAM to the data source. For details, see Synchronizing IAM Users to the Data Source.
- The CN and DN values of the feature_support_options parameter of the GaussDB(DWS) cluster have been changed to enable_data_redaction, which enables data masking for GaussDB(DWS). For details, see Modifying Database Parameters.
- The account in the connection must have the GRANT permission of the target table. (By default, only the owner of a database object or system administrator can run the GRANT command to grant the object permissions to other users.)
- MRS Hive and GaussDB(DWS) dynamic masking policies are associated with specified users or user groups on data sources. Therefore, if you want to use the current user for identity authentication to make the dynamic masking policies take effect during script execution and job tests in DataArts Factory, you must enable fine-grained authentication by referring to Enabling Fine-grained Authentication.
- If you want to view sensitive fields during the creation of a data masking policy, you need to create a sensitive data discovery task in advance and change the statuses of sensitive data fields to valid on the Sensitive Data Distribution page. For details, see Discovering Sensitive Data and Viewing Sensitive Data Distribution.
Constraints
- Only the DAYU Administrator, Tenant Administrator, or data security administrator can create, modify, or delete dynamic masking policies. Other common users do not have permission to perform these operations.
- MRS Hive and GaussDB(DWS) dynamic masking policies are associated with specified users or user groups on data sources. Therefore, if you want to use the current user for identity authentication to make the dynamic masking policies take effect during script execution and job tests in DataArts Factory, you must enable fine-grained authentication by referring to Enabling Fine-grained Authentication.
- Dynamic masking policies are only available for MRS Hive and GaussDB(DWS) data sources.
- A table can be associated with only one dynamic data masking policy. Policies take effect only after they are synchronized successfully.
- During dynamic masking of MRS Hive data, MRS Ranger allows you to configure different rules for the same column, and the rules are matched in the sequence of their configuration time. Therefore, you can configure multiple masking policies for different content in the same cluster, database, table, and column.
- Table 2 lists the masking rules supported by the MRS service. For Chinese characters, only null and hash masking are supported. If other masking methods are selected, masking does not take effect.
- GaussDB(DWS) dynamic masking is unavailable for GaussDB(DWS) logical clusters. Before masking data, enable GaussDB(DWS) dynamic masking by changing the CN and DN values of parameter feature_support_options to enable_data_redaction. For details, see Modifying Database Parameters. In addition, ensure that the user in the GaussDB(DWS) data connection has the GRANT permission on the table to be masked. ( By default, after a database object is created, only the object owner or system administrator can run the GRANT command to grant the object permissions to other users.)
- Table 3 lists the masking rules supported by GaussDB(DWS). Chinese characters cannot be masked. If you mask data that contains Chinese characters, garbled characters may be displayed.
Creating a Dynamic Masking Policy
- On the DataArts Studio console, locate a workspace and click DataArts Security.
- In the left navigation pane, choose Dynamic Masking.
Figure 1 Dynamic Masking
- Click Create and set the parameters listed in Table 1.
Figure 2 Setting parameters for the dynamic masking policyThe following table lists the parameters.
Table 1 Policy parameters Parameter
Description
*Policy Name
Unique identifier of the dynamic masking policy. It must be unique in a DataArts Studio instance.
To facilitate policy management, you are advised to include the object to be masked and masking rule in the name.
*Data Source Type
Currently, only MRS Hive and DWS are supported.
MRS Hive
*User Group/Username
User or user group in the current workspace members. When a specified object queries or exports sensitive data from DataArts Factory, the system dynamically masks the sensitive data to protect the sensitive data from being disclosed.
*Data Connection
If no data connection is available, create one by referring to Creating a DataArts Studio Data Connection.
*Cluster Name
You do not need to set this parameter. The data source cluster in the data connection is automatically selected.
*Database
Database where the sensitive data is stored
*Data Table
Data table where the sensitive data is stored
*Data Column
Select one or more columns to be masked and select a proper masking rule for each column based on the data type. Supported data masking rules vary depending on the data type of each data source. For details, see Reference: Dynamic Masking Rules.
If sensitive data discovery has been performed on the selected columns and the statuses of the sensitive data fields are valid, the data security levels and classifications are displayed in the Data Column area.
DWS
*User Group/Username
User or user group in the current workspace members. When a specified object queries or exports sensitive data from DataArts Factory, the system dynamically masks the sensitive data to protect the sensitive data from being disclosed.
*Data Connection
If no data connection is available, create one by referring to Creating a DataArts Studio Data Connection.
*Cluster Name
You do not need to set this parameter. The data source cluster in the data connection is automatically selected.
*Database
Database where the sensitive data is stored
*schema
Schema where the sensitive data is stored
*Data Table
Data table where the sensitive data is stored
*Data Column
Select one or more columns to be masked and select a proper masking rule for each column based on the data type. Supported data masking rules vary depending on the data type of each data source. For details, see Reference: Dynamic Masking Rules.
If sensitive data discovery has been performed on the selected columns and the statuses of the sensitive data fields are valid, the data security levels and classifications are displayed in the Data Column area.
- After setting all required parameters, click OK. After the dynamic masking policy is created, you need to click Synchronize to synchronize the policy to the data source.
Related Operations
- Synchronizing a policy: On the Dynamic Masking page, locate a policy and click Synchronize in the Operation column to synchronize the policy to the data source. To synchronize multiple policies, select them and click Synchronize above the list.
Policies take effect only after they are synchronized successfully. If the policy synchronization fails, you can view the policy run log in the policy details to locate the failure cause. After rectifying the fault, synchronize the policy again. If the synchronization still fails, contact technical support.
- Editing a policy: On the Dynamic Masking page, locate a policy and click Edit in the Operation column.
- Deleting policies: On the Dynamic Masking page, locate a policy and click Delete in the Operation column. In the displayed dialog box, confirm the policy to delete and click Yes. To delete multiple policies, select them and click Delete above the list.
Deleted dynamic masking policies are moved to the recycle bin. You can restore them within 30 days. After 30 days, they will be deleted permanently. For details, see Managing the Recycle Bin.
- Viewing policy details: On the Dynamic Masking page, locate a policy and click its name to view its details. You can also filter policies by Sync Status.
Figure 3 Viewing policy details
Reference: Dynamic Masking Rules
- MRS Hive dynamic masking rules are provided by MRS Ranger. Table 2 lists the supported rules.
- GaussDB(DWS) dynamic masking rules are provided by GaussDB(DWS). Table 3 lists the supported rules.
Data Type |
Mask Letters and Digits |
Show Only the Last Four Characters |
Show Only the First Four Characters |
Replace a Value with Its Hash Value |
Mask the Month and Date |
Replace a Value with Null |
---|---|---|---|---|---|---|
TINYINT |
The number of characters remains unchanged. All values are replaced with 1. |
No change. The maximum value is 127. |
No change. The minimum value is –128. |
The value changes to null. |
The number of characters remains unchanged. All values are replaced with 1. |
The value changes to null. |
SMALLINT |
The number of characters remains unchanged. All values are replaced with 1. |
No change. The maximum value is 12767. |
No change. The maximum value is –32768. |
The value changes to null. |
The number of characters remains unchanged. All values are replaced with 1. |
The value changes to null. |
INT |
The number of characters remains unchanged. All values are replaced with 1. |
The last four characters are shown. |
The first four characters are shown. |
The value changes to null. |
The number of characters remains unchanged. All values are replaced with 1. |
The value changes to null. |
BIGINT |
The number of characters remains unchanged. All values are replaced with 1. |
The last four characters are shown. |
The first four characters are shown. |
The value changes to null. |
The number of characters remains unchanged. All values are replaced with 1. |
The value changes to null. |
BOOLEAN |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
FLOAT |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
DOUBLE |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
STRING |
Letters change to x, and digits change to n. |
Chinese characters remain unchanged, and letters change to X. |
Letters change to X. |
The value changes to its hash value of 64 bytes. |
Chinese characters remain unchanged with each character occupying one digit, and letters change to X. |
The value changes to null. |
TIMESTAMP |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
The value changes to null. |
CHAR |
Letters change to x, and digits change to n. |
Letters and digits change to X, and the last four characters are retained (a fixed length with spaces). |
Letters and digits change to X, and the first four characters are retained (a fixed length with spaces). |
The value changes to its hash value of 64 bytes. |
Chinese characters remain unchanged with each character occupying one digit, and letters change to X. |
The value changes to null. |
VARCHAR |
Letters change to x, and digits change to n. |
The last four characters are retained (Chinese characters remain unchanged with each character occupying one digit), and letters change to X. |
The first four characters are retained (Chinese characters remain unchanged with each character occupying one digit), and letters change to X. |
The value changes to its hash value of 64 bytes. |
Chinese characters remain unchanged with each character occupying one digit, and letters change to X. |
The value changes to null. |
DATE |
The date changes to 0001-01-01. |
The date changes to 0001-01-01. |
The date changes to 0001-01-01. |
The value changes to null. |
The year is retained, and other values change to 01. |
The value changes to null. |
Data Type |
Replace All Characters with Asterisks (*) |
Retain Last Four Characters and Replace Others with Asterisks (*) |
Retain First Two Characters and Replace Others with Asterisks (*) |
Custom |
---|---|---|---|---|
Character bpchar, varchar, text, inet, macaddr, uuid, char, txt |
All characters are replaced by null. |
The last four characters are retained, and the other characters are replaced with asterisks (*). |
The first two characters are retained, and the other characters are replaced with asterisks (*). |
The start and end positions, as well as masking characters are customized. |
Value numeric, int2, int8, money, float8, float4, interval, decimal, double precision, real, integer, smallint, bigint |
All characters are replaced by 0. |
Not supported |
Not supported |
The start and end positions, as well as masking characters are customized. |
Time timestamp, time, timetz, timestamptz, date, time without time zone, timestamp without time zone, time without time zone, timestamp without time zone |
All characters are replaced by a fixed value. |
Not supported |
Not supported |
The year, month, or day can be masked as needed. |
Other |
All characters are replaced by a fixed value. |
Not supported |
Not supported |
Not supported |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot