Data desensitization method and device, equipment and storage medium

By analyzing the database operation statements and generating a list of desensitization fields, the problem that data desensitization methods in the prior art affect the execution of database operation statements is solved, and the effect of improving data security is achieved on the basis of the normal execution of database operation statements.

CN119760777AActive Publication Date: 2025-04-04INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411910800.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-04
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

When writing data from intermediate tables and result tables, existing data desensitization methods are difficult to meet the needs of intermediate table result table related query. At the same time, there are data security risks, which affects the normal execution of database operation statements.

Method used

By analyzing the received database operation statements, obtaining the statement type and syntax tree, extracting the result set fields in the query statement, and generating a list of desensitized fields based on the syntax tree and the pre-saved field directed graph, and desensitizing the result set after executing the database operation statements.

Benefits of technology

While ensuring the normal execution of database operation statements, data security is improved and data security risks are avoided when querying related to intermediate tables and result tables.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760777A_ABST
    Figure CN119760777A_ABST
Patent Text Reader

Abstract

The invention discloses a data desensitization method, device and equipment and a storage medium, which are applied to the technical field of big data, and the method comprises the following steps: analyzing a received database operation statement to obtain a statement type and a syntax tree; when the database operation statement is a query statement, extracting a result set field in the database operation statement; based on the syntax tree and a pre-stored field directed graph, generating a desensitization field list associated with the result set field, the directed graph including an association relationship of each field in a database; and obtaining a result set fed back by executing the database operation statement, and performing data desensitization processing on the result set through the desensitization field list. And when it is determined that the database operation statement is a query statement, generating a desensitization field list associated with the field of the result set based on the syntax tree and a pre-stored field directed graph, and performing data desensitization on the result set through the desensitization field list after the database operation statement is executed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data technology, and in particular to a data desensitization method, device, equipment and storage medium. Background Art

[0002] The big data analysis platform is based on a database or data lake, and provides data analysts or business managers with the ability to query data on an ad hoc basis through an interactive query engine, providing support for data analysts or business managers to make analytical decisions. Data analysts or business managers write database operation statements, such as SQL statements, or generate SQL statements through wizard queries or template queries, and submit SQL statements to the query engine based on the client. The query engine processes the data in the data warehouse and data lake and returns it to the client, during which sensitive data is often desensitized.

[0003] The existing desensitization method parses SQL statements. If a table or field hits a sensitive rule, it will be desensitized. Data analysts or business managers often use intermediate tables to perform data analysis in steps, or write the analysis results into the result table for further analysis. However, under the existing desensitization method, if the data written into the intermediate table and the result table is desensitized, it will be difficult to meet the needs of the intermediate table and the result table association query; if it is not desensitized, it will bring data security risks and form a contradiction. Therefore, the existing data desensitization method affects the normal execution of database operation statements. Summary of the invention

[0004] The present invention provides a data desensitization method to improve the security of data while ensuring the normal execution of database operation statements.

[0005] According to a first aspect of the present invention, there is provided a data desensitization method, comprising: analyzing a received database operation statement to obtain a statement type and a syntax tree, wherein the statement type includes an execution statement or a query statement;

[0006] When the database operation statement is the query statement, extracting the result set field in the database operation statement;

[0007] Based on the syntax tree and a pre-saved field directed graph, a list of desensitized fields associated with the result set fields is generated, wherein the directed graph includes associations between the fields in the database;

[0008] A result set fed back by executing the database operation statement is obtained, and data desensitization processing is performed on the result set using the desensitized field list.

[0009] Optionally, based on the syntax tree and the pre-saved field directed graph, a list of desensitized fields associated with the result set fields is generated, including:

[0010] Based on the syntax tree and the pre-saved field directed graph, generating a source table field set associated with each of the result set fields;

[0011] Acquire the sensitivity status of the source table field set, and determine the sensitivity status of the corresponding result set field according to the sensitivity status of the source table field set, wherein the sensitivity status includes sensitive or non-sensitive;

[0012] The desensitized field list is generated according to the sensitivity status of each field in the result set.

[0013] Optionally, generating a source table field set associated with each of the result set fields based on the syntax tree and the pre-saved field directed graph includes:

