Security control method and device, computer program product and electronic equipment

By loading security plug-ins on the database server and verifying service requests using security rule files, the fine-grained and performance loss problems of database security control are solved, and more efficient security control is achieved.

CN119089500APending Publication Date: 2024-12-06XIAN TONGXING HENGYAO INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411205124.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The native permission control system of the existing database poses security risks, and it is difficult to adapt to the open source database by modifying the kernel source code, resulting in insufficient fine-grained security control and large performance losses.

Method used

By loading the database security plug-in to shared memory on the database server, and using security rule files to parse and verify service requests, it can achieve finer-grained security control, adapt to different versions of plug-ins, and reduce performance losses.

Benefits of technology

Improves the accuracy and applicability of security control, reduces performance losses, and avoids injection attacks introduced by external security control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119089500A_ABST
    Figure CN119089500A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a security control method and device, a computer program product and electronic equipment. The security control method comprises the steps that in response to occurrence of a target event, a database security plug-in is loaded to a shared memory on a server where a database is located, and the database security plug-in is configured with a security rule file; obtaining a service request, analyzing the service request, and triggering a database security plug-in according to the service request, so as to verify an analysis result of the service request through a security rule file of the database security plug-in; and controlling the service request according to the verification result. According to the method and the device, under the condition of not invading the database, the security control of the database in finer granularity can be realized, and the performance loss caused by the security control is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and more specifically, to a security control method, a security control device, a computer program product, and an electronic device. Background Art

[0002] The native permission control system of the database can control user access rights through authorization and revocation, and the granularity is at the object level. Users either have permission or do not have permission to a database object. This method can create roles that execute system commands, which poses security risks. If the kernel source code of the database is modified to implement security control, it is easy to be unable to adapt to the open source database due to the difficulty of version upgrade, and thus it is impossible to quickly iterate and adjust according to needs. When using security control agent software to protect the database, it often requires the loss of database performance. Failure of the security control agent software will result in the inability to access the database and other consequences. Therefore, it is urgent to provide a method that can achieve more fine-grained security control of the database without invading the database to reduce performance loss.

[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0004] The purpose of the present disclosure is to provide a security control method and device, a computer program product and an electronic device, thereby achieving security control of a database at a finer granularity without invading the database, thereby avoiding performance loss caused by security control.

[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0006] According to one aspect of the present disclosure, there is provided a security control method, comprising: in response to the occurrence of a target event, loading a database security plug-in into a shared memory on a server where a database is located, the database security plug-in being configured with a security rule file; obtaining a service request, parsing the service request, and triggering the database security plug-in according to the service request to verify the parsed result of the service request through the security rule file of the database security plug-in; and controlling the service request according to the verification result.

[0007] In an exemplary embodiment of the present disclosure, in response to the occurrence of a target event, a database security plug-in is loaded into a shared memory on a server where a database is located, including: when starting a database or establishing a database connection, according to a configuration path of the database security plug-in in a database configuration file, loading the database security plug-in into the shared memory; wherein the database security plug-in is pre-configured on the server where the database is located.

[0008] In an exemplary embodiment of the present disclosure, the security rule file includes a built-in rule file of a database security plug-in; loading the database security plug-in into a shared memory on a server where the database is located includes: loading the built-in rule file of the database security plug-in into the shared memory.

[0009] In an exemplary embodiment of the present disclosure, the method further includes: detecting whether there is a configurable external rule file in the database security plug-in; if there is an external rule file, loading the external rule file into the shared memory according to the configuration path of the external rule file.

[0010] In an exemplary embodiment of the present disclosure, the method further includes: updating the external rule file in response to a configuration operation on the external rule file; and configuring the updated external rule file in the database security plug-in.

[0011] In an exemplary embodiment of the present disclosure, the service request is parsed, and the database security plug-in is triggered according to the service request to verify the parsing result of the service request through the security rule file of the database security plug-in, including: verifying the grammatical validity of the service request through a parser; if the syntax of the service request is valid, parsing the service request and generating a parsing tree according to the parsing result; and performing a security check on the parsing tree using the security rule file of the database security plug-in.

