Sensitive Information Masking Such as Passwords in Database Audit
To mask sensitive information in entered SQL statements, you can enable privacy data masking and configure masking rules to prevent sensitive information leakage.
Prerequisites
- The database audit instance is in the Running state.
- Enable the database audit function. For details, see Enabling Database Audit.
Creating a Data Masking Rule
- Log in to the management console.
- Select a region, click
, and choose . The Dashboard page is displayed. - 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 customized rules can be edited and deleted. Default rules can only be enabled and disabled.
- Enable the privacy data masking function.
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.
- Click OK.
A masking rule in the Enabled state is added to the rule list.
Verifying a Rule
Perform the following steps to check whether a rule takes effect. The audit information about password in a MySQL database is used as an example.
- Log in to the database as user root through the MySQL database client.
- On the database client, enter the following SQL statements.
INSERT INTO 'adventureworks'.'user_login_info' ('id', 'user_name', 'pass_word') VALUES (1, 'name_1', 'Password'); INSERT INTO 'adventureworks'.'user_login_info' ('id', 'user_name', 'pass_word') VALUES (2, 'name_2', 'Password'); INSERT INTO 'adventureworks'.'user_login_info' ('id', 'user_name', 'pass_word') VALUES (3, 'name_3', 'Password'); INSERT INTO 'adventureworks'.'user_login_info' ('id', 'user_name', 'pass_word') VALUES (4, 'name_4', 'Password'); - In the navigation tree on the left, choose Data Reports. The Data Reports page is displayed.
- In the Instance drop-down list, select an instance. Click the Statements tab.
- Set filtering conditions to find the entered SQL statement.
In the SQL statements column, view the executed INSERT INTO SQL statement. The information before masking is displayed.
Figure 2 Viewing SQL statements
- In the navigation tree on the left, choose Audit Rules. On the Privacy Data Protection tab page, click Add Rule to add a masking rule for passwords. Figure 3 Adding a password masking rule
- Repeat 1 to 5 to query the entered SQL statement based on the filter criteria.
In the SQL statements column, view the executed INSERT INTO SQL statement. The privacy data masking function is normal, and the masked information is displayed.
Figure 4 Viewing the masked SQL statement
- On the database client, enter the following SQL statements.
UPDATE 'adventureworks'.'user_login_info' set 'pass_word' = "password" where id = 1; UPDATE 'adventureworks'.'user_login_info' set 'pass_word' = "password" where id = 2; UPDATE 'adventureworks'.'user_login_info' set 'pass_word' = "password" where id = 3; UPDATE 'adventureworks'.'user_login_info' set 'pass_word' = "password" where id = 4;
- Repeat 3 to 5 to query the entered SQL statement based on the filter criteria.
In the SQL statements column, view the executed UPDATE SQL statement. The information before masking is displayed.
Figure 5 Viewing SQL statements
- In the navigation tree on the left, choose Audit Rules. On the Privacy Data Protection tab page, click Add Rule to add a masking rule for changing the password. Figure 6 Adding a masking rule for changing passwords
- Repeat step 8 to execute the SQL request statement.
- Repeat 3 to 5 to query the entered SQL statement based on the filter criteria.
In the SQL statement column, view the executed UPDATE SQL statement. The privacy data masking function is normal, and the information is displayed.
Figure 7 Viewing the SQL statements after masking
In other scenarios or database types, you need to create masking rules based on specific syntax features and sensitive fields to implement audit masking.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
