A request processing method, a request processing device and a computer readable storage medium

By determining and verifying the request processing path of the web application in the data table, the problem of insufficient protection efficiency and accuracy of the security protection mechanism in the prior art is solved, and a more efficient request verification and protection effect is achieved.

CN112464225BActive Publication Date: 2024-11-01DIGITAL FINANCE CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202011200014.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-30
Publication Date
2024-11-01
Estimated Expiration
2040-10-30

AI Technical Summary

Technical Problem

The security protection mechanism of existing web applications is insufficient in terms of protection efficiency and accuracy, and it is prone to errors and legal requests intercepting, and security vulnerabilities that are not included cannot be effectively intercepted.

Method used

By determining the preset request processing path of the target access request in the data table, and monitoring the actual request processing path according to the pre-injected security protection mechanism, the target access request is verified to improve the accuracy and protection efficiency of the verification results.

Benefits of technology

It effectively improves the accuracy and protection accuracy of request verification results, improves the protection efficiency of applications, avoids the occurrence of overprivileged vulnerabilities, and ensures the security and reliability of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112464225B_ABST
    Figure CN112464225B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a request processing method, a request processing device and a computer-readable storage medium, the request processing method comprising: when receiving a target access request to an application, determining a preset request processing path corresponding to the target access request in a data table, the data table including a preset request processing path corresponding to each access request in at least one access request of the application; obtaining the actual request processing path for the target access request according to a security protection mechanism, the security protection mechanism is pre-injected into the source code of the application; verifying the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request to obtain a verification result; determining a response strategy for the target access request according to the verification result. By adopting the embodiment of the present application, the accuracy of the request verification result and the efficiency of the request verification can be improved, thereby improving the accuracy and efficiency of protection of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a request processing method, a request processing device, and a computer-readable storage medium. Background Art

[0002] With the rapid development of Internet technology, web applications have emerged. Due to the characteristics of simple deployment, good interactivity, and support for cross-platform operations, web applications have been increasingly widely used. But at the same time, web applications are also subject to more and more security threats.

[0003] At present, web applications generally use hardware protection devices, software protection systems, etc. for protection. For example, web applications use WAF (Web Application Firewall) to match and filter legitimate or illegal requests received by web applications. In the security protection process, hardware protection devices and software protection systems and other security protection mechanisms are prone to erroneous interception, resulting in legitimate requests being intercepted; in addition, hardware protection devices and software protection systems only implement the interception and protection of new security vulnerabilities by updating the rule base, and security vulnerabilities not included in the rule base will not be intercepted and protected; therefore, hardware devices and software systems and other security protection mechanisms have deficiencies in terms of protection efficiency and accuracy. Summary of the invention

[0004] The embodiments of the present application provide a request processing method, a request processing device, and a computer-readable storage medium, which can improve the accuracy of request verification results and the efficiency of request verification, thereby improving the accuracy and efficiency of protection of application programs.

[0005] In a first aspect, an embodiment of the present application provides a request processing method, the request processing method comprising:

[0006] When receiving a target access request for an application, determining a preset request processing path corresponding to the target access request in a data table, the data table including a preset request processing path corresponding to each access request of at least one access request of the application;

[0007] Obtain the actual request processing path for the target access request based on the security protection mechanism, which is pre-injected into the source code of the application;

[0008] Verify the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request to obtain a verification result;

[0009] Determine the response strategy for the target access request based on the verification result.

[0010] In a second aspect, an embodiment of the present application provides a request processing device, the request processing device comprising:

[0011] a determination unit, configured to determine, when receiving a target access request for an application, a preset request processing path corresponding to the target access request in a data table, wherein the data table includes a preset request processing path corresponding to each access request of at least one access request of the application;

[0012] An acquisition unit, used for acquiring an actual request processing path for a target access request according to a security protection mechanism, wherein the security protection mechanism is pre-injected into a source code of the application;

[0013] A verification unit, configured to verify the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request, and obtain a verification result;

[0014] The determination unit is further used to determine a response strategy to the target access request according to the verification result.

[0015] In a third aspect, an embodiment of the present application provides a request processing device, the request processing device comprising:

[0016] a processor adapted to implement a computer program; and,

[0017] The memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned request processing method.