[0012] In an exemplary embodiment of the present disclosure, the step of loading the database security plug-in into the shared memory on the server where the database is located further includes: performing a security check on the database security plug-in; if the database security plug-in passes the security check, loading the database security plug-in into the shared memory on the server where the database is located.

[0013] In an exemplary embodiment of the present disclosure, if the database security plug-in fails the security check, a backup configuration file of the database security plug-in is obtained from a server; and according to the backup configuration file, the database security plug-in is loaded into the shared memory.

[0014] According to one aspect of the present disclosure, there is provided a security control device, comprising: a loading module, for responding to the occurrence of a target event, loading a database security plug-in into a shared memory on a server where a database is located, the database security plug-in being configured with a security rule file; a security verification module, for obtaining a service request, parsing the service request, and triggering the database security plug-in according to the service request, so as to verify the parsing result of the service request through the security rule file of the database security plug-in; and a control module, for controlling the service request according to the verification result.

[0015] According to one aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, any one of the methods described above is implemented.

[0016] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned methods by executing the executable instructions.

[0017] The security control method in the exemplary embodiment of the present disclosure responds to the occurrence of the target event, loads the database security plug-in into the shared memory on the server where the database is located, obtains the service request, parses the service request, and triggers the database security plug-in according to the service request, so as to verify the parsing result of the service request through the security rule file of the database security plug-in, so as to control the service request according to the verification result. On the one hand, compared with the native permission control system in the database, by loading the database security plug-in into the shared memory to verify the parsing result of the service request, the service request can be security-verified at a finer granularity, not limited to the object level, and the accuracy of security control can be improved. On the other hand, by verifying the parsing result of the service request in a plug-in manner, the intrusion to the open source code is small, and different versions of plug-ins can be adapted, and it can be used in combination with the native control system, and it has high applicability. On the other hand, by configuring the security rule file of the database security plug-in, it does not rely on external applications or services to parse or audit the service request, reducing the performance loss caused by security control, and avoiding the introduction of injection attacks by external security control.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the following detailed description with reference to the accompanying drawings, in which several embodiments of the present disclosure are shown in an exemplary and non-limiting manner.

[0020] Figure 1 A system architecture diagram according to an exemplary embodiment of the present disclosure is shown.

[0021] Figure 2 A flow chart of a safety control method according to an exemplary embodiment of the present disclosure is shown.

[0022] Figure 3 A flow chart of an implementation method for loading an external rule file according to an exemplary embodiment of the present disclosure is shown.

[0023] Figure 4 A flowchart of an implementation method for updating a security configuration file of a database security plug-in according to an exemplary embodiment of the present disclosure is shown.

[0024] Figure 5 A flowchart of an implementation method for verifying a parsing result of a service request according to an exemplary embodiment of the present disclosure is shown.

[0025] Figure 6 A flowchart of an implementation method for verifying a database security plug-in according to an exemplary embodiment of the present disclosure is shown.

[0026] Figure 7 Another system architecture diagram according to an exemplary embodiment of the present disclosure is shown.

[0027] Figure 8 A complete flow chart of a safety control method according to an exemplary embodiment of the present disclosure is shown.

[0028] Fig. 9 A schematic diagram of the composition of a safety control device according to an exemplary embodiment of the present disclosure is shown.

[0029] Fig.10 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown.

[0030] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION

[0031] The exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present disclosure will be more comprehensive and complete and the concepts of the exemplary embodiments will be fully conveyed to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their detailed description will be omitted.

[0032] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known structures, methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.

[0033] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or these functional entities or parts of functional entities may be implemented in one or more software hardened modules, or these functional entities may be implemented in different networks and / or processor devices and / or microcontroller devices.

