Dynamic sensitive data desensitization system based on data layer driving
By adopting a dynamic sensitive data desensitization system driven by data layer in Java applications, identifying and processing sensitive fields, the security and performance issues of sensitive data processing in Java applications are solved, and efficient data security and privacy protection are achieved.
Patent Information
- Application Number
- CN202411950357.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art has security risks and performance losses when processing sensitive data in Java applications, making it difficult to meet the requirements of data security and privacy protection.
A dynamic sensitive data desensitization system based on data layer drive is adopted, including a desensitization filter, a desensitization processor, a sensitive field configuration module and a desensitization rule configuration module. The fields that need to be desensitized are identified through the desensitization filter and sent to the desensitization processor for desensitization processing.
Effectively protect sensitive data in Java applications, improve data security and privacy protection level, avoid the system complexity and performance reduction brought about by traditional encryption methods, and meet the requirements of privacy regulations.
Smart Images

Figure CN119885266A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data security, and in particular relates to a dynamic sensitive data desensitization system driven by a data layer. Background Art
[0002] In today's digital age, data security and privacy protection are one of the major challenges facing businesses and individuals. With the frequent occurrence of large-scale data breaches and the continuous strengthening of privacy regulations, protecting sensitive data has become one of the top priorities in business. In many business applications, especially those involving personal identity, financial information and other sensitive data, effective data protection is particularly important.
[0003] Currently, Java applications often use databases to store and retrieve information when processing sensitive data. However, traditional database storage methods have certain security risks because data in the database is usually stored in plain text, which is vulnerable to unauthorized access or malicious attacks. To meet this challenge, existing technologies often use encryption and other means to protect data security, but this approach may increase system complexity, reduce performance, and in some cases may not meet the requirements of privacy regulations.
[0004] Therefore, there is an urgent need for an efficient, flexible and compliant sensitive data protection solution to ensure data security and privacy protection in Java applications. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a dynamic sensitive data desensitization system driven by a data layer in view of the deficiencies of the above-mentioned prior art, so that sensitive data can be effectively protected during storage and retrieval without affecting the normal operation and performance of the application.
[0006] In order to achieve the above technical objectives, the technical solution adopted by the present invention is:
[0007] A dynamic sensitive data desensitization system based on data layer drive, including a desensitization filter, a desensitization processor, a sensitive field configuration module and a desensitization rule configuration module;
[0008] The sensitive field configuration module is used to configure sensitive field information; the desensitization rule configuration module is used to configure desensitization rules;
[0009] The desensitizing filter is embedded in the data layer driver file, directly connected to the result set returned by the database, and is used to filter the fields in the result set based on the sensitive field configuration information, identify the column number and desensitization rule of the field that needs to be desensitized, and send it to the desensitization processor;
[0010] The desensitizing processor is used to process the result data line by line according to the column number of the field to be desensitized and the desensitizing rule, apply the desensitizing rule when processing each field of each line, and send the desensitizing processing result to the mybatis processing layer for post-processing.
[0011] To optimize the above technical solutions, the specific measures taken also include:
[0012] The above sensitive field configuration module is compatible with uppercase and lowercase letters when configuring sensitive fields; at the same time, it can configure auxiliary fields in addition to the target field, constrain the current configuration field based on the value range of the auxiliary field, and ensure that for the attribute table, the sensitive field type of the attribute value can be distinguished according to the attribute id.
[0013] The configuration file of the sensitive field configuration module mentioned above is in json format and is placed in the project root directory. After startup, changes can also be made by hot loading and updating the configuration.
[0014] The above sensitive field configuration information includes the configured schema, table name, column name, and field name.
[0015] A series of desensitization rules are configured in the above desensitization rule configuration module, including replacement, deletion, and fuzzy processing, to meet the desensitization requirements of different types of data.
[0016] The above desensitization rules contain multiple sub-items, each of which has corresponding auxiliary information types and auxiliary fields. The auxiliary information types include http context, input parameters, and other columns of the result set. The types are used to obtain the corresponding auxiliary fields to facilitate determining the desensitization type of this specific application, and then desensitize the corresponding field values according to the regular expression configuration corresponding to the desensitization type.
[0017] The above-mentioned desensitization rule configuration module configures specific types based on the packaged regular expression, and can match different rules according to the original input head and message fields to support the needs of desensitizing different customer names with different rules; it can configure rules according to the needs of new scenarios without modifying the logic.
[0018] The above-mentioned desensitizing filter performs field filtering and identification by first processing the header field name and then processing the result set line by line.
[0019] The above-mentioned desensitizing filter reads the head part of the result set returned by the database, determines the sensitive type and auxiliary field of the field to be processed based on the field name head returned by the database, obtains the definition of each column field from the head of the result set, compares the schema, table name and field name of each column with the sensitive field configuration information one by one, and confirms the column number and desensitizing rule of the field to be desensitized.
[0020] For the desensitizing rules and column numbers passed by the desensitizing filter, the above-mentioned desensitizing processor first determines the type of each subclass in the desensitizing rule, and obtains the request context, the original input parameters of the request, and the values of other columns of the result set as auxiliary judgment according to the type; according to the auxiliary field, it obtains the matching desensitizing type in the desensitizing rule, and then obtains the configured regular expression according to the desensitizing type, and re-encapsulates the field value of the corresponding column number of the result row into the result set after processing through the regular expression.
[0021] The present invention has the following beneficial effects:
[0022] The present invention enables users to easily perform desensitization processing on sensitive data in Java applications, thereby improving the security and privacy protection level of data.
[0023] The present invention is flexible and configurable, and can define different desensitization rules according to actual needs, meet various complex desensitization scenarios, and can flexibly respond to the desensitization needs of different types of data, thereby improving data security and privacy protection.
[0024] Compared with the previous personalized customization processing of the front end or the caller, the present invention effectively avoids the risk of leakage in the transmission process, and at the same time has a short development cycle and high efficiency for the processing of new scenarios; compared with the previous processing at the application layer, the model change is much lower than the application frequency, and the coverage starting from the data layer is more comprehensive, avoiding information leakage due to omissions when new needs are added. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a diagram of the structure of a dynamic sensitive data desensitization system based on data layer drive in the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention 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 invention and are not used to limit the present invention.
[0027] Although the steps in the present invention are arranged with numbers, they are not used to limit the order of the steps. Unless the order of the steps is clearly stated or the execution of a certain step requires other steps as a basis, the relative order of the steps can be adjusted. It is understood that the term "and / or" used in this article involves and covers any and all possible combinations of one or more of the associated listed items.
[0028] The present invention provides a dynamic sensitive data desensitization system based on Java database layer, such as Figure 1As shown, based on database-driven extension, the security and privacy of sensitive data are protected, including desensitizing filters, desensitizing processors, sensitive field configuration modules and desensitizing rule configuration modules, to achieve desensitization of sensitive data in the database;
[0029] The sensitive field configuration module is used to configure sensitive field information; the desensitization rule configuration module is used to configure desensitization rules;
[0030] The desensitizing filter is embedded in the data layer driver file, directly connected to the result set returned by the database, and is used to filter the fields in the result set based on the sensitive field configuration information, identify the column number and desensitization rule of the field that needs to be desensitized, and send it to the desensitization processor;
[0031] The desensitizing processor is used to process the result data line by line according to the column number of the field to be desensitized and the desensitizing rule, apply the desensitizing rule when processing each field of each line, and send the desensitizing processing result to the mybatis processing layer for post-processing.
[0032] This technology can effectively protect sensitive data in Java applications and desensitize the data when it returns the result set to improve data security and privacy protection. The specific implementation plan is as follows:
[0033] The database directly returns information to connect to the filter, the filter is connected to the sensitive field configuration file, the filter is connected to the processor, the processor is connected to the desensitization rule configuration file, and the data processed by the processor is returned to the mybatis processing layer.
[0034] The result set returned by the database is filtered by the desensitizing filter to select the fields that need to be processed, and then the desensitizing processor completes the desensitizing processing, and is handed over to the subsequent mybatis layer for post-processing and returned to the calling method.
[0035] In an embodiment, the sensitive field configuration module of the present invention is used to define field information that needs to be desensitized, including schema, table name, field name, etc.; the sensitive field configuration module specifies the sensitive fields that need to be desensitized so that the filter can correctly identify and capture these fields. Sensitive fields can be configured based on schema, table name, and field name, and can be configured to be compatible with uppercase and lowercase letters; at the same time, auxiliary fields other than the target field can be configured. Constrain the current configuration field based on the value range of the auxiliary field to ensure that for the attribute table, the sensitive field type of the attribute value can be distinguished according to the attribute id.
[0036] The configuration file is in json format and is placed in the project root directory. Changes after startup can also be hot-loaded to update the configuration.
[0037] In the embodiment, a series of desensitization rules for different fields are defined in the desensitization rule configuration module, including but not limited to replacement, deletion, fuzzy processing, etc., to meet the desensitization requirements of different types of data. The rule is based on a regular expression and can support matching different rules according to the original input head and message fields.
[0038] The desensitization rule contains multiple sub-items, each of which has a corresponding auxiliary information type and auxiliary value. The auxiliary information type includes but is not limited to http context, input parameters, and other columns of the result set. The corresponding auxiliary information value is obtained by type to facilitate the determination of the desensitization type of this specific application. Then, the field value is desensitized according to the regular configuration corresponding to the desensitization type.
[0039] Desensitization rules can match different rules according to the different configuration fields in the original input header or the original input message to support the needs of desensitizing different customer names with different rules.
[0040] Desensitization rules are implemented based on packaged regular expression configurations to meet customized desensitization formats for different sensitive data types. Without modifying the logic, the requirements of new scenarios can be supported at any time through configuration.
[0041] When implementing the present invention, it is first necessary to set up a configuration file, which contains a list of sensitive fields and corresponding desensitization rules; then it needs to be integrated with the application, load the configuration file into the application, and initialize the desensitization filter and desensitization processor; thereafter, the correctness of the desensitization filter and desensitization processor is verified by writing unit tests, simulating data query and processing processes in different scenarios, and ensuring that the desensitization function runs normally and does not affect system performance.
[0042] In the embodiment, the desensitizing filter is responsible for identifying sensitive fields in the database and passing them to the desensitizing processor for desensitization processing. During filtering, the header field name is processed first and then the result set is processed line by line.
[0043] The desensitizing filter is embedded in the driver file. It reads the head part of the result set returned by the database, compares it with the configured schema, table name, and column name, and confirms the column number and desensitizing rules of the field that needs to be desensitized.
[0044] The filter uniformly targets the field name head returned by the data layer, determines the sensitive type and auxiliary fields of the fields that need to be processed, and then records the column number to process the returned results one by one to avoid repeated execution of the filter layer logic affecting efficiency.
[0045] Specifically, the desensitizing filter of the present invention performs field filtering through the configuration file of the sensitive field configuration module to determine which fields need to be desensitized. The filter can configure the schema, table name, field name and other information according to the content in the desensitizing field configuration file, and support case compatibility.
[0046] At the same time, the desensitization filter can also configure auxiliary fields based on the sensitive field configuration module. For example, the attribute table can distinguish sensitive data types by different attribute IDs. When the database returns the query results, the logic of the driver processing the returned results is rewritten to obtain the definition of each column field from the head of the result set, and the schema, table name and field name of each column are compared in the configuration. If it is found that the configuration requires desensitization, the desensitization rules and column numbers are recorded for unified processing by subsequent processors.
[0047] In an embodiment, the desensitizing processor receives the sensitive field transmitted by the filter, and processes it according to the desensitizing rules pre-configured by the desensitizing rule configuration module to ensure that the sensitive data is not leaked during storage and transmission.
[0048] Specifically, the desensitizing processor of the present invention is used to process the result data line by line, and the desensitizing rules are applied when processing each field of each line. The configuration of the desensitizing rules is flexible, and different rules can be matched according to the field information of the original input parameters and the message fields to meet the different desensitization requirements of different customer names. The specific type is configured using a regular expression, and the part that meets the regular condition will be replaced with *. For the desensitizing rules and column numbers passed by the filter, the type of each subclass in the desensitizing rule is first determined. According to the type, it may be necessary to obtain the request context, the original input parameters of the request, and the values of other columns of the result set as auxiliary judgments. According to the auxiliary value (which may not be available), the matching desensitization type is obtained in the desensitizing rule. Then the configured regular expression is obtained according to the desensitization type, and the field value of the corresponding column number of the result row is repackaged into the result set after being processed by the regular expression.
[0049] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0050] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
Claims
1. A dynamic sensitive data desensitization system based on data layer drive, characterized by: Including desensitizing filter, desensitizing processor, sensitive field configuration module and desensitizing rule configuration module; The sensitive field configuration module is used to configure sensitive field information; The desensitization rule configuration module is used to configure desensitization rules; The desensitizing filter is embedded in the data layer driver file, directly connected to the result set returned by the database, and is used to filter the fields in the result set based on the sensitive field configuration information, identify the column number and desensitization rule of the field that needs to be desensitized, and send it to the desensitization processor; The desensitizing processor is used to process the result data line by line according to the column number of the field to be desensitized and the desensitizing rule, apply the desensitizing rule when processing each field of each line, and send the desensitizing processing result to the mybatis processing layer for post-processing.
2. According to claim 1, a data layer driven dynamic sensitive data desensitization system is characterized by: The sensitive field configuration module is compatible with uppercase and lowercase letters when configuring sensitive fields; at the same time, it can configure auxiliary fields other than the target field, constrain the current configuration field based on the value range of the auxiliary field, and ensure that for the attribute table, the sensitive field type of the attribute value can be distinguished according to the attribute id.
3. According to claim 1, a data layer driven dynamic sensitive data desensitization system is characterized by: The configuration file of the sensitive field configuration module adopts json format and is placed in the project root directory. After startup, changes can also be made and the configuration can be updated by hot loading.
4. According to claim 1, a data layer driven dynamic sensitive data desensitization system is characterized by: The sensitive field configuration information includes the configured schema, table name, column name, and field name.
5. According to claim 1, a data layer driven dynamic sensitive data desensitization system is characterized by: A series of desensitization rules are configured in the desensitization rule configuration module, including replacement, deletion, and fuzzy processing, to meet the desensitization requirements of different types of data.
6. The data layer driven dynamic sensitive data desensitization system according to claim 1, characterized in that: The desensitization rule contains multiple sub-items, each sub-item has a corresponding auxiliary information type and auxiliary field. The auxiliary information type includes http context, input parameters, and other columns of the result set. The type is used to obtain the corresponding auxiliary field to facilitate determining the desensitization type of this specific application, and then desensitize the corresponding field value according to the regular expression configuration corresponding to the desensitization type.
7. The data layer driven dynamic sensitive data desensitization system according to claim 1 is characterized by: The desensitization rule configuration module configures specific types based on the packaged regular expression, and can match different rules according to the head and message fields of the original input parameters to support the needs of desensitizing different customer names with different rules; it can configure rules according to the needs of new scenarios without modifying the logic.
8. The data layer driven dynamic sensitive data desensitization system according to claim 1 is characterized by: The desensitizing filter performs field filtering and identification by giving priority to the header field names and then processing the result set line by line.
9. The data layer driven dynamic sensitive data desensitization system according to claim 1, characterized in that: The desensitizing filter reads the head part information in the result set returned by the database, determines the sensitive type and auxiliary fields of the fields that need to be processed based on the field name head returned by the database, obtains the definition of each column field from the head of the result set, and compares the schema, table name and field name of each column with the sensitive field configuration information one by one to confirm the column number and desensitization rules of the fields that need to be desensitized.
10. The data layer driven dynamic sensitive data desensitization system according to claim 1, characterized in that: The desensitization processor first determines the type of each subclass in the desensitization rule for the desensitization rule and column number passed by the desensitization filter, and obtains the request context, the original input parameter of the request, and the values of other columns of the result set as auxiliary judgment according to the type; According to the auxiliary field, the matching desensitization type is obtained in the desensitization rule, and then the configured regular expression is obtained according to the desensitization type. The field value of the corresponding column number of the result row is processed through the regular expression and re-encapsulated into the result set.