[0014] For each of the result set fields, acquiring the associated original source table field by traversing the syntax tree;

[0015] According to the initial source table field, query the field directed graph through a breadth-first traversal algorithm to obtain the associated expanded source table field;

[0016] The source table field set is constructed according to the initial source table fields and the expanded source table fields.

[0017] Optionally, obtaining the sensitivity status of the source table field set includes:

[0018] Obtaining the sensitivity status of each source table field in the source table field set;

[0019] It is determined whether the source table field set includes a sensitive source table field. If so, the sensitivity state of the source table field set is determined to be sensitive. Otherwise, the sensitivity state of the source table field set is determined to be non-sensitive.

[0020] Optionally, obtaining a result set fed back by executing the database operation statement, and performing data desensitization processing on the result set using the desensitized field list, includes:

[0021] Sending the database operation statement to a query engine so that the query engine processes the data in the database according to the database operation statement;

[0022] Receive the result set fed back by the query engine;

[0023] The specified fields in the result set that hit the desensitized field list are queried, and the result data of the specified fields are hidden.

[0024] According to another aspect of the present invention, a data desensitization device is provided, comprising: a database operation statement analysis module, configured to analyze a received database operation statement to obtain a statement type and a syntax tree, wherein the statement type includes an execution statement or a query statement;

[0025] A result set field extraction module, used for extracting the result set field in the database operation statement when the database operation statement is the query statement;

[0026] A desensitized field list generation module, used to generate a desensitized field list associated with the result set field based on the syntax tree and a pre-saved field directed graph, wherein the directed graph includes the association relationship between the fields in the database;

[0027] The data desensitization module is used to obtain the result set fed back by executing the database operation statement, and perform data desensitization processing on the result set through the desensitized field list.

[0028] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0029] at least one processor; and

[0030] a memory communicatively connected to the at least one processor; wherein,

[0031] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the method described in any embodiment of the present invention.

[0032] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method described in any embodiment of the present invention when executed.

[0033] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, and when the computer program is executed by a processor, the method described in any embodiment of the present invention is implemented.

[0034] The beneficial technical effect of the present invention is that, when it is determined to be a query statement, the result set fields in the statement are extracted and a desensitized field list is generated, and the result set data is desensitized through the desensitized field list only after the database operation statement is executed, and the operation statement is not field desensitized before the query, thereby not affecting the intermediate query process, thereby improving data security while ensuring the normal execution of the database operation statement.

[0035] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0037] Figure 1 is a flow chart of a data desensitization method provided according to Embodiment 1 of the present invention;

[0038] Figure 2 is a flow chart of a data desensitization method provided according to Embodiment 2 of the present invention;

[0039] Figure 3 is a structural schematic diagram of a data desensitization device provided according to Embodiment 3 of the present invention;

[0040] Figure 4 It is a schematic diagram of the structure of an electronic device provided by Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0041] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0042] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. In addition, the collected information is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data are all in compliance with the relevant laws, regulations and standards of the relevant countries and regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse

[0043] Embodiment 1

[0044] Figure 1 A flowchart of a data desensitization method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of desensitizing data. The method can be executed by a data desensitization device, which can be implemented in the form of hardware and / or software. Figure 1 As shown, the method includes:

[0045] Step S101: Analyze the received database operation statement to obtain the statement type and syntax tree.

[0046] Specifically, in this implementation, database operation statements are obtained through the client. The client is the entrance for users to use the big data analysis platform and provides a user interface. Users can directly enter database operation statements, such as SQL statements, or select tables and fields to be queried through a wizard, and the client automatically generates SQL statements. The client can be implemented in the form of a client / server (Client / Server, CS) architecture mode or a browser / server (Browser / Server, BS) architecture mode. This implementation does not limit the specific implementation form of the client that generates SQL statements, nor does it limit the method of generating SQL statements.