[0034] The current database security control method has the following defects: The native permission control system of the database can control user access rights through authorization and revocation, and the granularity is at the object level. Users either have permission or no permission for a database object. This method can create roles that execute system commands, which poses security risks. If the kernel source code of the database is modified to implement security control, it is easy to fail to adapt to the open source database due to the difficulty of version upgrade, and thus cannot be quickly iterated and adjusted according to needs. When using security control agent software to protect the database, it often requires the loss of database performance. Failure of the security control agent software will result in consequences such as inaccessibility of the database.

[0035] Figure 1 A system architecture diagram of an exemplary embodiment of the present disclosure is shown. Figure 1 , the database security plug-in and the external configuration file (if any) can be stored in the server where the database is located, so that when the target event occurs, the database security plug-in is loaded into the shared memory where the database is located.

[0036] Among them, database security plug-ins are tools or applications used to maintain database security, such as Figure 1 The database security plug-in of the exemplary embodiment of the present disclosure interacts with the parser, and the database parser parses the service request (such as SQL (Structured Query Language) statement) and transmits the parsing result to the database security plug-in, so that the database security plug-in verifies the parsing result. Compared with the object-level verification methods such as password verification or identity verification in the database connection and query process, this process performs security verification at a finer granularity from the parsing result of the service request.

[0037] refer to Figure 2 FIG. 1 is a flow chart of a safety control method according to an exemplary embodiment of the present disclosure. Figure 2 As shown, the safety control method includes steps S210 to S230, which are specifically as follows:

[0038] In step S210, in response to the occurrence of the target event, the database security plug-in is loaded into the shared memory on the server where the database is located.

[0039] In the exemplary embodiments of the present disclosure, the target event refers to an event that can trigger the loading of a database security plug-in, which can be a database startup or the establishment of a database connection. Among them, loading the database security plug-in to the shared memory of the server where the database is located when the database is started is a global security control, that is, the database security plug-in loaded in this way will perform security checks on global service requests. Loading the database security plug-in to the shared memory when establishing a database connection is a local security control.

[0040] As an example, taking the PostgreSQL database as an example, each client process is connected to a backend process. Therefore, when a database connection is established between the client and the database, the database security plug-in is loaded into the shared memory. In this way, the database security plug-in is only effective for data storage between the client and the database.

[0041] It should be understood that the exemplary embodiments of the present disclosure may determine the type of the target event according to actual needs, and are not limited thereto.

[0042] The database security plug-in is configured with a security rule file. The security rule file refers to a rule file used to perform security verification on service requests when the database security plug-in is triggered, including specific rule content. For example, rules determined by SQL type, function name, conditional token, etc. For example, the security rule file can be used to prohibit users from executing system commands, prohibit users from reading server files, prohibit the execution of delete statements without "where conditions", etc. The exemplary embodiment of the present disclosure can configure the security rule file according to actual needs to implement more fine-grained verification content for service requests.

[0043] It should also be understood that verifying service requests through security rule files can achieve interception of service requests or control of permissions. That is, service requests can be rejected based on the verification results, or some or all permissions involved in the service requests can be restricted. Both can be flexibly set according to actual needs.

[0044] In step S220, a service request is obtained, the service request is parsed, and a database security plug-in is triggered according to the service request to verify the parsing result of the service request through a security rule file of the database security plug-in.

[0045] In an exemplary embodiment of the present disclosure, a service request may be for data acquisition, data storage or data deletion, etc. Parsing the service request is to decompose the input service request (such as an SQL statement) into grammatical units, and convert these grammatical units into internally represented data structures, and finally generate an executable query plan, so that the service request can be fine-grainedly verified through the security rule file of the database security plug-in.

[0046] In an optional embodiment, the database security plug-in can be implemented in the form of a Hook function. When the Hook is enabled, the corresponding Hook function will be called when a specific event arrives. The mechanism of the Hook function is to hang it into the system through a system call so that it can be pre-started during the normal operation of the program, and the information transmitted to the program can be checked and modified. Whenever a specific message is sent, before it reaches the destination window, the Hook function will first capture the message, that is, the Hook function first obtains control. At this time, the Hook function can process (change) the message, or continue to transmit the message without processing, or force the message to end. The exemplary embodiment of the present disclosure implements the database security plug-in through the Hook function, compiles the database security plug-in into a binary file and configures it on the server where the database is located, so that after obtaining and parsing the service request, before continuing to pass it to the destination window (such as the database planner, executor), the parsing result is security checked to intercept or control the service request, etc.