[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is read and executed by a processor of a computer device, the computer device executes the above-mentioned request processing method.

[0019] In an embodiment of the present application, when a target access request to an application is received, a preset request processing path corresponding to the target access request can be determined in a data table, and the actual request processing path of the target access request can be monitored according to a security protection mechanism pre-injected into the source code of the application. By verifying the target access request through the actual request processing path and the preset request processing path corresponding to the target access request, the accuracy of the request verification result can be effectively improved, thereby effectively improving the accuracy of protection of the application. In addition, the data table stores a preset request processing path corresponding to each access request of at least one access request of the application. When a target access request to the application is received, the preset request processing path corresponding to the target access request can be quickly determined in the data table, which improves the request verification efficiency to a certain extent, thereby improving the protection efficiency of the application. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 It is a schematic diagram of the architecture of a request processing system provided in an embodiment of the present application;

[0022] Figure 2 It is a flowchart of a request processing method provided in an embodiment of the present application;

[0023] Figure 3 It is a flowchart of another request processing method provided in an embodiment of the present application;

[0024] Figure 4 It is a schematic diagram of a security protection mechanism injection result provided in an embodiment of the present application;

[0025] Figure 5 It is a schematic diagram of the correspondence between a target access request and a data processing path provided in an embodiment of the present application;

[0026] Figure 6 is a structural diagram of a request processing device provided in an embodiment of the present application;

[0027] Figure 7 It is a structural diagram of a request processing device provided in an embodiment of the present application.

[0028] Specific implementation

[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0030] See also Figure 1 , Figure 11 is a schematic diagram of the architecture of a request processing system provided in an embodiment of the present application, and the request processing system 10 includes a terminal 101 and a server 102. Among them, the terminal 101 can be a mobile terminal, a personal computer (Personal Computer, PC) terminal or a portable computer (Tablet Personal Computer, Tablet PC) terminal, etc., which is not limited in the embodiment of the present application. The server 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services, which is not limited in the embodiment of the present application. The terminal 101 and the server 102 can be directly or indirectly connected by wired communication or wireless communication, which is not limited in the present application.

[0031] In the request processing system 10 composed of a terminal 101 and a server 102, when a target access request for an application is received from the terminal 101, the server 102 can determine the preset request processing path corresponding to the target access request in the data table, and obtain the actual request processing path for the target access request based on the security protection mechanism pre-injected into the source code of the application. The server 102 can verify the target access request based on the actual request processing path and the preset request processing path corresponding to the target access request, obtain the verification result, and determine the response strategy for the target access request based on the verification result.

[0032] Among them, the application mentioned in the embodiment of the present application may refer to a web (World Wide Web) application. A web application is an application that can be accessed through the web. The biggest advantage of a web application is that users who use the web application can easily access the application. The terminal 101 used by the user only needs to have a browser installed, and no other software needs to be installed.

[0033] The data table may include a preset request processing path corresponding to each access request of at least one access request of the application. The at least one access request may refer to all types of access requests that the application may receive, and the at least one access request may also refer to some types of access requests that the application may receive, for example, the at least one access request may include a user login request, a user query request, a user update request, etc.

[0034] Each preset request processing path includes a request processing method at the path start point, at least one data processing method between the path start point and the path end point, a return data method at the path end point, and a calling sequence between at least one data processing method. The actual request processing path may include a first actual request processing method at the path start point, at least one first actual data processing method between the path start point and the path end point, a first actual return data method at the path end point, and a calling sequence between at least one first actual data processing method.

[0035] In one implementation, the target access request does not carry data that needs to be verified, and the server 102 can verify the target access request by determining whether the actual request processing path is the same as the preset request processing path corresponding to the target access request. When the actual request processing path is the same as the preset request processing path corresponding to the target access request, the server 102 generates a verification result indicating that the verification of the target access request is successful. When the actual request processing path is different from the preset request processing path corresponding to the target access request, the server 102 generates a verification result indicating that the verification of the target access request has failed. When the verification result is that the verification of the target access request is successful, the target access request is responded to; when the verification result is that the verification of the target access request has failed, the target access request is refused to be responded to, and an alarm page is output to the terminal 101, and the alarm page is used to prompt that the target access request is blocked.

[0036] For example, the target access request is a user query request, and the user query request does not carry data that needs to be verified. The server 102 verifies the user query request by determining whether the actual request processing path is the same as the preset request processing path corresponding to the user query request. When the verification of the user query request succeeds, the user query request is responded to, and the data requested by the user query request is returned to the terminal 101. When the verification of the user query request fails, the user query request is refused to be responded to, and an alarm page is output to the terminal 101, and the alarm page is used to prompt that the user query request is blocked.

[0037] In another implementation, the target access request carries data that needs to be verified (i.e., the first data hereinafter), and the server 102 can verify the target access request by determining whether the actual request processing path is the same as the preset request processing path corresponding to the target access request, and determining whether the second data returned by the first actual return data method is the same as the first data. When the preset request processing path corresponding to the target access request is the same as the actual request processing path, and the second data is the same as the first data, a verification result of successful verification of the target access request is generated. When the preset request processing path corresponding to the target access request is different from the actual request processing path; or when the second data is different from the first data; or when the preset request processing path corresponding to the target access request is different from the actual request processing path and the second data is different from the first data, a verification result of failed verification of the target access request is generated. When the verification result is that the verification of the target access request is successful, the target access request is responded to; when the verification result is that the verification of the target access request fails, the target access request is refused to be responded to, and an alarm page is output to the terminal 101, and the alarm page is used to prompt that the target access request is blocked.

[0038] For example, the target access request is a user login request, and the user login request carries data that needs to be verified, such as the user's login information (such as user account, password, etc.); the server 102 verifies the user query request by determining whether the actual request processing path is the same as the preset request processing path corresponding to the user login request, and determining whether the user information carried in the user login request is the same as the user information returned by the first actual return data method. When the user login request is successfully verified, the user login request is responded to, and the terminal 101 is allowed to log in to the application. When the user login request fails to be verified, the user login request is refused to be responded to, and an alarm page is output to the terminal 101, and the alarm page is used to prompt that the user query request is blocked.

[0039] It can be understood that the request processing system described in the embodiment of the present application is for more clearly illustrating the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0040] In an embodiment of the present application, when receiving a target access request from terminal 101 to an application, server 102 can determine the preset request processing path corresponding to the target access request in the data table, and can also monitor the actual request processing path of the target access request based on the security protection mechanism pre-injected into the source code of the application. Server 102 verifies the target access request through the actual request processing path and the preset request processing path corresponding to the target access request, which can effectively improve the accuracy of the request verification result, thereby effectively improving the accuracy of the protection of the application; in addition, the data table stores the preset request processing path corresponding to each access request of at least one access request of the application. When receiving a target access request from terminal 101 to the application, server 102 can quickly determine the preset request processing path corresponding to the target access request in the data table, which improves the request verification efficiency to a certain extent, thereby improving the protection efficiency of the application.

[0041] See also Figure 2 , Figure 2 is a flowchart of a request processing method provided by an embodiment of the present application. The request processing method can be Figure 1 The request processing method is executed by the server 102 in the request processing system 10 shown in the figure. The request processing method may include the following steps S201 to S204:

[0042] Step S201, when a target access request to an application is received, a preset request processing path corresponding to the target access request is determined in a data table.