[0047] Among them, after obtaining the SQL statement, the client in this embodiment will forward the SQL statement to the data desensitizing equipment in the system, and the desensitizing equipment will analyze the received database operation statement. When analyzing the database operation statement, the SQL statement is specifically parsed to obtain the syntax tree corresponding to the SQL statement, wherein the syntax tree includes the grammatical logic of the SQL statement, and the SQL statement will be identified. When it is identified that the SQL statement includes a result set return, for example, Select, the statement type of the SQL statement is determined to be a query statement; when it is identified that there is no result set returned in the SQL statement, for example, Insert or Create, etc., the statement type of the SQL statement is determined to be an execution statement. Of course, this embodiment is only an example for illustration, and does not limit the statement type corresponding to the SQL statement.

[0048] Step S102: when the database operation statement is a query statement, extract the result set fields in the database operation statement.

[0049] Specifically, when the statement type of the database operation statement is determined to be a query statement through identification, the result set fields in the SQL statement are extracted and numbered, and recorded as result set field 1, result set field 2, ..., result set field 5. Of course, this embodiment only takes the extraction of 5 result set fields as an example for explanation, and in actual application, the specific number of result set fields extracted from the SQL statement is not limited.

[0050] It should be noted that, in this embodiment, when an SQL statement is identified as a query statement, but no result set field is extracted from it during field extraction, it means that the statement type identification is incorrect. At this time, the SQL statement will be prompted to re-identify. In this embodiment, after the statement type is identified, a reverse check is performed through the field extraction result to correct the statement type identification result, thereby ensuring the accuracy of statement type identification.

[0051] Step S103: Generate a desensitized field list associated with the result set fields based on the syntax tree and the pre-saved field directed graph.

[0052] Optionally, based on the syntax tree and a pre-saved field directed graph, a list of desensitized fields associated with the result set fields is generated, including: based on the syntax tree and the pre-saved field directed graph, a set of source table fields associated with each result set field is generated; the sensitivity status of the source table field set is obtained, and the sensitivity status of the corresponding result set field is determined according to the sensitivity status of the source table field set, wherein the sensitive status includes sensitive or non-sensitive; and a list of desensitized fields is generated according to the sensitivity status of each result set field.

[0053] Specifically, in this embodiment, since various data tables are stored in the database, and the field directed graph stored in the local storage unit stores the association relationship of all fields contained in the data table, in this embodiment, after obtaining the result set fields of the SQL statement: result set field 1, result set field 2, ..., result set field 5, a list of desensitized fields associated with the result set fields will be generated based on the syntax tree corresponding to the SQL statement and the pre-saved field directed graph. Among them, the local storage unit is used to store the field directed graph of the field association relationship, the field is the point of the directed graph, the association relationship is the edge of the directed graph, each edge starts from the target field and ends at the source table field, and the storage unit in this embodiment is implemented using a relational database, including two tables, namely the field table and the field association relationship table, and the field table is used to store the points of the field directed graph, and the field association relationship table is used to store the edges of the field directed graph. Among them, the field table stores attributes such as table name, field name, and sensitivity, and uses table name and field name as unique indexes; the field association table stores the associations between fields, and both source table fields and target table fields have indexes, and at the initial moment, the local storage unit stores the fields and associations of existing tables in the database.

[0054] Optionally, based on the syntax tree and a pre-saved field directed graph, a source table field set associated with each result set field is generated, including: for each result set field, obtaining the associated initial source table field by traversing the syntax tree; according to the initial source table field, querying the field directed graph by a breadth-first traversal algorithm to obtain the associated expanded source table field; and constructing a source table field set based on the initial source table field and the expanded source table field.

[0055] Optionally, obtaining the sensitivity status of the source table field set includes: obtaining the sensitivity status of each source table field in the source table field set; determining whether the source table field set contains sensitive source table fields, and if so, determining that the sensitivity status of the source table field set is sensitive; otherwise, determining that the sensitivity status of the source table field set is non-sensitive.

[0056] Specifically, this embodiment generates a set of source table fields associated with each result set field based on the syntax tree and a pre-saved field directed graph. For example, for result set field 1, by traversing the syntax tree, the initial source table fields associated with result set field 1 are extracted according to information such as field position, field name, and field alias, such as source table field 1 and source table field 2. During the traversal process, if a field is omitted such as "*", the initial source table field is obtained from the local storage unit. In addition, after obtaining the initial source table field associated with result set field 1, the field directed graph is queried through the breadth-first traversal algorithm to obtain the associated extended source table fields, for example, source table field 3 associated with source table field 1, and source table field 4 associated with source table field 2, and the newly found source table field 3 and source table field 2 are used as extended source table fields, and the initial source table fields and the extended source table fields are used to construct a source table field set A1 associated with result set field 1 = {source table field 1 source table field 2 source table field 3 source table field 4}, so all source table fields associated with result set field 1 are included in the source table field set A1.