[0047] In step S230, the service request is controlled according to the verification result.

[0048] In an exemplary embodiment of the present disclosure, it is determined whether to continue to pass the parsing result to perform partial / full execution or to return an error prompt message according to the verification result of the parsing result of the service request.

[0049] The security control method in the exemplary embodiment of the present disclosure, on the one hand, can verify the parsing results of service requests at a finer granularity, not limited to the object level, and improve the accuracy of security control, compared to the native permission control system in the database, by loading the database security plug-in into the shared memory to verify the parsing results of the service request, and on the other hand, the parsing results of the service request are verified by means of a plug-in, which has little intrusion on the open source code, can be adapted to plug-ins of different versions, can be used in combination with the native control system, and has high applicability. On the other hand, by configuring the security rule file of the database security plug-in, it does not rely on external applications or services to parse or audit service requests, which reduces the performance loss caused by security control and can avoid injection attacks introduced by external security control.

[0050] In an exemplary embodiment, in response to the occurrence of a target event, loading a database security plug-in into a shared memory on a server where the database is located includes:

[0051] When starting a database or establishing a database connection, the database security plug-in is loaded into the shared memory according to the configuration path of the database security plug-in in the database configuration file; wherein the database security plug-in is pre-configured on the server where the database is located.

[0052] Among them, the database security plug-in is loaded through database configuration. Specifically, the configuration file name of the database security plug-in can be configured on the dependency path of the database configuration file, so that the corresponding configuration file can be loaded when the database security plug-in is triggered according to the dependency path.

[0053] Taking PostgreSQL database as an example, the name of the database security plug-in configuration file "security" can be configured in the "postgresql.conf" file. For example, if you need to load the database security plug-in when starting the database, configure "shared_preload_libraries = 'security'", and if you need to load the database security plug-in when establishing a database connection, configure "local_preload_libraries = 'security'". Of course, this requires configuring the configuration file name of the database security plug-in on the dependent path of the database configuration file according to the specific situation of the database type and its corresponding database configuration file.

[0054] In some optional embodiments, when establishing a database connection, the service request type can be further determined based on the service request, thereby determining whether the client to be connected to the database needs to load a database security plug-in based on the service request type, thereby making the security control of the database more targeted and flexible.

[0055] As an example, when client A establishes a connection with a database, if it is determined according to the database configuration file that the client type to which client A belongs needs to load a database security plug-in, then the database security plug-in is loaded into the shared memory according to the configuration path of the database configuration file to perform security verification on the service request of client A during the data interaction process with the database. On the contrary, if it is determined according to the database configuration file that the client type to which client B belongs does not need to load a database security plug-in, then the data result of the service request can be transmitted normally.

[0056] In an exemplary embodiment, the security rule file configured by the database security plug-in includes the built-in rule file of the database security plug-in, that is, the inherent rules of the database security plug-in, which is a mandatory option, and any service request must be security checked according to the built-in rule file.

[0057] Based on this, loading the database security plug-in into the shared memory on the server where the database is located includes: loading the built-in rule file of the database security plug-in into the shared memory.

[0058] Specifically, no matter the type of the target event is starting a database or establishing a database connection, the built-in rule file is loaded into the shared memory. By loading the required built-in rule file into the shared memory, basic security protection for the service request can be guaranteed.

[0059] The built-in rule file may be configured according to the database type or the service request type of the database, etc., and no specific restrictions are imposed on this.

[0060] In an exemplary embodiment, considering the flexible adjustment of the database security plug-in, a method for loading an external rule file is also provided. Figure 3 As shown, the implementation may include:

[0061] Step S310: Detect whether there is a configurable external rule file in the database security plug-in.

[0062] Step S320: If an external rule file exists, the external rule file is loaded into the shared memory according to the configuration path of the external rule file.