[0043] The data table may include a preset request processing path corresponding to each access request of at least one access request of the application program, and the data table may also include a request processing method of the preset request processing path corresponding to each access request, and the preset request processing path of each access request corresponds to the request processing method of the access request. The specific process of establishing the data table can be found in Figure 3 The description of step S302 to step S303 in the illustrated embodiment will not be repeated here.

[0044] The target access request may be a URL (Uniform Resource Locator). When a target access request for an application is received, the request processing method corresponding to the target access request may be determined based on the request parameters in the target access request, and then the preset request processing path corresponding to the request processing method may be determined in the data table based on the request processing method, that is, the preset request processing path corresponding to the target access request may be determined in the data table. For example, if the URL is "https: / / www.example.com / login / ", the request processing method corresponding to the URL may be determined based on the request parameter "login" in the URL (for example, it may be the login() method), and then the preset request processing path corresponding to the request processing method may be determined in the data table based on the request processing method, that is, the preset request processing path corresponding to the target access request may be determined in the data table.

[0045] Step S202: obtaining an actual request processing path for the target access request according to the security protection mechanism.

[0046] The security protection mechanism can be pre-injected into the source code of the application. Specifically, the security protection mechanism can be injected into the source code of the application during the development phase of the application, during the compilation phase of the application, or during the interpretation phase of the application. The specific injection process of the security protection mechanism can be found in Figure 3 The description of step S301 in the illustrated embodiment will not be repeated here.

[0047] Step S203: verify the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request to obtain a verification result.

[0048] In one implementation, the target access request can be verified by determining whether the preset request processing path corresponding to the target access request is the same as the actual request processing path. If the preset request processing path corresponding to the target access request is the same as the actual request processing path, a verification result indicating successful verification of the target access request is generated; if the preset request processing path corresponding to the target access request is not the same as the actual request processing path, a verification result indicating failed verification of the target access request is generated. Specifically, the preset request processing path corresponding to the target access request is the same as the actual request processing path, which means that: the various methods included in the preset request processing path are the same as the various methods included in the actual request processing path, and the calling order of the various methods included in the preset request processing path is the same as the calling order of the various methods included in the actual request processing path. The fact that the preset request processing path corresponding to the target access request is different from the actual request processing path may mean that: the various methods included in the preset request processing path are different from the various methods included in the actual request processing path; or, the calling order of the various methods included in the preset request processing path is different from the calling order of the various methods included in the actual request processing path; or, the various methods included in the preset request processing path are different from the various methods included in the actual request processing path, and the calling order of the various methods included in the preset request processing path is different from the calling order of the various methods included in the actual request processing path.

[0049] For example, the preset request processing path corresponding to the target access request is "request processing method 1→data processing method 1→data processing method 2→return data method 1", and the actual request processing path corresponding to the target access request is "request processing method 1→data processing method 1→data processing method 3→return data method 1". The methods included in the preset request processing path are different from the methods included in the actual request processing path, and it is determined that the verification of the target access request has failed. For another example, the preset request processing path corresponding to the target access request is "request processing method 1→data processing method 1→data processing method 2→return data method 1", and the actual request processing path corresponding to the target access request is "request processing method 1→data processing method 2→data processing method 1→return data method 1". The calling order of the methods included in the preset request processing path is different from the calling order of the methods included in the actual request processing path, and it is determined that the verification of the target access request has failed.

[0050] In another implementation, the target access request carries the first data, and the target access request can be verified by determining whether the preset request processing path corresponding to the target access request is the same as the actual request processing path, and determining whether the second data returned by the first actual return data method is the same as the first data. If the preset request processing path corresponding to the target access request is the same as the actual request processing path, and the second data is the same as the first data, a verification result indicating successful verification of the target access request is generated. If the preset request processing path corresponding to the target access request is different from the actual request processing path; or if the second data is different from the first data; or if the preset request processing path corresponding to the target access request is different from the actual request processing path and the second data is different from the first data, a verification result indicating failed verification of the target access request is generated.

[0051] In one implementation, in order to prevent the occurrence of an unauthorized access vulnerability, when the target access request is successfully verified, the target access request, the first actual request processing method in the actual request processing path, and the first data can be associated and stored; if the target access request is received again, the second actual request processing method and the second actual return data method corresponding to the target access request received again can be obtained according to the security protection mechanism, and the third data returned by the second actual return data method can be obtained; if the first actual request processing method is the same as the second actual request processing method, and the first data matches the third data (for example, the first data and the third data can be the same), then a verification result of successful verification of the target access request received again is generated; if the first actual request processing method is different from the second actual request processing method; or, if the first data does not match the third data; or, if the first actual request processing method is different from the second actual request processing method and the first data does not match the third data, then a verification result of failed verification of the target access request received again is generated. Taking a user query request as an example, an unauthorized access vulnerability can refer to a situation where the query results returned are inconsistent when the same query request is sent twice to the same user. This method can effectively avoid the occurrence of unauthorized vulnerabilities, further improve the accuracy of request verification, and further improve the accuracy of application protection.

[0052] In one implementation, if the second received target access request is successfully verified, the second actual request processing method and the third data corresponding to the second received target access request can be used to overwrite the associated stored first actual request processing method and the first data. In addition, a cache time period (e.g., 10 seconds) can also be set. When the multiple received target access requests are successfully verified within the cache time period (e.g., within 10 seconds), the target access request, the first actual request processing method and the first data are not associated and stored; when the multiple received target access requests are successfully verified outside the cache time period (e.g., more than 10 seconds), the target access request, the first actual request processing method and the first data can be associated and stored. By setting the cache time period, the target access request, the first actual request processing method and the first data can be associated and stored in the cache space only when the multiple received target access requests are successfully verified outside the cache time period (e.g., more than 10 seconds), so that cache resources can be reasonably allocated and cache space can be saved. Furthermore, you can also set a cache cleaning time period. If there is more than one access request to the application and more than one access request of the same type is received, the amount of data will be relatively large, occupying more cache space, which may easily affect the running status of the application (for example, freezing or interruption of the running process). Data whose cache time exceeds the cache cleaning time period can be deleted from the cache, and the cache space can be effectively managed to maintain the normal operation of the application.