[0057] It is worth mentioning that in the present embodiment, after determining the source table field set associated with each result set field, since the attribute information of each source table field can be obtained by querying the storage unit, and the sensitivity status of the source table field is recorded in the attribute information, when there is a source table field with a sensitive status as sensitive in the source table field set, the sensitivity status of the entire source table field set is determined to be sensitive. For example, when the sensitivity status of source table field 1 in source table field set A1 is sensitive, the sensitive status of source table field set A1 is determined to be sensitive. When the sensitive status of the four source table fields in source table field set A1 are all non-sensitive, the sensitive status of source table field set A1 can be determined to be non-sensitive. In addition, in this embodiment, the sensitivity status of the corresponding result set field will be determined according to the sensitivity status of the source table field set. For example, when the sensitivity status of the source table field set A1 is determined to be sensitive, the sensitivity status of the result set field 1 corresponding to the set A1 is sensitive; when the sensitivity status of the source table field set A1 is determined to be non-sensitive, the sensitivity status of the result set field 1 corresponding to the set A1 is non-sensitive. Of course, this embodiment is only an example. The method for obtaining the sensitivity status of other result set fields is roughly the same, and will not be repeated in this embodiment. In addition, in this embodiment, a desensitized field list will be generated according to the sensitivity status of each result set field. The desensitized field list includes all the result set fields extracted from the SQL statement, and the sensitivity status corresponding to each result set field. The following Table 1 shows an example of the obtained desensitized field list:

[0058] Table 1

[0059] Result set fields Sensitive state Result set field 1 sensitive Result set field 2 Non-sensitive Result set field 3 Non-sensitive Result set field 4 Non-sensitive Result set field 5 Non-sensitive

[0060] In this implementation, the SQL statement including five result set fields is used as an example for description, and the specific number of result set fields included in the SQL statement is not limited.

[0061] Step S104, obtaining a result set fed back by executing the database operation statement, and performing data desensitization processing on the result set through a desensitized field list.

[0062] Optionally, a result set fed back by executing a database operation statement is obtained, and the result set is desensitized through a desensitized field list, including: sending the database operation statement to a query engine so that the query engine processes the data in the database according to the database operation statement; receiving the result set fed back by the query engine; querying the specified field in the desensitized field list that hits the query result set, and hiding the result data of the specified field.

[0063] Specifically, in this embodiment, the database operation statement will be sent to the query engine, and the query engine will process the data in the database according to the SQL statement to obtain a result set. After obtaining the result set, the data desensitizing equipment will compare the result set and the desensitized field list line by line. When it is determined that the specified field in the desensitized field list is hit in the result set, for example, the result set contains ID: 02345, but the sensitive state corresponding to the result set field ID is recorded as sensitive in the desensitized field list, then the ID will be used as the specified field to be desensitized, and the result data "02345" of the ID will be replaced with "*", thereby realizing the hiding of the result data of the ID field. Of course, in this embodiment, only the desensitization of the result data corresponding to the hit ID field is used as an example for explanation. The method of desensitizing the result data of other specified fields is roughly the same, and will not be repeated in this embodiment.

[0064] It is worth mentioning that in this implementation, the fields in the SQL statement are not desensitized during the query stage. Instead, after the execution is completed and the result set is obtained, the data that needs to be desensitized in the result set is hidden by comparing it with the desensitized field list. Therefore, during the execution of the SQL statement, all fields are displayed, and it does not affect the associated query based on the fields in the intermediate table and the result table. That is, the intermediate table and the result table are not desensitized during the data processing stage, and the associated query of sensitive fields between multiple tables is supported, which can meet a variety of data analysis scenarios. In addition, when querying and exporting, the fund determines whether it is sensitive based on the field association relationship contained in the syntax tree and the field directed graph, and only desensitizes the sensitive part of the exported content, thereby ensuring the security of the final data.

