To mask sensitive information in entered SQL statements, you can enable the function of masking privacy data and configure masking rules to prevent sensitive information leakage.
Prerequisites
- Database audit has been enabled.
Procedure
- In the navigation tree, choose Rules.
- In the Instance drop-down list, select the instance whose privacy data protection rule is to be configured.
- Click the Privacy Data Protection tab.
Only user-defined rules can be edited and deleted. Default rules can only be enabled and disabled.
- Enable or disable Store Result Set and Mask Privacy Data.
- Store Result Set
You are advised to disable
. After this function is disabled, database audit will not store the result sets of user SQL statements.
Do not enable this function if you want to prepare for PCI DSS/PCI 3DS CSS certification.
- Mask Privacy Data
You are advised to enable
. After this function is enabled, you can configure masking rules to prevent privacy data leakage.
- Click Add Rule. In the displayed Add Rule dialog box, set the data masking rule, as shown in Figure 1. For details about related parameters, see Table 1.
Figure 1 Add Rule dialog box
Table 1 Rule parametersParameter
|
Description
|
Example Value
|
Rule Name
|
Name of a rule
|
test
|
Regular Expression
|
Regular expression that specifies the sensitive data pattern
|
-
|
Substitution Value
|
Value used to replace sensitive data specified by the regular expression
|
###
|
- Click OK.
A masking rule in the Enabled status is added to the rule list.
Verifying a Rule
Perform the following steps to check whether a rule takes effect. The audit information about passport No. in a MySQL database is used as an example.
- Enable Mask Privacy Data, and ensure the "Passport NO." masking rule is enabled, as shown in Figure 2.
Figure 2 Enabling privacy data protection
- Log in to the database as user root through the MySQL database client.
- On the database client, enter an SQL statement.
select * from db where HOST="Passport NO.";
- In the navigation pane, choose Dashboard.
- In the navigation tree on the left, choose Data Reports. The Data Reports page is displayed.
- In the Instance drop-down list, select the instance whose SQL statement information you want to view. Click the Statements tab.
- Set filtering conditions to find the entered SQL statement.
- In the row containing the SQL statement, click Details in the Operation column.
- Check the SQL statement information in SQL Statement.
Common Operations
After adding a user-defined masking rule, you can perform the following operations on it:
- Disable
Locate the row that contains the rule to be disabled and click Disable in the Operation column. A disabled rule cannot be used.
- Edit
Locate the row that contains the rule to be modified, click Edit in the Operation column, and modify the rule in the displayed dialog box.
- Delete
Locate the row that contains the rule to be deleted, click Delete in the Operation column, and click OK in the displayed dialog box.