[0053] In one implementation, the request processing method can be used to perform auxiliary verification on the target access request. For example, the target access request is a user login request from an illegal user to an application, and the user login request carries the user's login information (including the username 'admin' or '1' = '1' -- and the password 'any character'). Assume that the developer of the application has neglected to set a function or method to filter the characters in the username, or directly concatenates the username and password in the login information to query the database; at this time, since the query statement "SELECT * FROM USERS where username = 'admin' or '1' = '1' -- and password = 'any character'" constructed based on the login information of the illegal user is always true, the actual request processing path corresponding to the user login request is the same as the preset request processing path corresponding to the user login request, and the login information returned by the return data method is also the same as the login information in the user login request. Therefore, if the verification method in the above implementation is used, the verification will fail. At this time, the request processing method can be used to perform auxiliary verification on the target access request. If the request processing method detects that the username in the user login request is inconsistent with the normally entered username (for example, the normally entered username cannot include the illegal character "admin"), it can also be determined that the verification of the user login request has failed, further improving the accuracy of the request verification results and further improving the accuracy of the security protection of the application.

[0054] Step S204: determine a response strategy for the target access request according to the verification result.

[0055] When the verification result is that the verification of the target access request is successful, the response strategy for the target access request determined to be the response to the target access request, for example, allowing the application to be logged in, returning the data requested by the target access request, etc. When the verification result is that the verification of the target access request fails, the response strategy for the target access request determined to be the rejection of the response to the target access request, for example, not allowing the application to be logged in, prohibiting the return of the data requested by the target access request, etc.; an alarm page may also be output to the terminal that sent the target access request, and the alarm page is used to prompt that the target access request is blocked; the target access request and the actual request processing path corresponding to the target access request may also be written into the log, and by sending the alarm information to the application developer and the application security administrator, the application developer and the application security administrator may timely learn the illegal requests received by the application and the request processing path corresponding to the illegal requests by viewing the log or the alarm information, so that the application can be repaired to improve the security and reliability of the application.

[0056] In the embodiment of the present application, when a target access request to an application is received, the preset request processing path corresponding to the target access request can be determined in the data table, and the actual request processing path of the target access request can be monitored according to the security protection mechanism pre-injected into the source code of the application. The target access request is verified by the actual request processing path and the preset request processing path corresponding to the target access request, which can effectively improve the accuracy of the request verification result, thereby effectively improving the accuracy of the protection of the application; in addition, the data table stores the preset request processing path corresponding to each access request in at least one access request of the application, and when the target access request to the application is received, the preset request processing path corresponding to the target access request can be quickly determined in the data table, which improves the request verification efficiency to a certain extent, thereby improving the protection efficiency of the application. In addition, the request processing method can be used for auxiliary verification of the target access request; when the target access request is successfully verified, the target access request, the first actual request processing method in the actual request processing path and the first data can be associated and stored, effectively avoiding the generation of unauthorized vulnerabilities, further improving the accuracy of the request verification result, and making the operation of the application safer and more reliable.

[0057] See also Figure 3 , Figure 3 is a flowchart of another request processing method provided by an embodiment of the present application. The request processing method can be Figure 1 The request processing method may include the following steps S301 to S307:

[0058] Step S301, injecting a security protection mechanism into the source code of the application.

[0059] The security protection mechanism can be understood as a development framework or framework system consisting of a section of executable security protection code. The security protection mechanism needs to be injected into the source code of the application during the development phase of the application. The security protection mechanism may include a request start identifier, at least one request method identifier, and a request end identifier. The request start identifier may be used to identify the request processing method for the access request in the source code of the application; the request method identifier may be used to identify the data processing method for the access request in the source code of the application; and the request end identifier may be used to identify the return data method for the access request in the source code of the application.

[0060] For the same type of access request, the request processing method for the access request, at least one data processing method for the access request, and the return data method for the access request together constitute a preset request processing path for the access request, that is, the preset request processing path corresponding to the access request may include a request processing method located at the starting point of the path, at least one data processing method located between the starting point and the end point of the path, a return data method located at the end point of the path, and a calling order between at least one data processing method.

[0061] In one implementation, the security protection mechanism can be manually injected into the source code of the application by the developer of the application according to the development logic of the application during the development stage of the application. In another implementation, the security protection mechanism can also be automatically injected into the source code of the application according to the calling relationship between the various methods included in the preset request processing path corresponding to each access request in at least one access request of the application during the development stage of the application.

[0062] In the above two implementations, the injection process of the security protection mechanism can be: adding a request start identifier at the position corresponding to the request processing method in the source code of the application, adding a request method identifier at the position corresponding to each data processing method in at least one data processing method in the source code of the application according to the calling order between at least one data processing method, and adding a request end identifier at the position corresponding to the return data method in the source code of the application. For example, in the case of automatic marking, after the request processing method is determined in the source code of the application, the request start identifier is added at the position corresponding to the request processing method in the source code of the application; then the data processing method 1 called after the request processing method is automatically tracked, and the request method identifier is added at the position corresponding to the data processing method 1 in the source code of the application; and so on, the data processing method 2 called after the data processing method 1 is automatically tracked until the return data method is tracked, and then the request end identifier is added at the position corresponding to the return data method in the source code of the application.