[0065] In the implementation mode of the present application, when it is determined to be a query statement, the result set fields in the statement are extracted and a desensitized field list is generated. The result set data is desensitized through the desensitized field list only after the database operation statement is executed, and the operation statement is not field desensitized before the query, so as not to affect the intermediate query process. Therefore, the security of the data is improved while ensuring the normal execution of the database operation statement.

[0066] Embodiment 2

[0067] Figure 2 This is a flow chart of a data desensitization method provided in the second embodiment of the present invention. This embodiment is based on the above embodiment. After analyzing the received database operation statement to obtain the statement type and syntax tree, it also includes: when the database operation statement is an execution statement, the field directed graph in the local storage unit is updated based on the database operation statement. Figure 2 As shown, the method includes:

[0068] Step S201: Analyze the received database operation statement to obtain the statement type and syntax tree.

[0069] Step S202, determine whether the statement type is a query statement, if so, execute step S203, otherwise, execute step S206.

[0070] Step S203: when the database operation statement is a query statement, extract the result set fields in the database operation statement.

[0071] Step S204: Generate a desensitized field list associated with the result set fields based on the syntax tree and the pre-saved field directed graph.

[0072] Optionally, based on the syntax tree and a pre-saved field directed graph, a list of desensitized fields associated with the result set fields is generated, including: based on the syntax tree and the pre-saved field directed graph, a set of source table fields associated with each result set field is generated; the sensitivity status of the source table field set is obtained, and the sensitivity status of the corresponding result set field is determined according to the sensitivity status of the source table field set, wherein the sensitive status includes sensitive or non-sensitive; and a list of desensitized fields is generated according to the sensitivity status of each result set field.

[0073] Optionally, based on the syntax tree and a pre-saved field directed graph, a source table field set associated with each result set field is generated, including: for each result set field, obtaining the associated initial source table field by traversing the syntax tree; according to the initial source table field, querying the field directed graph by a breadth-first traversal algorithm to obtain the associated expanded source table field; and constructing a source table field set based on the initial source table field and the expanded source table field.

[0074] Optionally, obtaining the sensitivity status of the source table field set includes: obtaining the sensitivity status of each source table field in the source table field set; determining whether the source table field set contains sensitive source table fields, and if so, determining that the sensitivity status of the source table field set is sensitive; otherwise, determining that the sensitivity status of the source table field set is non-sensitive.

[0075] Step S205, obtaining a result set fed back by executing the database operation statement, and performing data desensitization processing on the result set through the desensitized field list.

[0076] Optionally, a result set fed back by executing a database operation statement is obtained, and the result set is desensitized through a desensitized field list, including: sending the database operation statement to a query engine so that the query engine processes the data in the database according to the database operation statement; receiving the result set fed back by the query engine; querying the specified field in the desensitized field list that hits the query result set, and hiding the result data of the specified field.

[0077] Step S206: when the database operation statement is an execution statement, extract the target field in the database operation statement.

[0078] Specifically, when the database operation statement is an execution statement, the execution statement will be analyzed and the field directed graph in the local storage unit will be updated to maintain the fields and associations of the newly added table in the database. When the database operation statement is determined to be an execution statement, the target fields in the SQL statement will be extracted and numbered as target field 1, target field 2, ..., target field 6. Of course, this embodiment only takes the extraction of 6 target fields as an example for explanation, and in actual application, the specific number of target fields extracted from the SQL statement is not limited.

[0079] Step S207: For each target field, the associated source table field is obtained by traversing the syntax tree, and the association relationship with the source table field is obtained.

[0080] Specifically, in this embodiment, after obtaining the target fields in the SQL statement: target field 1, target field 2, ..., target field 6, each target field will be saved in the local storage unit. In addition, for each target field, the associated source table field and the association relationship with the source table field will be obtained by traversing the syntax tree. For example, for target field 1, the source table field associated with target field 1 is extracted by traversing the syntax tree according to the field position, field name and field alias information, for example, source table field 8, and in the traversal process, if the field is omitted such as "*", the initial source table field is obtained from the local storage unit. In this embodiment, the target field 1 and the association relationship with the source table field 8 will also be saved in the local storage unit. Of course, in this embodiment, only the source table field and the association relationship associated with the target field 1 are used as an example for explanation. The method for obtaining the source table fields and the association relationship associated with other target fields is roughly the same, and will not be repeated in this embodiment.

