Data desensitization query method and device, computer equipment and storage medium
By converting and blood relationship analysis of SQL query statements, combining user permissions and confidential mapping tables, dynamic data desensitization query is realized, solving the problems of inefficiency and high cost of traditional methods, and improving the efficiency and security of data protection.
Patent Information
- Application Number
- CN202411738640.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-14
AI Technical Summary
Traditional data desensitization query methods are inefficient or costly, making it difficult to effectively protect the privacy of sensitive information of individuals and enterprises.
By converting the received SQL query statements, an abstract syntax tree is generated, and SQL blood ties analysis is performed to generate a blood relationship map. Determine the target standard confidentiality level based on the map and source field confidentiality mapping table, and analyze the query results in combination with user permission analysis. If the display type is mask display, the query result set is masked and feedback is performed.
Real-time corresponding data query control strategies for different users and different standard confidentiality levels are realized, without complex key management, reducing performance costs and computing resource losses, and improving the efficiency, accuracy and security of data desensitized queries.
Smart Images

Figure CN119622811A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data privacy protection, and in particular to a data desensitization query method, apparatus, computer equipment and storage medium. Background Art
[0002] When doing business queries on data, personal data may be displayed in plain text. The above situation leads to the leakage of personal privacy data and poses a security risk. Therefore, it is necessary to desensitize the query data to solve the problem of sensitive data leakage in the data application analysis process. In enterprise big data analysis, data scientists not only need to query summary data, but also need to analyze business detail data. However, the detail data inevitably contains personal and corporate sensitive information. At this time, it is necessary to meet both analysis needs and personal information privacy data protection. Therefore, it becomes very necessary to dynamically desensitize the data to ensure that the detail data can be calculated but not visible, and to avoid leakage of user privacy data.
[0003] However, traditional data desensitization query methods have problems such as low efficiency and high cost. Summary of the invention
[0004] Based on this, it is necessary to provide a data desensitizing query method, device, computer equipment and storage medium that can improve efficiency and reduce costs in response to the above technical problems.
[0005] In a first aspect, a data desensitization query method is provided, the method comprising:
[0006] In response to receiving the SQL query statement sent by the user terminal, converting the SQL query statement to obtain an abstract syntax tree; the SQL query statement includes each query display field data;
[0007] After performing SQL lineage analysis on the abstract syntax tree, a lineage relationship map is obtained, and according to the target source field corresponding to each query display field data in the lineage relationship map, the target standard confidentiality level of each target source field is obtained after query processing in the source field confidentiality mapping table; the lineage relationship map includes each query display field data and the corresponding target source field; the source field confidentiality mapping table is used to count the mapping relationship between each source field and the corresponding standard confidentiality level;
[0008] Obtaining the user rights of the user terminal, and analyzing the query result display type according to the user rights and the confidentiality level of each target standard; the query result display type includes normal display or mask display;
[0009] In response to the query result display type being mask display, a query result set is obtained after executing the SQL query statement, the query result set is masked to obtain a masked query result set, and the masked query result set is fed back to the user terminal.
[0010] In one of the embodiments, the method also includes: determining the confidentiality level classification rules in response to the configuration operation of the confidentiality level classification rules; performing sampling scanning and processing on the table field data of the entire database to obtain the corresponding source fields; performing analysis according to the confidentiality level classification rules and each source field to obtain the initial confidentiality level corresponding to each source field; counting the level proportion of the initial confidentiality level corresponding to each source field; in response to the level proportion of the highest initial confidentiality level of the source field being greater than a proportion threshold, determining the highest initial confidentiality level as the standard confidentiality level of the corresponding source field, and storing the mapping relationship between the source field and the corresponding standard confidentiality level in the source field confidentiality mapping table; wherein the highest initial confidentiality level is the current highest level of the initial confidentiality level corresponding to the corresponding source field.
[0011] In one of the embodiments, the method further includes: in response to the level proportion of the highest initial confidentiality level of the source field being less than a proportion threshold, updating the initial confidentiality level of the next level of the highest initial confidentiality level to the highest initial confidentiality level, and returning to the step of determining the highest initial confidentiality level as the standard confidentiality level of the corresponding source field in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, and storing the mapping relationship between the source field and the corresponding standard confidentiality level in the source field confidentiality level mapping table.
[0012] In one of the embodiments, a lineage relationship graph is obtained after performing SQL lineage analysis on an abstract syntax tree, including: performing recursive search processing on the abstract syntax tree to obtain lineage relationship links of target source fields corresponding to data of each query display field; the target source fields include library names, table names, and field names; and generating a lineage relationship graph based on each lineage relationship link.
[0013] In one of the embodiments, the query result display type is obtained after analyzing the user authority and each target standard confidentiality level, including: determining the highest target standard confidentiality level according to each target standard confidentiality level; determining the highest standard confidentiality level that the user can query according to the user authority; in response to the highest standard confidentiality level that the user can query is higher than or equal to the highest target standard confidentiality level, determining the query result display type as normal display; in response to the highest standard confidentiality level that the user can query is lower than the highest target standard confidentiality level, determining the query result display type as mask display.
[0014] In one of the embodiments, masking is performed on a query result set to obtain a masked query result set, including: determining a sensitive information type based on the query result set, and determining a masking method based on the sensitive information type; masking is performed on the query result set according to the masking method to obtain a masked query result set.
[0015] In one of the embodiments, the method further includes: in response to the query result display type being normal display, executing the SQL query statement to obtain a query result set, and feeding back the query result set to the user terminal.
[0016] In a second aspect, a data desensitization query device is provided, which includes a syntax tree conversion module, a confidentiality level query module, a display type analysis module and a result feedback module.
[0017] Among them, the syntax tree conversion module is used to convert the SQL query statement in response to receiving the SQL query statement sent by the user terminal to obtain an abstract syntax tree; the SQL query statement includes each query display field data; the confidentiality query module is used to perform SQL lineage analysis on the abstract syntax tree to obtain a lineage relationship map, and obtain the target standard confidentiality level of each target source field after querying the source field confidentiality mapping table according to the target source field corresponding to each query display field data in the lineage relationship map; the lineage relationship map includes each query display field data and the corresponding target source field; the source field confidentiality mapping table is used to count the mapping relationship between each source field and the corresponding standard confidentiality level; the display type analysis module is used to obtain the user authority of the user terminal, and obtain the query result display type after analysis according to the user authority and each target standard confidentiality level; the query result display type includes normal display or mask display; the result feedback module is used to respond to the query result display type being mask display, obtain the query result set after executing the SQL query statement, obtain the masked query result set after masking the query result set, and feedback the masked query result set to the user terminal.
[0018] In a third aspect, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of any method in the above method embodiments are implemented.
[0019] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any method in the above method embodiments are implemented.
[0020] The above-mentioned data desensitization query method, device, computer equipment and storage medium, in response to receiving an SQL query statement sent by a user terminal, converts the SQL query statement to obtain an abstract syntax tree; the SQL query statement includes each query display field data; then, after SQL lineage analysis is performed on the abstract syntax tree, a lineage relationship map is obtained, and according to the target source field corresponding to each query display field data in the lineage relationship map, a source field confidentiality level mapping table is queried to obtain the target standard confidentiality level of each target source field; the lineage relationship map includes each query display field data and the corresponding target source field; the source field confidentiality level mapping table is used to count the mapping relationship between each source field and the corresponding standard confidentiality level; then, the user authority of the user terminal is obtained, and according to the user authority and each target After analyzing the standard confidentiality level, the query result display type is obtained; the query result display type includes normal display or mask display; then, in response to the query result display type being mask display, a query result set is obtained after executing the SQL query statement, the query result set is masked to obtain a masked query result set, and the masked query result set is fed back to the user terminal, thereby realizing a data query control strategy corresponding to different users and different standard confidentiality levels in real time, and performing corresponding privacy protection processing on the query results without complex key management, thereby reducing performance costs, query processing time and computing resource loss, providing differentiated protection for different users and different query data, realizing dynamic data desensitization query, and improving the efficiency, accuracy and security of data desensitization query. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 An application environment diagram of a data desensitization query method in an embodiment;
[0022] Figure 2 This is a schematic diagram of a first process of a data desensitization query method in one embodiment;
[0023] Figure 3 This is an example diagram of a blood relationship map in a specific example;
[0024] Figure 4 It is a schematic diagram of a process of obtaining a lineage relationship map after performing SQL lineage analysis on an abstract syntax tree in one embodiment;
[0025] Figure 5 A flow chart of obtaining the query result display type after analyzing the user authority and each target standard confidentiality level in one embodiment;
[0026] Figure 6 A second flow chart of a data desensitization query method in one embodiment;
[0027] Figure 7It is a flowchart of performing mask processing on a query result set to obtain a masked query result set in one embodiment;
[0028] Figure 8 The third flow chart of the data desensitization query method in one embodiment is shown;
[0029] Fig. 9 It is a structural block diagram of a data desensitization query device in one embodiment;
[0030] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0032] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0034] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first resistor may be referred to as a second resistor, and similarly, a second resistor may be referred to as a first resistor. Both the first resistor and the second resistor are resistors, but they are not the same resistor.
[0035] It can be understood that the “connection” in the following embodiments should be understood as “electrical connection”, “communication connection”, etc. if the connected circuits, modules, units, etc. have electrical signals or data transmission between each other.
[0036] When used herein, the singular forms "a", "an", and "said / the" may also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" etc. specify the presence of stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof.
[0037] The data desensitization query method provided in this application can be applied to Figure 1 In the application environment shown, the user terminal 102 communicates with the server 104 through a network. The user terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0038] In one embodiment, Figure 2 As shown, a data desensitization query method is provided, which is applied to Figure 1 The server 104 in the example is used for explanation, and the following steps are included: step 201 to step 204.
[0039] Step 201: in response to receiving a SQL query statement sent by a user terminal, convert the SQL query statement to obtain an abstract syntax tree.
[0040] The SQL query statement includes data of each query display field. Specifically, when receiving the SQL query statement sent by the user terminal, the server 104 converts the SQL query statement to obtain an abstract syntax tree.
[0041] Step 202, after performing SQL lineage analysis on the abstract syntax tree, a lineage relationship map is obtained, and according to the target source fields corresponding to the query display field data in the lineage relationship map, the source field confidentiality mapping table is queried and processed to obtain the target standard confidentiality level of each target source field.
[0042] Among them, the blood relationship map includes each query display field data and the target source field corresponding to each query display field data; the source field confidentiality level mapping table is used to count the mapping relationship between each source field and the corresponding standard confidentiality level.
[0043] Specifically, server 104 performs SQL lineage analysis on the abstract syntax tree to obtain a lineage relationship map, and obtains the target standard confidentiality level of each target source field after query processing in the source field confidentiality level mapping table based on the target source field corresponding to each query display field data in the lineage relationship map.
[0044] In a specific example, the SQL lineage analysis process is as follows:
[0045]
[0046] Taking the above SQL query statement as an example, the complete blood relationship map can be obtained as follows: Figure 3 As shown. Taking the above example, a complete blood relationship tree structure map can be obtained through SQL blood relationship analysis, so that the target source fields for querying the display field col C include "library db--table tab l e--field col 1", "library db--table tab l e--field col 2" and "library db--table tab l e--field col 3". The target source field for querying field col D is "library db--table tab l e--field col 3". The above are only specific examples. In actual applications, they are flexibly set according to user needs and are not limited here.
[0047] In one embodiment, if Figure 4 As shown, after performing SQL lineage analysis on the abstract syntax tree, a lineage relationship graph is obtained, including step 401 and step 402.
[0048] Step 401, recursively search the abstract syntax tree to obtain the blood relationship link between each query display field data and the target source field.
[0049] The target source field includes a library name, a table name, and a field name. Specifically, the server 104 can perform a recursive search process on the abstract syntax tree to obtain a blood relationship link between each query display field data and the target source field.
[0050] In a specific example, the recursive search process is applicable to nested subqueries, JOIN queries, and aggregate queries, etc. The number of target source fields corresponding to the query display field data can be one or more. The above is only a specific example. In actual applications, it is flexibly set according to user needs and is not limited here.
[0051] Step 402, generating a blood relationship graph according to each blood relationship link.
[0052] Specifically, server 104 generates a blood relationship map based on each blood relationship link, so as to facilitate a clear and accurate description of the logical relationship between each query display field data and the corresponding target source field, thereby improving the efficiency and convenience of generating the blood relationship map, and also improving the data accuracy and efficiency of data desensitized query.
[0053] In this embodiment, a recursive search process is performed on the abstract syntax tree to obtain the blood relationship link between each query display field data and the target source field; then, a blood relationship map is generated based on each blood relationship link, so as to facilitate a clear and accurate description of the logical relationship between each query display field data and the target source field, thereby improving the efficiency and convenience of generating the blood relationship map, and also improving the data accuracy and efficiency of data desensitized query.
[0054] Step 203, obtaining the user authority of the user terminal, and obtaining the query result display type after analyzing according to the user authority and each target standard confidentiality level.
[0055] The query result display type includes normal display or mask display. Specifically, the server 104 can obtain the user authority of the user terminal, and obtain the query result display type after analyzing the user authority and each target standard confidentiality level.
[0056] In one embodiment, if Figure 5 As shown, after analyzing according to the user authority and each target standard confidentiality level, the query result display type is obtained, including steps 501 to 504.
[0057] Step 501, determining the highest target standard confidentiality level according to each target standard confidentiality level;
[0058] Step 502, determining the highest standard confidentiality level that the user can query according to the user's authority;
[0059] Step 503, in response to the highest standard confidentiality level that the user can query being higher than or equal to the highest target standard confidentiality level, determining the query result display type as normal display;
[0060] Step 504: In response to the highest standard privacy level that can be queried by the user being lower than the highest target standard privacy level, the query result display type is determined to be mask display.
[0061] Among them, the highest target standard confidentiality level is the highest level among all target standard confidentiality levels. Specifically, the server 104 can determine the highest target standard confidentiality level from all target standard confidentiality levels; then, determine the highest standard confidentiality level that the user can query based on the user's authority; then, in response to the highest standard confidentiality level that the user can query being higher than or equal to the highest target standard confidentiality level, determine the query result display type as normal display; then, in response to the highest standard confidentiality level that the user can query being lower than the highest target standard confidentiality level, determine the query result display type as mask display, thereby performing different query structure display types according to the highest standard confidentiality level that different users can query, thereby improving the accuracy and security of data desensitization query.
[0062] In this embodiment, each target standard confidentiality level determines the highest target standard confidentiality level; then, the highest standard confidentiality level that the user can query is determined according to the user's authority; then, in response to the user's highest queryable standard confidentiality level being higher than or equal to the highest target standard confidentiality level, the query result display type is determined to be normal display; then, in response to the user's highest queryable standard confidentiality level being lower than the highest target standard confidentiality level, the query result display type is determined to be masked display, thereby performing different query structure display types according to different users' highest queryable standard confidentiality levels, thereby improving the accuracy and privacy security of data desensitization queries.
[0063] Step 204, in response to the query result display type being mask display, executing the SQL query statement to obtain a query result set, performing mask processing on the query result set to obtain a masked query result set, and feeding back the masked query result set to the user terminal.
[0064] Specifically, when the query result display type is masked display, server 104 executes an SQL query statement to obtain a query result set, masks the query result set to obtain a masked query result set, and feeds back the masked query result set to the user terminal, thereby implementing a data query control strategy that corresponds to different users and different standard confidentiality levels in real time. The query results can be subjected to corresponding privacy protection processing without complex key management, thereby reducing performance costs, providing differentiated protection for different users and different query data, realizing dynamic data desensitization query, and improving the efficiency, accuracy and security of data desensitization query.
[0065] The above-mentioned data desensitization query method, in response to receiving the SQL query statement sent by the user terminal, converts the SQL query statement to obtain an abstract syntax tree; the SQL query statement includes each query display field data; then, after SQL lineage analysis is performed on the abstract syntax tree, a lineage relationship map is obtained, and according to the target source field corresponding to each query display field data in the lineage relationship map, a source field confidentiality level mapping table is queried to obtain the target standard confidentiality level of each target source field; the lineage relationship map includes each query display field data and the corresponding target source field; the source field confidentiality level mapping table is used to count the mapping relationship between each source field and the corresponding standard confidentiality level; then, the user authority of the user terminal is obtained, and according to the user authority and each target standard confidentiality level, the After row analysis, the query result display type is obtained; the query result display type includes normal display or mask display; then, in response to the query result display type being mask display, a query result set is obtained after executing an SQL query statement, the query result set is masked to obtain a masked query result set, and the masked query result set is fed back to the user terminal, thereby realizing a data query control strategy corresponding to different users and different standard confidentiality levels in real time, performing corresponding privacy protection processing on the query results without complex key management, reducing performance cost, query processing time and computing resource loss, providing differentiated protection for different users and different query data, realizing dynamic data desensitization query, and improving the efficiency, accuracy and security of data desensitization query.
[0066] In one embodiment, if Figure 6 As shown, the method further includes step 601.
[0067] Step 601, in response to the query result display type being normal display, a SQL query statement is executed to obtain a query result set, and the query result set is fed back to a user terminal.
[0068] Specifically, when the query result display type is normal display, the server 104 obtains a query result set after executing the SQL query statement, and feeds back the query result set to the user terminal, thereby improving the efficiency and convenience of data desensitization query.
[0069] In this embodiment, in response to the query result display type being normal display, a query result set is obtained after executing the SQL query statement, and the query result set is fed back to the user terminal, thereby improving the efficiency and convenience of data desensitization query.
[0070] In one embodiment, if Figure 7 As shown, the query result set is masked to obtain the masked query result set, including step 701 and step 702.
[0071] Step 701, determine the sensitive information type according to the query result set, and determine the masking method according to the sensitive information type.
[0072] Step 702: mask the query result set according to the masking method to obtain the query result set after masking.
[0073] Specifically, the server 104 determines the sensitive information type based on the query result set, and determines the masking method based on the sensitive information type; then, the query result set is masked according to the masking method to obtain a masked query result set, thereby improving the operability of privacy protection and data security.
[0074] In a specific example, sensitive information types include mobile phone numbers, bank card numbers, email addresses, and ID card numbers. Different sensitive information types use different masking methods. For example, the mobile phone number displays the first 3 and last 4 digits, and the middle is replaced by an asterisk (*). The query result set after masking is 138****4213. The bank card number displays the first 6 and last 4 digits, and the middle is replaced by four asterisks (*). The query result set after masking is 622202****4123; the email address is the first two and last characters, and the email domain name information after @. The above are only specific examples. In actual applications, they are flexibly set according to user needs and are not limited here.
[0075] In this embodiment, the sensitive information type is determined based on the query result set, and the masking method is determined based on the sensitive information type; then, the query result set is masked according to the masking method to obtain a masked query result set, thereby improving the operability of privacy protection and data security.
[0076] In one embodiment, if Figure 8 As shown, the method also includes step 801 to step 805.
[0077] Step 801, in response to the configuration operation of the confidentiality level classification rule, determining the confidentiality level classification rule;
[0078] Step 802, performing sampling scanning on the table field data of the entire database to obtain the corresponding source fields;
[0079] Step 803, analyzing according to the confidentiality level classification rules and each source field to obtain the initial confidentiality level corresponding to each source field;
[0080] Step 804, counting the level proportion of the initial confidentiality level corresponding to each source field;
[0081] Step 805, in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, the highest initial confidentiality level is determined as the standard confidentiality level of the corresponding source field, and the mapping relationship between the source field and the corresponding standard confidentiality level is stored in the source field confidentiality level mapping table.
[0082] Among them, the highest initial confidentiality level is the current highest level of the initial confidentiality level corresponding to the source field. Specifically, the server 104 determines the confidentiality level classification rule in response to the configuration operation of the confidentiality level classification rule; then, the table field data of the full database is sampled and scanned to obtain the corresponding source field; then, according to the confidentiality level classification rule and each source field, the initial confidentiality level corresponding to each source field is analyzed; then, the level proportion of the initial confidentiality level corresponding to each source field is counted; finally, in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, the highest initial confidentiality level is determined as the standard confidentiality level of the corresponding source field, and the mapping relationship between the source field and the corresponding standard confidentiality level is stored in the source field confidentiality mapping table, which improves the efficiency and convenience of generating the source field confidentiality mapping table, and also improves the data security and the granularity of data desensitization query.
[0083] In this embodiment, in response to the configuration operation of the confidentiality level classification rule, the confidentiality level classification rule is determined; then, the table field data of the entire database is sampled and scanned to obtain the corresponding source fields; then, analysis is performed according to the confidentiality level classification rule and each source field to obtain the initial confidentiality level corresponding to each source field; then, the level proportion of the initial confidentiality level corresponding to each source field is counted; finally, in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, the highest initial confidentiality level is determined as the standard confidentiality level of the corresponding source field, and the mapping relationship between the source field and the corresponding standard confidentiality level is stored in the source field confidentiality level mapping table, which improves the efficiency and convenience of generating the source field confidentiality level mapping table, and also improves data security and the granularity of data desensitization queries.
[0084] In one embodiment, if Figure 8 As shown, the method further includes step 806.
[0085] Step 806, in response to the level proportion of the highest initial confidentiality level of the source field being less than the proportion threshold, the initial confidentiality level of the next level of the highest initial confidentiality level is updated to the highest initial confidentiality level, and the process returns to the step of determining the highest initial confidentiality level as the standard confidentiality level of the corresponding source field in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, and storing the mapping relationship between the source field and the corresponding standard confidentiality level in the source field confidentiality level mapping table.
[0086] Specifically, in response to the level proportion of the highest initial confidentiality level of the source field being less than the proportion threshold, the server 104 updates the initial confidentiality level of the next level of the highest initial confidentiality level to the highest initial confidentiality level, and returns to the step of determining the highest initial confidentiality level as the standard confidentiality level of the corresponding source field in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, and storing the mapping relationship between the source field and the corresponding standard confidentiality level in the source field confidentiality level mapping table, thereby improving the efficiency and convenience of generating the source field confidentiality level mapping table, and also improving data security and the granularity of data desensitization queries.
[0087] In this embodiment, in response to the level proportion of the highest initial confidentiality level of the source field being less than the proportion threshold, the initial confidentiality level of the next level of the highest initial confidentiality level is updated to the highest initial confidentiality level, and the step returns to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, the highest initial confidentiality level is determined as the standard confidentiality level of the corresponding source field, and the mapping relationship between the source field and the corresponding standard confidentiality level is stored in the source field confidentiality level mapping table, thereby improving the efficiency and convenience of generating the source field confidentiality level mapping table, and also improving data security and the granularity of data desensitization queries.
[0088] It should be understood that although Figure 2 and Figures 4 to 8 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Figure 2 and Figures 4 to 8 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0089] Second, as Fig. 9 As shown, a data desensitization query device is provided, which includes a syntax tree conversion module 910, a confidentiality level query module 920, a display type analysis module 930 and a result feedback module 940.
[0090] Among them, the syntax tree conversion module 910 is used to respond to the SQL query statement sent by the user terminal, convert the SQL query statement to obtain an abstract syntax tree; the SQL query statement includes each query display field data; the confidentiality query module 920 is used to perform SQL lineage analysis on the abstract syntax tree to obtain a lineage relationship map, and query the source field confidentiality mapping table according to the target source field corresponding to each query display field data in the lineage relationship map to obtain the target standard confidentiality level of each target source field; the lineage relationship map includes each query display field data and the corresponding target source field; the source field confidentiality mapping table is used to count the mapping relationship between each source field and the corresponding standard confidentiality level; the display type analysis module 930 is used to obtain the user authority of the user terminal, and obtain the query result display type after analysis according to the user authority and each target standard confidentiality level; the query result display type includes normal display or mask display; the result feedback module 940 is used to respond to the query result display type being mask display, execute the SQL query statement to obtain a query result set, perform mask processing on the query result set to obtain a masked query result set, and feedback the masked query result set to the user terminal.
[0091] In one of the embodiments, the device further includes a source field confidentiality level mapping table generation module.
[0092] Among them, the source field confidentiality level mapping table generation module is used to determine the confidentiality level classification rules in response to the configuration operation of the confidentiality level classification rules; the source field confidentiality level mapping table generation module is used to sample and scan the table field data of the full database to obtain the corresponding source fields; the source field confidentiality level mapping table generation module is used to analyze according to the confidentiality level classification rules and each source field to obtain the initial confidentiality level corresponding to each source field; the source field confidentiality level mapping table generation module is used to count the level proportion of the initial confidentiality level corresponding to each source field; the source field confidentiality level mapping table generation module is used to determine the highest initial confidentiality level as the standard confidentiality level of the corresponding source field in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, and store the mapping relationship between the source field and the corresponding standard confidentiality level in the source field confidentiality level mapping table; wherein, the highest initial confidentiality level is the current highest level of the initial confidentiality level corresponding to the corresponding source field.
[0093] In one of the embodiments, the source field confidentiality level mapping table generation module is used to update the initial confidentiality level of the next level of the highest initial confidentiality level to the highest initial confidentiality level in response to the level proportion of the highest initial confidentiality level of the source field being less than the proportion threshold, and return to the step of determining the highest initial confidentiality level as the standard confidentiality level of the corresponding source field in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, and storing the mapping relationship between the source field and the corresponding standard confidentiality level in the source field confidentiality level mapping table.
[0094] In one embodiment, the confidentiality level query module 920 includes a confidentiality level query unit.
[0095] Among them, the confidentiality query unit is used to perform recursive search processing on the abstract syntax tree to obtain the blood relationship link of each query display field data corresponding to the target source field; the target source field includes the library name, table name and field name; the confidentiality query unit is used to generate a blood relationship map according to each blood relationship link.
[0096] In one embodiment, the display type analysis module 930 includes a display type analysis unit.
[0097] Among them, the display type analysis unit is used to determine the highest target standard confidentiality level according to each target standard confidentiality level; the display type analysis unit is used to determine the highest standard confidentiality level that a user can query according to user permissions; the display type analysis unit is used to determine the query result display type as normal display in response to the highest standard confidentiality level that the user can query being higher than or equal to the highest target standard confidentiality level; the display type analysis unit is used to determine the query result display type as mask display in response to the highest standard confidentiality level that the user can query being lower than the highest target standard confidentiality level.
[0098] In one embodiment, the result feedback module 940 includes a result feedback unit.
[0099] Among them, the result feedback unit is used to determine the sensitive information type according to the query result set, and determine the masking method according to the sensitive information type; the result feedback unit is used to mask the query result set according to the masking method to obtain the query result set after masking.
[0100] In one embodiment, the result feedback module 940 is further configured to, in response to the query result display type being normal display, execute the SQL query statement to obtain a query result set, and feed back the query result set to the user terminal.
[0101] For the specific limitations of the data desensitization query device, please refer to the limitations of the data desensitization query method above, which will not be repeated here. Each module in the above-mentioned data desensitization query device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0102] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store a source field confidentiality mapping table. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data desensitization query method is implemented.
[0103] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0104] In a third aspect, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of any method in the above method embodiments are implemented.
[0105] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any method in the above method embodiments are implemented.
[0106] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0107] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0108] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A data desensitization query method, the method comprising: In response to receiving an SQL query statement sent by a user terminal, converting the SQL query statement to obtain an abstract syntax tree; The SQL query statement includes each query display field data; After performing SQL lineage analysis on the abstract syntax tree, a lineage relationship map is obtained, and after querying the target source field corresponding to each query display field data in the lineage relationship map in the source field confidentiality level mapping table, the target standard confidentiality level of each target source field is obtained; the lineage relationship map includes each query display field data and the corresponding target source field; the source field confidentiality level mapping table is used to count the mapping relationship between each source field and the corresponding standard confidentiality level; Obtaining the user authority of the user terminal, and obtaining the query result display type after analyzing according to the user authority and each of the target standard confidentiality levels; the query result display type includes normal display or mask display; In response to the query result display type being the mask display, the SQL query statement is executed to obtain a query result set, the query result set is masked to obtain the masked query result set, and the masked query result set is fed back to the user terminal.
2. The method according to claim 1, characterized in that The method further comprises: In response to a configuration operation of a confidentiality level classification rule, determining the confidentiality level classification rule; Performing sampling scanning on the table field data of the full database to obtain the corresponding source fields; Analyze according to the confidentiality level classification rule and each of the source fields to obtain the initial confidentiality level corresponding to each of the source fields; Counting the level proportions of the initial confidentiality levels corresponding to the source fields; In response to the level proportion of the highest initial confidentiality level of the source field being greater than a proportion threshold, the highest initial confidentiality level is determined as the standard confidentiality level of the corresponding source field, and the mapping relationship between the source field and the corresponding standard confidentiality level is stored in the source field confidentiality level mapping table; wherein the highest initial confidentiality level is the current highest level of the initial confidentiality level corresponding to the source field.
3. The method according to claim 2, characterized in that The method further comprises: In response to the level proportion of the highest initial confidentiality level of the source field being less than the proportion threshold, the initial confidentiality level of the next level of the highest initial confidentiality level is updated to the highest initial confidentiality level, and the step returns to the step of determining the highest initial confidentiality level as the corresponding standard confidentiality level of the source field in response to the level proportion of the highest initial confidentiality level of the source field being greater than the proportion threshold, and storing the mapping relationship between the source field and the corresponding standard confidentiality level in the source field confidentiality level mapping table.
4. The method according to claim 1, characterized in that The SQL lineage analysis is performed on the abstract syntax tree to obtain a lineage relationship map, including: Recursively search the abstract syntax tree to obtain a blood relationship link between each query display field data and the target source field; the target source field includes a library name, a table name, and a field name; The blood relationship graph is generated according to each of the blood relationship links.
5. The method according to claim 1, characterized in that The query result display type obtained after analyzing the user authority and each target standard confidentiality level includes: Determine the highest target standard confidentiality level according to each of the target standard confidentiality levels; Determine the highest standard confidentiality level that a user can query according to the user authority; In response to the highest standard confidentiality level that the user can query being higher than or equal to the highest target standard confidentiality level, determining the query result display type to be the normal display; In response to the highest standard privacy level that the user can query being lower than the highest target standard privacy level, the query result display type is determined to be the mask display.
6. The method according to claim 1, characterized in that The masking process is performed on the query result set to obtain the masked query result set, including: Determine the sensitive information type according to the query result set, and determine the masking method according to the sensitive information type; The query result set is masked according to the masking method to obtain the query result set after the masking.
7. The method according to claim 1, characterized in that The method further comprises: In response to the query result display type being the normal display, the SQL query statement is executed to obtain a query result set, and the query result set is fed back to the user terminal.
8. A data desensitization query device, characterized in that: The device comprises: A syntax tree conversion module, configured to convert the SQL query statement received from the user terminal to obtain an abstract syntax tree; the SQL query statement includes data of each query display field; A confidentiality query module is used to obtain a kinship map after performing SQL kinship analysis on the abstract syntax tree, and obtain a target standard confidentiality level of each target source field after querying the target source field corresponding to each query display field data in the kinship map in the source field confidentiality mapping table; the kinship map includes each query display field data and the corresponding target source field; the source field confidentiality mapping table is used to count the mapping relationship between each source field and the corresponding standard confidentiality level; A display type analysis module, used to obtain the user authority of the user terminal, and obtain the query result display type after analyzing the user authority and each target standard confidentiality level; the query result display type includes normal display or mask display; A result feedback module is used to, in response to the query result display type being the mask display, execute the SQL query statement to obtain a query result set, perform mask processing on the query result set to obtain the masked query result set, and feed back the masked query result set to the user terminal.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Desensitization rule configuration method, application server and computer readable storage medium
CN107871083A
Data security query method, device and equipment based on SQL (Structured Query Language) blood relationship
CN114357480A
Method and device for marking sensitive data, medium and program product
CN115659396A
Method and system for data lineage analysis, computer device, and storage medium
WO2022116425A1