[0063] Figure 4 is a schematic diagram of a security protection mechanism injection result provided by an embodiment of the present application, such as Figure 4As shown, "@Request_Start()" in the dotted box is the request start identifier; "@Request_Path_1()" and "@Request_Path_2()" in the dotted box are two request method identifiers, and the calling order of the data processing method identified by "@Request_Path_1()" is before the calling order of the data processing method identified by "@Request_Path_2()"; "@Request_Data_Receive()" is the request end identifier. The request processing method identified by "@Request_Start()", the two data processing methods identified by "@Request_Path_1()" and "@Request_Path_2()", and the return data method identified by "@Request_Data_Receive()" together constitute a preset request processing path. It should be noted that Figure 4 The illustrated embodiments are for illustrative purposes only and do not constitute limitations on the embodiments of the present application. In actual application scenarios, the request start identifier, request method identifier, and request end identifier may also be represented by other forms of identifiers. For example, “@Request_Begin()” may be used to represent the request start identifier, “@Request_Data_Return()” may be used to represent the request end identifier, “@Request_Process()” may be used to represent the request method identifier, and so on.

[0064] Step S302: obtaining a preset request processing path corresponding to each access request of at least one access request of the application program through a security protection mechanism.

[0065] In one implementation, for the method of automatically injecting the security protection mechanism, in the initialization stage of the application, the preset request processing path corresponding to each access request in at least one access request of the application can be obtained through the security protection mechanism. In another implementation, for the method of manually injecting the security protection mechanism by the developer, the preset request processing path corresponding to each access request cannot be obtained in the initialization stage of the application, because there is no mapping between the request start identifier, request method identifier and request end identifier manually injected by the developer, that is, the developer did not consider the calling relationship between each method in the process of injecting the request start identifier, request method identifier and request end identifier into the source code, or the calling relationship between each method is not clearly marked; for the method of manually injecting the security protection mechanism by the developer, the preset request processing path corresponding to each access request in at least one access request of the application can be obtained through the security protection mechanism only in the stage of compiling the application or in the stage of interpreting and running the application. The at least one access request may refer to all types of access requests that the application may receive, or may refer to some types of access requests that the application may receive; for example, the at least one access request may include a user login request, a user query request, a user update request, and the like.

[0066] Step S303: Record the preset request processing path corresponding to each access request and the request processing method at the starting point of the path into a pre-established data table.

[0067] After obtaining the preset request processing path corresponding to each access request in at least one access request of the application through the security protection mechanism, the preset request processing path corresponding to each access request and the request processing method at the starting point of the path can be recorded in a pre-established data table; in the data table, the preset request processing path corresponding to each access request corresponds to the request processing method of the preset request processing path corresponding to the access request. In one implementation, for the method of automatically injecting the security protection mechanism, the preset request processing path corresponding to each access request in at least one access request of the application can be obtained through the security protection mechanism during the initialization phase of the application, and thus a data table containing the preset request processing path corresponding to each access request can be obtained during the initialization phase of the application. In another implementation, for the method of manually injecting the security protection mechanism, the preset request processing path corresponding to each access request in at least one access request of the application can be obtained through the security protection mechanism during the phase of compiling the application or during the phase of interpreting and running the application, and thus a data table containing the preset request processing path corresponding to each access request can be obtained during the phase of compiling the application or during the phase of interpreting and running the application.

[0068] Table 1 shows an exemplary data table. As shown in Table 1, the application may receive 5 types of access requests, and each access request corresponds to a preset request processing path. Table 1 contains 3 fields, namely, an ID field, a request processing method field, and a preset request processing path field. The ID field is a database's own field, and the ID field increases as the type of access request increases. The request processing method field is used to record the request processing method corresponding to each access request. The preset request processing path field is used to record the preset request processing path corresponding to each access request. Different types of access requests correspond to different preset request processing paths, so it is impossible for the same entry to exist in the data table. It should be noted that the data table shown in Table 1 is only used for example and does not constitute a limitation on the embodiments of the present application.

[0069] Table 1

[0070]

[0071] During the actual operation of the application, multiple different target access requests of the same type may be received for the application, such as multiple user login requests for the application; for multiple different target access requests, since the multiple different target access requests belong to the same type, the request processing paths (such as the preset request processing path or the actual request processing path) corresponding to the multiple different target access requests may be the same, but for different target access requests, the return data returned by the return data method is different. Figure 5 As shown, Figure 5 This is a schematic diagram of the correspondence between a target access request and a data processing path provided in an embodiment of the present application. The target access request 1 for the application sent by user 1, the target access request 2 for the application sent by user 2, and the target access request 3 for the application sent by user 3 belong to the same type of access requests, and the corresponding data processing paths are the same, but the data returned by the same return data method is different. The target access request 1 corresponds to return data 1, the target access request 2 corresponds to return data 2, and the target access request 3 corresponds to return data 3.

[0072] Step S304: when a target access request to an application is received, a preset request processing path corresponding to the target access request is determined in the data table.

[0073] Step S305: obtaining an actual request processing path for the target access request according to the security protection mechanism.

[0074] Step S306: verify the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request to obtain a verification result.

[0075] Step S307: determine a response strategy for the target access request according to the verification result.

[0076] The execution process of step S304 in the embodiment of the present application is similar to Figure 2 The execution process of step S201 in the embodiment shown is the same as that of step S305. Figure 2 The execution process of step S202 in the embodiment shown is the same as that of step S306. Figure 2 The execution process of step S203 in the embodiment shown is the same as that of step S307. Figure 2 The execution process of step S204 in the illustrated embodiment is the same. For the specific execution process, please refer to Figure 2 The description of the illustrated embodiment will not be repeated here.

[0077] In the embodiment of the present application, the security protection mechanism can be automatically injected into the source code of the application according to the calling relationship between the various methods in the source code during the development stage of the application, and the automatic injection of the security protection mechanism makes the injection method more intelligent. Through the security protection mechanism, the preset request processing path corresponding to each access request of at least one access request that the application may receive can be obtained, and the preset request processing path corresponding to each access request is recorded in a pre-established data table. The preset request processing path corresponding to each access request can be quickly queried in the data table, thereby improving the request verification efficiency to a certain extent, and then improving the protection efficiency of the application.