[0063] In addition to the built-in rule file of the required database security plug-in, it is also possible to detect whether the database security plug-in has a configurable external rule file. Optionally, the verification method of the external rule file can adopt a blacklist method, such as prohibiting users from executing the system cat command "COPY cmd_exec FROM PROGRAM'cat';" command, thereby preventing the viewing of sensitive files on the server by configuring an external rule file. Of course, the verification method of the external rule file can also be selected according to information such as the database type, and the exemplary embodiments of the present disclosure do not make specific restrictions on this.

[0064] When checking whether there is a configurable external rule file in the database security plug-in, it can detect whether there is a configuration path of the external rule file, such as "serurity.rule_path = 'rule.txt'". If it exists, the external rule file can be loaded into the shared memory according to the configuration path. Otherwise, the parsing result of the service request is security checked through the built-in rule file.

[0065] Since the external rule file is configurable, the file content can be adjusted at any time according to actual needs, and the verification content of the database security plug-in can be quickly customized and iterated.

[0066] Specifically, Figure 4 A flowchart of an implementation method for updating a security configuration file of a database security plug-in is shown, and the implementation method may include:

[0067] Step S410: in response to the configuration operation on the external rule file, the external rule file is updated.

[0068] Step S420: configuring the updated external rule file in the database security plug-in.

[0069] Among them, users can modify, add or delete external rule files according to actual needs to obtain updated external rule files. This configuration operation does not require external applications or services to parse or review the request statements of service requests. By configuring the updated external rule file in the database security plug-in, that is, configuring the configuration path of the external rule file, when the database security component is triggered, the updated external rule file is loaded into the shared memory according to the configuration path, thereby reducing the performance loss caused by security control, avoiding the injection risk introduced by external security control in related technologies, and having high security.

[0070] In some optional embodiments, when a database security plug-in is loaded when the database is started, after the updated external rule file is configured in the database security plug-in, the database needs to be restarted to make the updated external rule file take effect.

[0071] In some optional embodiments, when a database security plug-in is loaded when establishing a database connection, after the updated external rule file is configured in the database security plug-in, the updated external rule file can be made effective by resetting the session, which has high flexibility in rule configuration and reduces system performance consumption.

[0072] In an exemplary embodiment, a method for verifying the parsing result of a service request is provided. Figure 5 As shown, the service request is parsed, and the database security plug-in is triggered according to the service request to verify the parsing result of the service request through the security rule file of the database security plug-in, including:

[0073] Step S510: Verify the grammatical validity of the service request through the parser.

[0074] The parser verifies the grammatical validity of the service request and can check whether the grammatical structure of the service request statement, the spelling and usage of keywords are correct, and can obtain potential errors for correction to ensure that the service request is grammatically correct. The exemplary embodiments of the present disclosure do not limit the specific method of grammar verification.

[0075] Step S520: If the syntax of the service request is valid, the service request is parsed, and a parsing tree is generated according to the parsing result.

[0076] If the syntax of the service request is valid, the service request can be parsed by the parser, which is the process of syntax analysis. Parsing the service request can convert the lexical symbol table into an abstract parse tree. In this process, the parser will parse each lexical symbol one by one according to the grammar specification (such as the SQL grammar specification) to build a hierarchical parse tree.

[0077] Step S530: Use the security rule file of the database security plug-in to perform security verification on the parse tree.

[0078] After obtaining the parsing tree and loading the database security plug-in into the shared memory, the parsing tree can be security-checked using the security rule file, where the security rule file can be a built-in rule file and / or an external rule file, and the corresponding rule file is loaded according to the actual situation.

[0079] The security rule file may include verification content controlled by SQL type, function name, conditional token, etc. For example, prohibiting the user from executing system commands, prohibiting the user from reading server files, prohibiting the execution of delete statements without "where conditions", etc., and there is no specific limitation on the verification content.

[0080] Among them, when the parse tree passes the security check, the corresponding service request can be executed and the result can be returned. Otherwise, an error message can be returned to intercept the service request or control some or all permissions. Compared with the native permission control system of the database, which performs security control at the object level, the exemplary embodiment of the present disclosure provides more fine-grained security control.