[0081] Step S208: updating the pre-saved field directed graph according to the target field and the association relationship.

[0082] Specifically, in this implementation, the target field and the associated relationship will be updated according to the field directed graph pre-saved in the local storage unit. Specifically, the target field is added as a node to the field directed graph, and the associated relationship is the edge of the field directed graph. Each edge starts from the target table field and ends at the source table field. Until all the target fields extracted from the SQL statement are processed, it is determined that the field directed graph has been updated.

[0083] In addition, in this embodiment, the execution statement is also sent to the query engine, and the query engine processes the data in the database by executing the above-obtained execution statement, such as creating a new table in the database or inserting into an existing table in the database, etc. However, no result set is returned when the execution statement processes the data in the database. In this embodiment, the field directed graph in the local storage unit is updated to ensure that the field directed graph is always consistent with the fields and associations of the existing tables in the database.

[0084] In the implementation mode of the present application, when it is determined to be a query statement, the result set fields in the statement are extracted and a desensitized field list is generated. The result set data is desensitized through the desensitized field list only after the database operation statement is executed, and the operation statement is not field desensitized before the query, so as not to affect the intermediate query process. Therefore, the security of the data is improved while ensuring the normal execution of the database operation statement.

[0085] Embodiment 3

[0086] Figure 3This is a schematic diagram of the structure of a data desensitization device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a database operation statement analysis module 310, a result set field extraction module 320, a desensitized field list generation module 330 and a data desensitization module 340.

[0087] The database operation statement analysis module 310 is used to analyze the received database operation statement to obtain the statement type and syntax tree, wherein the statement type includes an execution statement or a query statement;

[0088] A result set field extraction module 320, for extracting result set fields in a database operation statement when the database operation statement is a query statement;

[0089] The desensitized field list generation module 330 is used to generate a desensitized field list associated with the result set fields based on the syntax tree and the pre-saved field directed graph, wherein the directed graph includes the association relationship between the fields in the database;

[0090] The data desensitization module 340 is used to obtain the result set fed back by executing the database operation statement, and perform data desensitization processing on the result set through the desensitization field list.

[0091] Optionally, the desensitized field list generation module includes: a source table field set generation unit, used to generate a source table field set associated with each result set field based on a syntax tree and a pre-saved field directed graph;

[0092] A sensitivity status determination unit, used to obtain the sensitivity status of the source table field set, and determine the sensitivity status of the corresponding result set field according to the sensitivity status of the source table field set, wherein the sensitivity status includes sensitive or non-sensitive;

[0093] The desensitized field list generating unit is used to generate a desensitized field list according to the sensitivity status of each result set field.

[0094] Optionally, a source table field set generation unit is used to obtain the associated initial source table field by traversing the syntax tree for each result set field;

[0095] According to the initial source table fields, query the field directed graph through the breadth-first traversal algorithm to obtain the associated expanded source table fields;

[0096] Build a source table field collection based on the initial source table fields and the expanded source table fields.

[0097] Optionally, a sensitivity status determination unit is used to obtain the sensitivity status of each source table field in the source table field set;

[0098] It is determined whether the source table field set contains sensitive source table fields. If so, the sensitivity state of the source table field set is determined to be sensitive. Otherwise, the sensitivity state of the source table field set is determined to be non-sensitive.

[0099] Optionally, a data desensitization module is used to send the database operation statement to the query engine so that the query engine processes the data in the database according to the database operation statement;

[0100] Receive the result set fed back by the query engine;

[0101] The query result set matches the specified field in the desensitized field list and hides the result data of the specified field.

[0102] Optionally, the device further comprises a field directed graph update module, which is used to extract a target field in the database operation statement when the database operation statement is an execution statement;

[0103] For each target field, the associated source table field is obtained by traversing the syntax tree, and the association relationship with the source table field is obtained;

[0104] Update the pre-saved field directed graph according to the target field and the associated relationship.