[0078] See also Figure 6 , Figure 6 is a schematic diagram of a request processing device provided in an embodiment of the present application. The request processing device 60 can be used to execute Figure 2 or Figure 3 The corresponding steps in the request processing method shown in the figure, the request processing device 60 may include the following units:

[0079] A determination unit 601 is configured to determine, when receiving a target access request for an application, a preset request processing path corresponding to the target access request in a data table, wherein the data table includes a preset request processing path corresponding to each access request of at least one access request of the application;

[0080] An acquisition unit 602 is used to acquire an actual request processing path for a target access request according to a security protection mechanism, where the security protection mechanism is pre-injected into the source code of the application program;

[0081] A verification unit 603, configured to verify the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request, and obtain a verification result;

[0082] The determination unit 601 is further configured to determine a response strategy to the target access request according to the verification result.

[0083] In one implementation, the determining unit 601 is further configured to:

[0084] Inject security protection mechanisms into the application's source code;

[0085] Obtaining, through a security protection mechanism, a preset request processing path corresponding to each access request of at least one access request of the application program;

[0086] The preset request processing path corresponding to each access request and the request processing method at the starting point of the path are recorded in a pre-established data table.

[0087] In one implementation, the security protection mechanism includes a request start identifier, at least one request method identifier and a request end identifier; the preset request processing path includes a request processing method located at the starting point of the path, at least one data processing method, a return data method located at the end point of the path, and a calling sequence between at least one data processing method.

[0088] In one implementation, the determining unit 601 is specifically configured to:

[0089] Add a request start identifier to the location corresponding to the request processing method in the source code of the application;

[0090] In the source code of the application, a request method identifier is added at a position corresponding to each data processing method in at least one data processing method according to the calling order;

[0091] Add a request end identifier to the location of the method that returns data in the application's source code.

[0092] In one implementation, the verification unit 603 is specifically configured to:

[0093] Determine whether the preset request processing path corresponding to the target access request is the same as the actual request processing path;

[0094] If they are the same, a verification result indicating successful verification of the target access request is generated;

[0095] If they are not the same, a verification result indicating that the verification of the target access request has failed is generated;

[0096] Among them, the preset request processing path is the same as the actual request processing path means that: the methods included in the preset request processing path are the same as the methods included in the actual request processing path, and the calling order of the methods included in the preset request processing path is the same as the calling order of the methods included in the actual request processing path.

[0097] In one implementation, the actual request processing path includes a first actual return data method; the target access request carries the first data; and the verification unit 603 is specifically configured to:

[0098] Obtaining the second data returned by the first actual return data method;

[0099] Determine whether a preset request processing path corresponding to the target access request is the same as an actual request processing path, and whether the first data matches the second data;

[0100] If so, a verification result indicating successful verification of the target access request is generated;

[0101] If not, a verification result indicating that the target access request verification failed is generated;

[0102] Among them, the preset request processing path is the same as the actual request processing path means that: the methods included in the preset request processing path are the same as the methods included in the actual request processing path, and the calling order of the methods included in the preset request processing path is the same as the calling order of the methods included in the actual request processing path.

[0103] In one implementation, the actual request processing path also includes a first actual request processing method; the verification unit 603 is further configured to:

[0104] If the verification result is that the verification of the target access request is successful, the target access request, the first actual request processing method and the first data are stored in association;

[0105] If the target access request is received again, then obtaining the second actual request processing method and the second actual return data method corresponding to the target access request received again according to the security protection mechanism, and obtaining the third data returned by the second actual return data method;

[0106] If the first actual request processing method is the same as the second actual request processing method, and the first data matches the third data, a verification result indicating successful verification of the re-received target access request is generated.

[0107] In one implementation, the determining unit 601 is specifically configured to:

[0108] If the verification result is that the verification of the target access request fails, the target access request is rejected, and an alarm page is output, and the target access request and the actual request processing path corresponding to the target access request are written into the log. The alarm page is used to prompt that the target access request is blocked.

[0109] According to one embodiment of the present application, Figure 6The various units in the request processing device 60 shown can be individually or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the request processing device 60 may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units. According to another embodiment of the present application, it is possible to execute the following by running on a general-purpose computing device of a general-purpose computer including processing elements and storage elements such as a central processing unit (CPU), a random access storage medium (RAM), and a read-only storage medium (ROM). Figure 2 or Figure 3 A computer program (including program code) for each step involved in the corresponding method shown in Figure 6 The request processing device 60 shown in the figure can be used to implement the request processing method of the embodiment of the present application. The computer program can be recorded on, for example, a computer readable storage medium and loaded into Figure 1 The request processing system shown is located in the server 102 and runs therein.

[0110] In an embodiment of the present application, when a target access request to an application is received, a preset request processing path corresponding to the target access request can be determined in a data table, and the actual request processing path of the target access request can be monitored according to a security protection mechanism pre-injected into the source code of the application. By verifying the target access request through the actual request processing path and the preset request processing path corresponding to the target access request, the accuracy of the request verification result can be effectively improved, thereby effectively improving the accuracy of protection of the application. In addition, the data table stores a preset request processing path corresponding to each access request of at least one access request of the application. When a target access request to the application is received, the preset request processing path corresponding to the target access request can be quickly determined in the data table, which improves the request verification efficiency to a certain extent, thereby improving the protection efficiency of the application.

[0111] See also Figure 7 , Figure 7 It is a structural diagram of a request processing device provided in an embodiment of the present application, wherein the request processing device includes a processor 701, a memory 702 and a communication interface 703, and the processor 701, the memory 702 and the communication interface 703 are connected via one or more communication buses.