[0081] In an exemplary embodiment, considering that the use of a database security plug-in has little intrusion on the open source code and also avoids the security threats introduced by loading the database security plug-in, a method for implementing the verification of the database security plug-in is also provided. Figure 6 As shown, the database security plug-in is loaded into the shared memory on the server where the database is located, and also includes:

[0082] Step S610: Perform security verification on the database security plug-in.

[0083] Step S620: If the database security plug-in passes the security check, the database security plug-in is loaded into the shared memory on the server where the database is located.

[0084] Among them, the security check of the database security plug-in is to verify whether the database security plug-in itself has been modified. For example, it can be verified whether the version of the database security plug-in in the configuration path of the database configuration file is consistent with the plug-in version number corresponding to the server. As an example, when the database security plug-in is modified, its corresponding plug-in version number changes and is different from the plug-in version stored in the server. Therefore, the plug-in version number can be obtained from the server and matched with the version of the database security plug-in. If they do not match, it indicates that the database security plug-in has been modified.

[0085] Specifically, a verification request message can be sent to the server to request the plug-in version number, the verification request message can be encrypted by the server-side public key, and the verification response message of the server can be obtained, and the verification response message can be decrypted by the database-side private key to obtain the request result, which at least includes the plug-in version number, so as to verify the version of the database security plug-in by using the plug-in version number. Among them, a version number table of the database security plug-in can be maintained in the server, and the version number table can be updated according to the normal update of the database security plug-in.

[0086] By performing a security check on the database security plug-in before loading it into shared memory, the security and accuracy of the database security plug-in can be ensured before verifying the service request, further ensuring the effectiveness of the security check on the service request, thereby achieving double protection.

[0087] Based on the aforementioned exemplary embodiment, if the database security plug-in fails the security check, a backup configuration file of the database security plug-in is obtained from the server, and the database security plug-in is loaded into the shared memory according to the backup configuration file.

[0088] The request result returned by the server may also include the link address of the backup configuration file, so that the backup configuration file of the database security plug-in is obtained according to the link address, and the database security plug-in is loaded into the shared memory according to the backup configuration file. When the version number table of the database security plug-in is maintained in the server, the link address of the backup configuration file may also be maintained in the version number table at the same time.

[0089] After the database security plug-in is modified, the correct database security plug-in can be loaded into the shared memory through the backup configuration file to ensure the accuracy of subsequent verification of service requests.

[0090] Figure 7 Another system architecture diagram of an exemplary embodiment of the present disclosure is shown, in which a database security plug-in and an external configuration file (if any) can be stored in a server where a database is located, so that when a target event occurs, the database security plug-in can be loaded into a shared memory where the database is located. Figure 8 A complete flow chart of a safety control method of an exemplary embodiment of the present disclosure is shown below. Figure 7 and Figure 8 , taking the example of loading a database security plug-in into a shared memory on a server where a database is located when establishing a database connection, the security control method of an exemplary embodiment of the present disclosure is described.

[0091] Step S810: The client requests to establish a database connection with the database.

[0092] In response to establishing a database connection, a database security plug-in is loaded into a shared memory on a server where the database is located, wherein a built-in rule file of the database security plug-in is loaded into the shared memory.

[0093] The database security plug-in can be subjected to security verification. If the database security plug-in passes the security verification, the database security plug-in is loaded into the shared memory on the server where the database is located. If the database security plug-in fails the security verification, a backup configuration file of the database security plug-in is obtained from the server, and the database security plug-in is loaded into the shared memory according to the backup configuration file.

[0094] Step S820: Detect whether there is a configurable external rule file in the database security plug-in.

[0095] If there is an external rule file, the external rule file is loaded into the shared memory according to the configuration path of the external rule file, otherwise, the process goes to step S830.

[0096] Step S830: Verify the grammatical validity of the service request through the parser.

[0097] If the syntax of the service request is valid, go to step S840, otherwise return an error prompt message.