[0105] The data desensitization device provided in the embodiment of the present invention can execute the data desensitization method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0106] Embodiment 4

[0107] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0108] like Figure 4As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0109] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0110] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a data desensitization method.

[0111] In some embodiments, the method for data desensitization may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data desensitization method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data desensitization method in any other appropriate manner (e.g., by means of firmware).

[0112] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0113] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0114] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0115] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0116] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0117] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0118] Embodiment 5

[0119] An embodiment of the present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the data desensitization method provided in any embodiment of the present application.

[0120] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0121] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0122] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A data desensitization method, characterized in that: include: Analyze the received database operation statement to obtain a statement type and a syntax tree, wherein the statement type includes an execution statement or a query statement; When the database operation statement is the query statement, extracting the result set field in the database operation statement; Based on the syntax tree and a pre-saved field directed graph, a list of desensitized fields associated with the result set fields is generated, wherein the directed graph includes associations between the fields in the database; A result set fed back by executing the database operation statement is obtained, and data desensitization processing is performed on the result set using the desensitized field list.

2. The method according to claim 1, characterized in that The generating, based on the syntax tree and the pre-saved field directed graph, a list of desensitized fields associated with the result set fields includes: Based on the syntax tree and the pre-saved field directed graph, generating a source table field set associated with each of the result set fields; Acquire the sensitivity status of the source table field set, and determine the sensitivity status of the corresponding result set field according to the sensitivity status of the source table field set, wherein the sensitivity status includes sensitive or non-sensitive; The desensitized field list is generated according to the sensitivity status of each field in the result set.

3. The method according to claim 2, characterized in that The generating, based on the syntax tree and the pre-saved field directed graph, a source table field set associated with each of the result set fields comprises: For each of the result set fields, acquiring the associated original source table field by traversing the syntax tree; According to the initial source table field, query the field directed graph through a breadth-first traversal algorithm to obtain the associated expanded source table field; The source table field set is constructed according to the initial source table fields and the expanded source table fields.

4. The method according to claim 2, characterized in that: The obtaining of the sensitive status of the source table field set includes: Obtaining the sensitivity status of each source table field in the source table field set; It is determined whether the source table field set includes a sensitive source table field. If so, the sensitivity state of the source table field set is determined to be sensitive. Otherwise, the sensitivity state of the source table field set is determined to be non-sensitive.

5. The method according to claim 1, characterized in that The obtaining of the result set fed back by executing the database operation statement, and performing data desensitization processing on the result set through the desensitized field list, includes: Sending the database operation statement to a query engine so that the query engine processes the data in the database according to the database operation statement; Receive the result set fed back by the query engine; The specified fields in the result set that hit the desensitized field list are queried, and the result data of the specified fields are hidden.

6. The method according to claim 1, characterized in that The method further comprises: When the database operation statement is the execution statement, extracting the target field in the database operation statement; For each of the target fields, the associated source table fields are obtained by traversing the syntax tree, and the association relationship with the source table fields is obtained; The pre-saved field directed graph is updated according to the target field and the association relationship.

7. A data desensitization device, characterized in that: The device comprises: A database operation statement analysis module, used to analyze the received database operation statement to obtain the statement type and syntax tree, wherein the statement type includes an execution statement or a query statement; A result set field extraction module, used for extracting the result set field in the database operation statement when the database operation statement is the query statement; A desensitized field list generation module, used to generate a desensitized field list associated with the result set field based on the syntax tree and a pre-saved field directed graph, wherein the directed graph includes the association relationship between the fields in the database; The data desensitization module is used to obtain the result set fed back by executing the database operation statement, and perform data desensitization processing on the result set through the desensitized field list.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method according to any one of claims 1 to 6 when executed.

10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 6 when being executed by a processor.

Citation Information

Patent Citations

  • Software resource system based on field-level blood relationship and establishment method thereof

    CN111782265A

  • ANTLR-based data field blood relationship analysis method and device

    CN113220800A

  • Data query method and device, storage medium and electronic equipment

    CN116303625A

  • Data desensitization method and device, electronic equipment and readable storage medium

    CN117493483A

  • Data table display method and device, medium, electronic equipment and program product

    CN118964453A