[0112] Processor 701 is used to execute Figure 2 or Figure 3 The corresponding steps in the request processing method shown in the figure. The processor 701 can be a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof.

[0113] The memory 702 is used to store computer programs, etc. The memory 702 may include a volatile memory (volatile memory), such as a random access memory (Random Access Memory, RAM); the memory 702 may also include a non-volatile memory (NVM), such as a read-only memory (Read-Only Memory, ROM), a flash memory (flash memory), a hard disk (Hard Disk Drive, HDD) or a solid-state drive (Solid-State Drive, SSD); the memory 702 may also include a combination of the above-mentioned types of memory.

[0114] The communication interface 703 is used to receive and send data. For example, the communication interface 703 is used to receive a target access request for an application program, and the communication interface 703 is used to output an alarm page, etc. In an embodiment of the present application, the request processing device may include multiple communication interfaces, wherein the communication interface for sending data and the communication interface for receiving data may not be the same communication interface.

[0115] The processor 701 calls the computer program stored in the memory 702 to perform the following steps:

[0116] When receiving a target access request for an application, determining a preset request processing path corresponding to the target access request in a data table, the data table including a preset request processing path corresponding to each access request of at least one access request of the application;

[0117] Obtain the actual request processing path for the target access request based on the security protection mechanism, which is pre-injected into the source code of the application;

[0118] Verify the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request to obtain a verification result;

[0119] Determine the response strategy for the target access request based on the verification result.

[0120] In one implementation, the processor 701 calls the computer program stored in the memory 702 to further perform the following steps:

[0121] Inject security protection mechanisms into the application's source code;

[0122] Obtaining, through a security protection mechanism, a preset request processing path corresponding to each access request of at least one access request of the application program;

[0123] The preset request processing path corresponding to each access request and the request processing method at the starting point of the path are recorded in a pre-established data table.

[0124] In one implementation, the security protection mechanism includes a request start identifier, at least one request method identifier and a request end identifier; the preset request processing path includes a request processing method located at the starting point of the path, at least one data processing method, a return data method located at the end point of the path, and a calling sequence between at least one data processing method.

[0125] In one implementation, the processor 701 calls the computer program stored in the memory 702 to specifically perform the following steps:

[0126] Add a request start identifier to the location corresponding to the request processing method in the source code of the application;

[0127] In the source code of the application, a request method identifier is added at a position corresponding to each data processing method in at least one data processing method according to the calling order;

[0128] Add a request end identifier to the location of the method that returns data in the application's source code.

[0129] In one implementation, the processor 701 calls the computer program stored in the memory 702 to specifically perform the following steps:

[0130] Determine whether the preset request processing path corresponding to the target access request is the same as the actual request processing path;

[0131] If they are the same, a verification result indicating successful verification of the target access request is generated;

[0132] If they are not the same, a verification result indicating that the verification of the target access request has failed is generated;

[0133] Among them, the preset request processing path is the same as the actual request processing path means that: the methods included in the preset request processing path are the same as the methods included in the actual request processing path, and the calling order of the methods included in the preset request processing path is the same as the calling order of the methods included in the actual request processing path.

[0134] In one implementation, the actual request processing path includes a first actual return data method; the target access request carries first data; the processor 701 calls the computer program stored in the memory 702 to specifically perform the following steps:

[0135] Obtaining the second data returned by the first actual return data method;

[0136] Determine whether a preset request processing path corresponding to the target access request is the same as an actual request processing path, and whether the first data matches the second data;

[0137] If so, a verification result indicating successful verification of the target access request is generated;

[0138] If not, a verification result indicating that the target access request verification failed is generated;

[0139] Among them, the preset request processing path is the same as the actual request processing path means that: the methods included in the preset request processing path are the same as the methods included in the actual request processing path, and the calling order of the methods included in the preset request processing path is the same as the calling order of the methods included in the actual request processing path.

[0140] In one implementation, the actual request processing path also includes a first actual request processing method; the processor 701 calls the computer program stored in the memory 702 to further perform the following steps:

[0141] If the verification result is that the verification of the target access request is successful, the target access request, the first actual request processing method and the first data are stored in association;

[0142] If the target access request is received again, then obtaining the second actual request processing method and the second actual return data method corresponding to the target access request received again according to the security protection mechanism, and obtaining the third data returned by the second actual return data method;

[0143] If the first actual request processing method is the same as the second actual request processing method, and the first data matches the third data, a verification result indicating successful verification of the re-received target access request is generated.

[0144] In one implementation, the processor 701 calls the computer program stored in the memory 702 to specifically perform the following steps:

[0145] If the verification result is that the verification of the target access request fails, the target access request is rejected, and an alarm page is output, and the target access request and the actual request processing path corresponding to the target access request are written into the log. The alarm page is used to prompt that the target access request is blocked.

[0146] In an embodiment of the present application, when a target access request to an application is received, a preset request processing path corresponding to the target access request can be determined in a data table, and the actual request processing path of the target access request can be monitored according to a security protection mechanism pre-injected into the source code of the application. By verifying the target access request through the actual request processing path and the preset request processing path corresponding to the target access request, the accuracy of the request verification result can be effectively improved, thereby effectively improving the accuracy of protection of the application. In addition, the data table stores a preset request processing path corresponding to each access request of at least one access request of the application. When a target access request to the application is received, the preset request processing path corresponding to the target access request can be quickly determined in the data table, which improves the request verification efficiency to a certain extent, thereby improving the protection efficiency of the application.

[0147] The present application also provides a computer-readable storage medium that can be used to store a computer program. When the computer program is called by a processor of a computer device, the computer device can execute the above Figure 2 or Figure 3 Corresponding steps of the request processing method in the embodiment. Computer-readable storage media include, but are not limited to, flash memory, hard disk (HDD), and solid-state drive (SSD).