[0098] Step S840: Parse the service request and generate a parsing tree according to the parsing result.

[0099] Step S850: Use the security rule file of the database security plug-in to perform security verification on the parse tree.

[0100] Among them, Figure 7 The database security plug-in interacts with the parser, the database parser parses the service request, and transmits the parsing result to the database security plug-in, so that the parsing result is verified by the database security plug-in. When the parsing result passes the verification, it is sent to the subsequent components (such as the planner and executor) to execute the service request, otherwise an error message is returned.

[0101] It should be noted that the specific contents of step S810 to step S850 have been recorded in the above exemplary embodiments and will not be repeated here.

[0102] The security control method in the exemplary embodiment of the present disclosure responds to the occurrence of the target event, loads the database security plug-in into the shared memory on the server where the database is located, obtains the service request, parses the service request, and triggers the database security plug-in according to the service request, so as to verify the parsing result of the service request through the security rule file of the database security plug-in, so as to control the service request according to the verification result. On the one hand, compared with the native authority control system in the database, by loading the database security plug-in into the shared memory, the parsing result of the service request is verified, and the service request can be security-verified at a finer granularity, so as to intercept or restrict the authority of the service request without being limited to the object level, thereby improving the accuracy of security control. On the other hand, by verifying the parsing result of the service request in a plug-in manner, the intrusion to the open source code is small, and plug-ins of different versions can be adapted, and it can be used in combination with the native control system, and has high applicability. On the other hand, by configuring the security rule file of the database security plug-in, it does not rely on external applications or services to parse or audit the service request, thereby reducing the performance loss caused by security control and avoiding the introduction of injection attacks by external security control.

[0103] In an exemplary embodiment of the present disclosure, a safety control device is also provided. Fig. 9As shown, the safety control device 900 may include a loading module 910, a safety verification module 920 and a control module 930. Specifically:

[0104] A loading module 910 is used to respond to the occurrence of a target event and load a database security plug-in into the shared memory on the server where the database is located, wherein the database security plug-in is configured with a security rule file; a security verification module 920 is used to obtain a service request, parse the service request, and trigger the database security plug-in according to the service request to verify the parsing result of the service request through the security rule file of the database security plug-in; and a control module 930 is used to control the service request according to the verification result.

[0105] In an exemplary embodiment of the present disclosure, the loading module 910 is configured to execute: when starting a database or establishing a database connection, loading the database security plug-in into the shared memory according to the configuration path of the database security plug-in in the database configuration file; wherein the database security plug-in is pre-configured on the server where the database is located.

[0106] In an exemplary embodiment of the present disclosure, the security rule file includes a built-in rule file of a database security plug-in; the loading module 910 is configured to execute: loading the built-in rule file of the database security plug-in into the shared memory.

[0107] In an exemplary embodiment of the present disclosure, the loading module 910 is also configured to execute: detecting whether there is a configurable external rule file in the database security plug-in; if there is an external rule file, loading the external rule file into the shared memory according to the configuration path of the external rule file.

[0108] In an exemplary embodiment of the present disclosure, the loading module 910 is further configured to execute: in response to a configuration operation on the external rule file, updating the external rule file;

[0109] The updated external rule file is configured in the database security plug-in.

[0110] In an exemplary embodiment of the present disclosure, the security verification module 920 is also configured to execute: verifying the grammatical validity of the service request through a parser; if the syntax of the service request is valid, parsing the service request and generating a parsing tree based on the parsing result; and performing a security check on the parsing tree using the security rule file of the database security plug-in.

[0111] In an exemplary embodiment of the present disclosure, the loading module 910 is further configured to execute: performing a security check on the database security plug-in; if the database security plug-in passes the security check, loading the database security plug-in into a shared memory on the server where the database is located.

[0112] In an exemplary embodiment of the present disclosure, the loading module 910 is further configured to execute: if the database security plug-in fails the security check, obtaining a backup configuration file of the database security plug-in from the server; and loading the database security plug-in into the shared memory according to the backup configuration file.

