Data desensitization method and electronic device based on Caché database
By receiving the request information and determining whether the response information contains sensitive data, preset rules are used to desensitize the data in the Caché database, the problem of low data desensitization efficiency in the prior art is solved, and efficient and accurate data protection is achieved.
Patent Information
- Application Number
- CN202011568080.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-25
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2040-12-25
AI Technical Summary
Existing data desensitization technologies cannot effectively and quickly desensitize data based on Caché databases, resulting in data security risks and privacy risks.
By receiving the request information, we judge whether the response information contains sensitive data, and perform desensitization after confirmation, and desensitization is used to desensitize sensitive data, including parsing, randomization, mapping, overwriting or encryption algorithms.
Improve the efficiency and accuracy of data desensitization, reduce unnecessary desensitization work, and ensure the safety of sensitive data.
Smart Images

Figure CN112528339B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of database technology, and in particular to a data desensitization method and electronic device based on a Caché database. Background Art
[0002] As a new generation of high-performance database technology, Caché supports relational databases and object-based databases, providing more efficient performance and greater scalability than relational technology. It is widely used in HIS systems (Health Care Information Systems) in the United States and Europe and is recognized by the medical community as the preferred database.
[0003] The status of data as a basic strategic resource is becoming increasingly prominent, and personal data information is seriously over-collected. Artificial intelligence, the Internet of Things, cloud computing, big data and other fields are highly dependent on the reading, collection and application of personal data, and there are serious data security risks. Once the server is attacked by hackers and data is leaked, the user's privacy, property and even personal safety may be endangered. Criminals steal data information by attacking corporate servers, and then sell data for profit on the dark web. They may also use this private data to blackmail users and other criminal activities.
[0004] Under this trend, the Caché database stores a large amount of user sensitive information, and desensitization is extremely important. However, the existing desensitization technology cannot quickly desensitize and display the data based on the Caché database. Summary of the invention
[0005] The main technical problem solved by the embodiment of the present invention is to provide a data desensitization method based on the Caché database, which has high desensitization efficiency and accuracy.
[0006] In order to solve the above technical problems, in a first aspect, an embodiment of the present invention provides a data desensitization method based on a Caché database, comprising:
[0007] Receiving request information from a requesting end, wherein the request information is used to indicate an operation on a Caché database;
[0008] Generate response information according to the request information and the Caché database;
[0009] Determining whether the response information includes sensitive data;
[0010] If so, the response information is desensitized.
[0011] In some embodiments, the request information is a request message based on a preset transmission protocol, and the response information includes at least one response message based on the preset transmission protocol, and the at least one response message is sorted in order of generation time;
[0012] The determining whether the response information includes sensitive data comprises:
[0013] Obtain multiple characters of a first response message in the at least one response message, wherein the multiple characters are a preset number of characters starting from the first character of the first response message;
[0014] If the plurality of characters include the first keyword, determining whether the response header of the first response message includes the second keyword;
[0015] If yes, determining whether the response information includes sensitive data;
[0016] The first keyword is used to reflect the preset transmission protocol, and the second keyword is used to reflect that the response message includes sensitive data.
[0017] In some embodiments, the method further comprises:
[0018] According to the response header of the first response message, obtaining the expected length of all response contents corresponding to the response information;
[0019] Obtaining a first actual length of the response content in the first response message;
[0020] If the first actual length is smaller than the expected length, sending an empty message to the requesting end and storing the first response message;
[0021] Accepting a next response message, obtaining a second actual length of the response content in the next response message, and accumulating the second actual length with the first actual length to obtain an accumulated length;
[0022] If the accumulated length is less than the expected length, an empty message is sent to the requesting end, the next response message is stored, and the execution of accepting the next response message is returned to obtain the second actual length of the response content in the next response message, and the second actual length is accumulated with the first actual length to obtain the accumulated length step until the accumulated length is equal to the expected length to obtain the entire response content.
[0023] In some embodiments, the desensitizing the response information includes:
[0024] Parsing all the response contents to obtain the sensitive data;
[0025] The sensitive data is desensitized according to a first preset rule.
[0026] In some embodiments, the request information is a SQL statement, and the response information is a result of executing the SQL statement on the Caché database;
[0027] The determining whether the response information includes sensitive data comprises:
[0028] Performing syntax analysis on the SQL statement to obtain the syntax of the SQL statement;
[0029] Determine whether the syntax of the SQL statement is select syntax;
[0030] If so, it is determined that the response information includes the sensitive data.
[0031] In some embodiments, before the step of generating response information according to the request information and the Caché database, the method further includes:
[0032] If the SQL statement exists in a cache statement library, directly executing the step of generating response information according to the request information and the Caché database, the cache statement library including a plurality of historical SQL statements;
[0033] If the SQL statement does not exist in the cache statement library, determining whether the SQL statement meets a preset condition;
[0034] If so, the step of generating response information according to the request information and the Caché database is performed, and the SQL statement is cached in the cache statement library.
[0035] In some embodiments, the desensitizing the response information includes:
[0036] Parsing the response information to obtain the sensitive data;
[0037] The sensitive data is desensitized according to a second preset rule.
[0038] In some embodiments, the second preset rule includes at least one of a random, mapping, covering, replacing or encryption algorithm.
[0039] In order to solve the above technical problems, in a second aspect, an embodiment of the present invention provides an electronic device, including:
[0040] at least one processor; and,
[0041] a memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data desensitization method based on the Caché database as described in the first aspect above.
[0043] To solve the above technical problems, in the third aspect, an embodiment of the present invention provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes the method described in the first aspect above.
[0044] Beneficial effects of the embodiments of the present invention: Different from the prior art, the data desensitization method based on the Caché database provided by the embodiments of the present invention receives request information from the requesting end, the request information is used to indicate the operation on the Caché database, generates response information according to the request information and the Caché database, determines whether the response information includes sensitive data, and if so, performs desensitization on the response information. That is, after obtaining the response information, the data desensitization method first judges the response information, and only performs desensitization after determining that it includes sensitive data, so that the response information that does not include sensitive data can be directly released, reducing unnecessary desensitization work, and performing desensitization on the response information that includes sensitive data, so that the desensitization efficiency is high and accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0046] Figure 1 A schematic diagram of an application environment of an embodiment of a data desensitization method based on a Caché database provided by one embodiment of the present invention;
[0047] Figure 2 A schematic diagram of the structure of an electronic device provided by one embodiment of the present invention;
[0048] Figure 3 A schematic diagram of a process of a data desensitization method based on a Caché database provided in one embodiment of the present invention;
[0049] Figure 4 for Figure 3 A schematic diagram of a sub-process of step S23 in the method shown;
[0050] Figure 5A schematic diagram of a process of a data desensitization method based on a Caché database provided in one embodiment of the present invention;
[0051] Figure 6 for Figure 3 A schematic diagram of a sub-process of step S24 in the method shown;
[0052] Figure 7 for Figure 3 Another sub-process diagram of step S23 in the method shown;
[0053] Figure 8 A schematic diagram of a process of a data desensitization method based on a Caché database provided in one embodiment of the present invention;
[0054] Fig. 9 for Figure 3 Another sub-flow diagram of step S24 in the method shown. DETAILED DESCRIPTION
[0055] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0056] 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.
[0057] It should be noted that, if there is no conflict, the various features in the embodiments of the present invention can be combined with each other, all within the scope of protection of the present application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the flow chart. In addition, the words "first", "second", "third", etc. used herein do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.
[0058] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification and in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.
[0059] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0060] See also Figure 1 , which is a schematic diagram of an application environment of an embodiment of a data desensitization method based on a Caché database applied to the present invention, the system includes: a database server 10 and a terminal 20.
[0061] The database server 10 and the terminal 20 are communicatively connected, and the communication connection may be a wired connection, such as an optical fiber cable, or a wireless communication connection, such as a WIFI connection, a Bluetooth connection, a 4G wireless communication connection, a 5G wireless communication connection, and the like.
[0062] The database server 10 may be a physical server, or a cloud server, cloud host, cloud service platform, cloud computing platform, etc. The database server 10 is equipped with one or more Caché databases. It is understandable that the server may also be a computer equipped with one or more databases.
[0063] Among them, the Caché database is a post-relational database that is fully object-oriented and can perform intuitive data modeling. It integrates object database access, high-performance SQL access, and powerful multidimensional data access, and supports the above three methods to access the same data in the database at the same time. The Caché database is a true object-based database. During development, users can directly use the database to define the objects they want, and then call the methods and properties of the object in other development tools to complete the development work, which is very convenient. Furthermore, the Caché database supports remote mapping and mirroring. For example, between different cities, or between different regions in the same city, Caché can perform mirroring (Mapping) to synchronize Caché databases in different regions. Although they are in different regions, everyone uses it as if they share a database.
[0064] Caché database supports standard SQL statements, and database operations can be performed through standard SQL statements, such as using standard SQL statements to read and / or write databases. Caché database status indicator information can also be obtained through standard SQL statements. Specifically, Caché database status indicator information includes basic database information, database operation life cycle, shared memory heap usage, lock table memory, system interactive process, lock list, number of active sessions, database task schedule, memory heap usage, ECP application server, ECP data server, database space usage, system log information, Journal file list, etc.
[0065] The terminal 20 is a device that can run according to the program and automatically and quickly process massive data. It is usually composed of a hardware system and a software system, such as a computer, a smart phone, etc. The terminal 20 can be a terminal device with a display screen, such as a smart phone, a tablet computer, a computer or a laptop computer, etc. Figure 1 It is understood that the terminal is configured with a database management software tool capable of operating and managing the Caché database, such as a portal tool, a SqlDbx tool or a terminal tool.
[0066] In the embodiment of the present invention, the terminal acts as a requesting end. First, the terminal 20 sends a request message to the database server 10, wherein the request message is used to indicate an operation on the Caché database. The database server 10 receives the request message and generates a response message based on the request message and the Caché database. Then, it is determined whether the response message includes sensitive data. If the response message includes sensitive data, the response message is desensitized and then the desensitized response message is sent to the terminal to protect the sensitive data. After obtaining the response message, the data desensitization method first judges the response message and performs desensitization after determining that it includes sensitive data. Thus, the response message that does not include sensitive data can be directly released, reducing unnecessary desensitization work and making the desensitization efficient and accurate.
[0067] One embodiment of the present invention further provides an electronic device, see Figure 2 The electronic device 40 includes: at least one processor 41; and a memory 42 connected to the at least one processor 41 in communication. Figure 2 A processor is taken as an example.
[0068] The memory 42 stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the data desensitization method based on the Caché database in the following embodiment. The processor 41 and the memory 42 can be connected by a bus or other means. Figure 2 The example of connecting through bus is taken in the following.
[0069] The memory 42 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules of the data desensitization method in the embodiment of the present application. The processor 41 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory, that is, the data desensitization method based on the Caché database in the following method embodiment is implemented.
[0070] The memory 42 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the data desensitization device, etc. In addition, the memory 42 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 42 may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the data desensitization device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0071] It is understandable that the electronic device 40 may be the database server 10 in the above embodiment, which may execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in the present embodiment, please refer to the method provided in the following embodiment of the present application.
[0072] See also Figure 3 , an embodiment of the present invention provides a data desensitization method based on a Caché database, the method S20 comprising:
[0073] S21: Receive request information from a requesting end, where the request information is used to indicate an operation on a Caché database.
[0074] S22: Generate response information according to the request information and the Caché database.
[0075] S23: Determine whether the response information includes sensitive data, and if so, execute step S24.
[0076] S24: Desensitizing the response information.
[0077] In the embodiment of the present invention, the requesting end may be the terminal in the above embodiment, and the terminal sends request information to the database server, and the database server receives the request information. The request information is used to indicate an operation on the Caché database, for example, operations such as adding, deleting, modifying, and checking the Caché database, or operations such as establishing a connection with the database.
[0078] It can be understood that, based on the database management software tool configured by the terminal, the request information can be in the form of a message, or in the form of a data query statement. For example, when the database management software tool is a portal tool, the request information is a request message, and when the database management software tool is a SqlDbx tool or a MySql tool, the request information is a SQL statement.
[0079] It is understood that if the request information includes an identifier that can reflect the identity of the database, then the corresponding Caché database is connected according to the request information. Then, response information is generated according to the request information and the Caché database. It is understood that the response information is the data or status obtained after the Caché database is operated accordingly according to the operation on the Caché database indicated by the request information. For example, when the request information requests to query the address book of classmates in a certain class in the Caché database, after the server screens out the address book, a response information containing the address book is generated.
[0080] After obtaining the complete response information, determine whether the response information includes sensitive data, for example, determine whether the address book includes sensitive data such as ID card, address, etc. It is understandable that the sensitive data is user-defined data that needs to be desensitized to achieve confidentiality.
[0081] It can be seen that not all response information contains sensitive data. If the response information containing sensitive data is not screened and desensitization is performed directly, it will not only increase the invalid workload and affect the desensitization efficiency, but also cause erroneous desensitization due to the diversity of data in the response information. Therefore, the response information is first judged and desensitized after it is determined to contain sensitive data. Therefore, the response information that does not contain sensitive data can be directly released, reducing unnecessary desensitization work and avoiding erroneous desensitization. The response information containing sensitive data is desensitized, making the desensitization efficiency high and accurate.
[0082] In this embodiment, by receiving the request information from the request end, the request information is used to indicate the operation on the Caché database, generating response information according to the request information and the Caché database, determining whether the response information includes sensitive data, and if so, performing desensitization processing on the response information. That is, after obtaining the response information, the data desensitization method first judges the response information, and only performs desensitization processing after determining that it includes sensitive data, so that the response information that does not include sensitive data can be directly released, reducing unnecessary desensitization work, and performing desensitization processing on the response information that includes sensitive data, so that the desensitization efficiency is high and accurate.
[0083] In some embodiments, the request information is a request message based on a preset transmission protocol, and the response information includes at least one response message based on the preset transmission protocol, and the at least one response message is sorted in order of generation time. It is understandable that the preset transmission protocol can be a hypertext transfer protocol (HTTP). When the amount of data in the response information is too large, in order to facilitate transmission, the data is transmitted through multiple response messages, that is, the response information includes at least one response message, and the at least one response message is sorted in order of generation time.
[0084] See also Figure 4 , the step S23 specifically includes:
[0085] S231a: Obtain multiple characters of a first response message in the at least one response message, where the multiple characters are a preset number of characters starting from the first character of the first response message.
[0086] S232a: If the multiple characters include the first keyword, determine whether the response header of the first response message includes the second keyword.
[0087] S233a: If yes, determine whether the response information includes sensitive data
[0088] Generally, the response message starts with the transport protocol followed, that is, the first line in the response header will record the transport protocol and its version. Therefore, by obtaining multiple characters of the first response message in the at least one response message, the multiple characters are a preset number of characters starting from the first character of the first response message, and the transport protocol can be obtained. It can be understood that the preset number can be set according to the transport protocol. For example, when the transport protocol is the HTTP protocol, the preset number is 4, and the multiple characters are 4 characters starting from the first character of the first response message.
[0089] The first keyword reflects the preset transmission protocol, and the first keyword may be the name of the preset transmission protocol, for example, the first keyword may be HTTP. The second keyword is used to reflect that the response message includes sensitive data. When the response header includes keywords such as CONTENT-LENGTH and application / x-csp-hyperevent, it indicates that the response message may include sensitive data. Therefore, the second keyword may be set to keywords such as CONTENT-LENGTH and application / x-csp-hyperevent.
[0090] If the multiple characters include the first keyword, it is determined whether the response header of the first response message includes the second keyword. When the response header of the first response message includes the second keyword, it is further determined whether the response information includes sensitive data. Thus, hierarchical initial screening is performed through the first keyword and the second keyword to screen out messages that may include sensitive data, and to allow heartbeat messages, handshake messages, and other messages that do not include sensitive data to be directly released, without occupying desensitization resources, reducing unnecessary desensitization work, and thus improving efficiency.
[0091] In some embodiments, when the amount of data in the response information is too large, in order to facilitate transmission, the data is transmitted through multiple response messages, that is, the response information includes at least one response message, and the at least one response message is sorted in order of generation time. In order to obtain complete response information, please refer to Figure 5 , the method further comprises:
[0092] S25: According to the response header of the first response message, obtain the required length of all response contents corresponding to the response information.
[0093] S26: Obtain a first actual length of the response content in the first response message.
[0094] S27: If the first actual length is smaller than the expected length, an empty message is sent to the requesting end, and the first response message is stored.
[0095] S28: accepting a next response message, obtaining a second actual length of the response content in the next response message, and accumulating the second actual length with the first actual length to obtain an accumulated length.
[0096] S29: If the accumulated length is less than the expected length, an empty message is sent to the requesting end, the next response message is stored, and the process returns to execute step S28 until the accumulated length is equal to the expected length to obtain the entire response content.
[0097] Generally, the response header of the response message, for example, the CONTENT-LENGTH keyword in the response header of the first response message, is used to obtain the expected length of all response contents corresponding to the response information, that is, the total length of the response contents in all response messages. According to the order of the response messages, the first actual length of the response content in the first response message is obtained. If the first actual length is less than the expected length, in order to smoothly accept other messages corresponding to the response information, an empty message is sent to the request end, and the first response message is stored, that is, the response content in the first response message is stored. Then, the next response message is accepted, the second actual length of the response content in the next response message is obtained, and the second actual length is accumulated with the first actual length to obtain the accumulated length; if the accumulated length is less than the expected length, an empty message is sent to the request end, the next response message is stored, and the step S28 is continuously executed until the accumulated length is equal to the expected length, thereby obtaining all the response contents, that is, a complete response message, for subsequent screening and desensitization processing.
[0098] In some embodiments, see Figure 6 , the step S24 specifically includes:
[0099] S241a: Parse the entire response content to obtain the sensitive data.
[0100] S242a: Desensitizing the sensitive data according to a first preset rule.
[0101] In this embodiment, after obtaining the entire response content, the entire response content is decompressed to obtain a byte array, which is then converted into a string, and then the entire response content is parsed according to the HTML tag to obtain and identify the sensitive data. The sensitive data is desensitized according to the first preset rule. It can be understood that the first preset rule includes at least one of random, mapping, overwriting or replacement.
[0102] It is understandable that after desensitization processing according to the first preset rule, the total length of the entire response content remains unchanged. For example, if the entire response content has 60 characters, the entire response content after desensitization processing is still 60 characters.
[0103] In this embodiment, in order to facilitate the transmission of the at least one response message, the first preset rule is used for desensitization, so that the length of all response contents before and after desensitization remains unchanged, which is convenient for transmission and can also protect sensitive data from being leaked.
[0104] In some embodiments, when the database management software tool is a SqlDbx tool or a MySqI tool, the request information is a SQL statement, and the response information is the result of executing the SQL statement on the Caché database. Thus, the response information can be intercepted and desensitized.
[0105] See also Figure 7 The step S23 specifically includes
[0106] S231b: Perform syntax analysis on the SQL statement to obtain the syntax of the SQL statement.
[0107] S232b: Determine whether the syntax of the SQL statement is select syntax.
[0108] S233b: If yes, determine that the response information includes the sensitive data.
[0109] The SQL statement is parsed according to the syntax format of the SQL language, so that the syntax of the SQL statement can be obtained. For example, when querying data, the commonly used syntax format is "select......from......". Since when querying data, the database finds the data to be queried and returns it to the requesting end, the response information in this case may include sensitive data, and the syntax of the SQL statement may correspond to other operations that do not return data. For example, "create table" is to create a table and add it to the database, which does not involve sensitive data. Therefore, when it is determined that the syntax of the SQL statement is the select syntax, it is determined that the response information includes the sensitive data.
[0110] In this embodiment, by performing syntax parsing on the SQL statement and determining whether the syntax of the SQL statement is a select syntax, the request information is preliminarily screened, the select statement is screened out, and it is determined that the response information corresponding to the select statement includes sensitive data. This is beneficial to subsequent desensitization work, allowing other statements to be released directly without occupying desensitization resources, reducing unnecessary desensitization work, and thus improving efficiency.
[0111] In some embodiments, see Figure 8 Before step S22, the method further includes:
[0112] S30: If the SQL statement exists in a cache statement library, directly executing the step of generating response information according to the request information and the Caché database, the cache statement library includes a plurality of historical SQL statements.
[0113] S31: If the SQL statement does not exist in the cache statement library, determine whether the SQL statement meets a preset condition.
[0114] S32: If yes, then execute the step of generating response information according to the request information and the Caché database, and cache the SQL statement in the cache statement library.
[0115] In this embodiment, before executing the SQL statement to generate response information, the legality of the SQL statement is checked to avoid SQL injection and illegal query. First, it is determined whether the SQL statement exists in the cache statement library. If it exists in the cache statement library including multiple historical SQL statements, it means that the SQL statement has been executed before, and the step S22 can be directly executed to generate response information.
[0116] If the SQL statement does not exist in the cache statement library, it is determined whether the SQL statement meets the preset conditions, that is, whether the SQL statement meets the syntax standard. It can be understood that the preset conditions are judgment conditions established according to the SQL syntax standard. If the SQL statement meets the preset conditions, step S22 is executed, and the SQL statement is cached in the cache statement library. When the same SQL statement is encountered next time, it is not necessary to determine whether it meets the preset conditions. As long as it exists in the cache library, it can be determined that there is no risk and the statement can be executed directly.
[0117] In this embodiment, the security of the SQL statement is checked before the SQL statement is executed to avoid SQL injection and illegal query, thereby improving the operational security of the Caché database.
[0118] In some embodiments, see Fig. 9 , the step S24 specifically includes:
[0119] S241b: Parse the response information to obtain the sensitive data.
[0120] S242b: Desensitizing the sensitive data according to a second preset rule.
[0121] In this embodiment, when the SQL statement is executed, the response information is obtained, and then the response information is parsed to identify sensitive data. Specifically, in some embodiments, sensitive data can be identified by field name or keywords in the data. For example, when the field name reflects "ID number", the data under the field is determined to be sensitive data.
[0122] The sensitive data is desensitized according to a second preset rule. It is understandable that, in some embodiments, the second preset rule includes at least one of a random, mapping, overwriting, replacement or encryption algorithm. It is worth noting that the second preset rule has no restriction on the length of the data before and after desensitization, so that an encryption algorithm can be used to desensitize the sensitive data to protect the sensitive data from being leaked.
[0123] In summary, the data desensitization method based on the Caché database receives the request information from the request end, the request information is used to indicate the operation on the Caché database, generates response information according to the request information and the Caché database, determines whether the response information includes sensitive data, and if so, performs desensitization on the response information. That is, after obtaining the response information, the data desensitization method first judges the response information, and only performs desensitization after determining that it includes sensitive data, so that the response information that does not include sensitive data can be directly released, reducing unnecessary desensitization work, and performing desensitization on the response information that includes sensitive data, so that the desensitization efficiency is high and accurate.
[0124] An embodiment of the present invention also provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the data desensitization method based on the Caché database in any of the above method embodiments.
[0125] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may also be combined, the steps may be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data desensitization method based on Caché database, characterized in that: include: Receiving request information from a requesting end, wherein the request information is used to indicate an operation on a Caché database; Generate response information according to the request information and the Caché database; The request information is a request message based on a preset transmission protocol, and the response information includes at least one response message based on the preset transmission protocol, and the at least one response message is sorted in order of generation time; Obtain multiple characters of a first response message in the at least one response message, wherein the multiple characters are a preset number of characters starting from the first character of the first response message; If the plurality of characters include the first keyword, determining whether the response header of the first response message includes the second keyword; If yes, determining whether the response information includes sensitive data; The first keyword is used to reflect the preset transmission protocol, and the second keyword is used to reflect that the response message includes sensitive data; If so, the response information is desensitized.
2. The data desensitization method based on Caché database according to claim 1 is characterized in that: The method further comprises: According to the response header of the first response message, obtaining the expected length of all response contents corresponding to the response information; Obtaining a first actual length of the response content in the first response message; If the first actual length is smaller than the expected length, sending an empty message to the requesting end and storing the first response message; Accepting a next response message, obtaining a second actual length of the response content in the next response message, and accumulating the second actual length with the first actual length to obtain an accumulated length; If the accumulated length is less than the expected length, an empty message is sent to the requesting end, the next response message is stored, and the execution of accepting the next response message is returned to obtain the second actual length of the response content in the next response message, and the second actual length is accumulated with the first actual length to obtain the accumulated length step until the accumulated length is equal to the expected length to obtain the entire response content.
3. The data desensitization method based on Caché database according to claim 2 is characterized in that: The desensitizing the response information includes: Parsing all the response contents to obtain the sensitive data; The sensitive data is desensitized according to a first preset rule.
4. The data desensitization method based on Caché database according to claim 1, characterized in that: The request information is an SQL statement, and the response information is the result of executing the SQL statement on the Caché database; The determining whether the response information includes sensitive data comprises: Performing syntax analysis on the SQL statement to obtain the syntax of the SQL statement; Determine whether the syntax of the SQL statement is select syntax; If so, it is determined that the response information includes the sensitive data.
5. The data desensitization method based on Caché database according to claim 4 is characterized in that: Before the step of generating response information according to the request information and the Caché database, the method further includes: If the SQL statement exists in a cache statement library, directly executing the step of generating response information according to the request information and the Caché database, the cache statement library including a plurality of historical SQL statements; If the SQL statement does not exist in the cache statement library, determining whether the SQL statement meets a preset condition; If so, the step of generating response information according to the request information and the Caché database is performed, and the SQL statement is cached in the cache statement library.
6. The data desensitization method based on Caché database according to claim 5, characterized in that: The desensitizing the response information includes: Parsing the response information to obtain the sensitive data; The sensitive data is desensitized according to a second preset rule.
7. The data desensitization method based on Caché database according to claim 6, characterized in that: The second preset rule includes at least one of a random, mapping, covering, replacing or encryption algorithm.
8. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
9. A non-volatile computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the processor is caused to execute the method according to any one of claims 1 to 7.