[0148] The present application also provides a computer program product. When the computer program product is executed by a computer device, the above Figure 2 or Figure 3 Corresponding steps of the request processing method in the embodiment.

[0149] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, computer software, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0150] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL), etc.) or wireless (e.g., infrared, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD) or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

[0151] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A request processing method, characterized in that: The method comprises: When a target access request to an application is received, a preset request processing path corresponding to the target access request is determined in a data table, the data table including a preset request processing path corresponding to each access request of at least one access request of the application; the preset request processing path includes a request processing method at a starting point of the path, at least one data processing method, a return data method at an end point of the path, and a calling sequence between the at least one data processing method; Acquire an actual request processing path for the target access request according to a security protection mechanism, wherein the security protection mechanism is pre-injected into the source code of the application; the security protection mechanism includes a request start identifier, at least one request method identifier, and a request end identifier; injecting the security protection mechanism into the source code of the application, including: adding the request start identifier at a position corresponding to the request processing method in the source code of the application; adding a request method identifier at a position corresponding to each data processing method in the at least one data processing method in the source code of the application according to the calling order; adding the request end identifier at a position corresponding to the return data method in the source code of the application; Verifying the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request to obtain a verification result; A response strategy for the target access request is determined according to the verification result.

2. The method according to claim 1, characterized in that Before determining in the data table the preset request processing path corresponding to the target access request, the method further includes: Injecting the security protection mechanism into the source code of the application; Obtaining, through the security protection mechanism, a preset request processing path corresponding to each access request of at least one access request of the application; The preset request processing path corresponding to each access request and the request processing method at the starting point of the path are recorded in the pre-established data table.

3. The method according to claim 1 or 2, characterized in that: The verifying the target access request according to the actual request processing path and the preset request processing path corresponding to the target access request to obtain a verification result includes: Determining whether a preset request processing path corresponding to the target access request is the same as the actual request processing path; If they are the same, generating a verification result indicating successful verification of the target access request; If they are not the same, generating a verification result indicating that the verification of the target access request has failed; Among them, the preset request processing path is the same as the actual request processing path means that: the methods included in the preset request processing path are the same as the methods included in the actual request processing path, and the calling order of the methods included in the preset request processing path is the same as the calling order of the methods included in the actual request processing path.

4. The method according to any one of claims 1 or 2, characterized in that The actual request processing path includes a first actual return data method; the target access request carries first data; and the target access request is verified according to the actual request processing path and the preset request processing path corresponding to the target access request to obtain a verification result, including: Obtaining second data returned by the first actual data return method; Determine whether a preset request processing path corresponding to the target access request is the same as the actual request processing path, and whether the first data matches the second data; If so, generating a verification result indicating successful verification of the target access request; If not, generating a verification result indicating that the verification of the target access request has failed; Among them, the preset request processing path is the same as the actual request processing path means that: the methods included in the preset request processing path are the same as the methods included in the actual request processing path, and the calling order of the methods included in the preset request processing path is the same as the calling order of the methods included in the actual request processing path.

5. The method according to claim 4, characterized in that The actual request processing path also includes a first actual request processing method; the method also includes: If the verification result is that the verification of the target access request is successful, the target access request, the first actual request processing method and the first data are stored in association; If the target access request is received again, obtaining, according to the security protection mechanism, a second actual request processing method and a second actual return data method corresponding to the target access request received again, and obtaining third data returned by the second actual return data method; If the first actual request processing method is the same as the second actual request processing method, and the first data matches the third data, a verification result indicating successful verification of the target access request received again is generated.

6. The method according to claim 1, characterized in that The determining a response strategy to the target access request according to the verification result includes: If the verification result is that the verification of the target access request fails, the target access request is refused to be responded to, and an alarm page is output, and the target access request and the actual request processing path corresponding to the target access request are written into the log. The alarm page is used to prompt that the target access request is blocked.

7. A request processing device, characterized in that: The request processing device comprises: a determination unit, configured to, when receiving a target access request to an application, determine in a data table a preset request processing path corresponding to the target access request, the data table comprising a preset request processing path corresponding to each access request of at least one access request of the application; the preset request processing path comprising a request processing method at a starting point of the path, at least one data processing method, a return data method at an end point of the path, and a calling sequence between the at least one data processing method; an acquisition unit, configured to acquire an actual request processing path for the target access request according to a security protection mechanism, wherein the security protection mechanism is pre-injected into the source code of the application; the security protection mechanism comprises a request start identifier, at least one request method identifier and a request end identifier; injecting the security protection mechanism into the source code of the application comprises: adding the request start identifier at a position corresponding to the request processing method in the source code of the application; adding a request method identifier at a position corresponding to each data processing method in the at least one data processing method in the source code of the application according to the calling sequence; and adding the request end identifier at a position corresponding to the return data method in the source code of the application; A verification unit, configured to verify the target access request according to the actual request processing path and a preset request processing path corresponding to the target access request, to obtain a verification result; The determining unit is further configured to determine a response strategy to the target access request according to the verification result.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is read and executed by a processor of a computer device, the computer device executes the request processing method according to any one of claims 1 to 6.

9. A request processing device, characterized in that: The request processing device comprises: a processor adapted to implement a computer program; and, A memory storing the computer program, wherein the computer program is suitable for being loaded by the processor and executing the request processing method according to any one of claims 1 to 6.

10. A computer program product, characterized in that When the computer program product is executed, the request processing method according to any one of claims 1 to 6 is executed.

Citation Information

Patent Citations

  • Method and device for processing internal file of application program

    CN105975567A

  • File access method and file access system

    CN109376133A

  • Application program generation method and device and electronic device

    CN109783085A

  • User behavior path analysis method and device

    CN111581356A

  • Packet multiplexer

    JP1991273736A