[0113] Since the details of the various functional modules of the safety control device of the exemplary embodiment of the present disclosure have been described in the exemplary embodiment of the above-mentioned safety control method, they will not be repeated here.

[0114] It should be noted that, although several modules or units of the safety control device are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0115] The exemplary embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the above-mentioned security control method is implemented.

[0116] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.

[0117] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.

[0118] The code of the computer program can be written in one or more programming languages. Programming languages ​​such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).

[0119] The computer program may be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. The electronic device may convert the signal carrying the computer program into a digital signal, thereby running the computer program. When the computer program is run on an electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device may execute) the method steps of various exemplary embodiments of the present disclosure, such as the above-mentioned security control method.

[0120] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided. It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as a system, method, or program product. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects, which may be collectively referred to herein as a "circuit", "module", or "system".

[0121] Refer to the following Fig.10 hereinafter describes the electronic device 1000 according to such an embodiment of the present disclosure. Fig.10 The electronic device 1000 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0122] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.

[0123] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 executes the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.

[0124] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 1021 and / or a cache memory unit 1022 , and may further include a read-only memory unit (ROM) 1023 .

[0125] The storage unit 1020 may also include a program / utility 1024 having a set (at least one) of program modules 1025, such program modules 1025 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0126] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0127] The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or may communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0128] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.

[0129] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0130] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

Claims

1. A safety control method, characterized in that: include: In response to the occurrence of a target event, a database security plug-in is loaded into a shared memory on a server where the database is located, wherein the database security plug-in is configured with a security rule file; Obtaining a service request, parsing the service request, and triggering the database security plug-in according to the service request to verify the parsing result of the service request through a security rule file of the database security plug-in; The service request is controlled according to the verification result.

2. The method according to claim 1, characterized in that: The step of responding to the occurrence of the target event and loading the database security plug-in into the shared memory on the server where the database is located includes: When starting a database or establishing a database connection, loading the database security plug-in into the shared memory according to the configuration path of the database security plug-in in the database configuration file; The database security plug-in is pre-configured on the server where the database is located.

3. The method according to claim 1, characterized in that The security rule file includes a built-in rule file of the database security plug-in; The step of loading the database security plug-in into the shared memory on the server where the database is located includes: The built-in rule file of the database security plug-in is loaded into the shared memory.

4. The method according to claim 3, characterized in that The method further comprises: Detecting whether the database security plug-in has a configurable external rule file; If an external rule file exists, the external rule file is loaded into the shared memory according to the configuration path of the external rule file.

5. The method according to claim 4, characterized in that The method further comprises: In response to a configuration operation on the external rule file, updating the external rule file; The updated external rule file is configured in the database security plug-in.

6. The method according to claim 1, characterized in that The parsing of the service request and triggering the database security plug-in according to the service request to verify the parsing result of the service request through the security rule file of the database security plug-in include: Verifying the grammatical validity of the service request through a parser; If the syntax of the service request is valid, the service request is parsed, and a parse tree is generated according to the parsing result; The security rule file of the database security plug-in is used to perform security verification on the parse tree.

7. The method according to any one of claims 1 to 6, characterized in that The step of loading the database security plug-in into the shared memory on the server where the database is located also includes: Performing security verification on the database security plug-in; If the database security plug-in passes the security check, the database security plug-in is loaded into the shared memory on the server where the database is located.

8. The method according to claim 7, characterized in that If the database security plug-in fails the security check, obtaining a backup configuration file of the database security plug-in from the server; According to the backup configuration file, the database security plug-in is loaded into the shared memory.

9. A safety control device, characterized in that: The device comprises: A loading module, used for responding to the occurrence of a target event, loading a database security plug-in into a shared memory on a server where the database is located, wherein the database security plug-in is configured with a security rule file; A security verification module, used to obtain a service request, parse the service request, and trigger the database security plug-in according to the service request to verify the parsing result of the service request through the security rule file of the database security plug-in; A control module is used to control the service request according to the verification result.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

11. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 8 by executing the executable instructions.