Api request filtering method and apparatus, proxy server, and storage medium

By generating and analyzing the index fields and parameter data tables of HTTP requests, efficient filtering of unknown API requests is achieved, solving the problems of high filtering cost and low performance in existing technologies, and improving system security and performance.

CN117614709BActive Publication Date: 2026-07-24BEIJING KNOWNSEC INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING KNOWNSEC INFORMATION TECHNOLOGY CO LTD
Filing Date
2023-11-29
Publication Date
2026-07-24

Smart Images

  • Figure CN117614709B_ABST
    Figure CN117614709B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an API request filtering method and device, a proxy server and a storage medium, and relate to the technical field of system security. The method comprises: in response to an HTTP request sent by a client, extracting an index field and a plurality of parameters in an API request contained in the HTTP request, generating a data table based on the index field and the parameters, analyzing the data table to obtain data information of the parameters, taking the index field, the data table and the data information of the parameters as filtering feature information, filtering the API request based on the filtering feature information, forwarding the HTTP request containing the filtered API request to an API server, and causing the API server to receive the HTTP request containing the filtered API request, and sending a response packet to the client through the proxy server. Embodiments of the present application efficiently filter unknown API requests with low filtering cost, and significantly improve system performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of control technology, and more specifically, to an API request filtering method, apparatus, proxy server, and storage medium. Background Technology

[0002] In environments with stringent system security requirements, systems are often vulnerable to attacks from unknown API requests, which can cause system service failures or even lead to the leakage of sensitive system data.

[0003] Currently, the mainstream method for filtering API requests is to check existing request characteristics. Common methods involve analyzing malicious features using regular expressions, and rules containing specific characteristics are used to block requests. This approach suffers from several drawbacks: the rules need timely maintenance, which is extremely labor-intensive; false positives need to be corrected promptly; and the matching of numerous features is highly resource-intensive, requiring time for rule performance optimization. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide an API request filtering method, apparatus, proxy server and storage medium to achieve efficient filtering of unknown API requests with low filtering cost, thereby significantly improving system performance.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows:

[0006] In a first aspect, embodiments of the present invention provide an API request filtering method applied to a proxy server;

[0007] The method includes:

[0008] In response to an HTTP request sent by the client, extract the index field and multiple parameters from the API request contained in the HTTP request;

[0009] A data table is generated based on the index field and each of the parameters;

[0010] The data table is analyzed to obtain the data information for each parameter;

[0011] The index field, data table, and data information of each parameter are used as filtering feature information;

[0012] The API request is filtered based on the filtering feature information, so that the HTTP request containing the filtered API request is forwarded to the API server. After receiving the HTTP request containing the filtered API request, the API server sends the response packet to the client through the proxy server.

[0013] In an optional implementation, the plurality of parameters includes a plurality of GET parameters and a plurality of POST parameters.

[0014] The step of extracting the index field and multiple parameters from the API request contained in the HTTP request in response to the HTTP request sent by the client includes:

[0015] In response to an HTTP request sent by the client, extract the PATH field information and multiple GET parameters and multiple POST parameters from the API request contained in the HTTP request;

[0016] Use the PATH field as an index field.

[0017] In an optional implementation, the step of generating a data table based on the index field and each of the parameters includes:

[0018] Combine all the GET and POST parameters of the fields into a list.

[0019] The list information is stored in a data table that uses the index field as the index of the data table to generate a data table.

[0020] In an optional implementation, the data information includes data type;

[0021] The step of analyzing the data table to obtain the data information of each parameter includes:

[0022] The data table is analyzed at preset time intervals to obtain the field GET parameter name corresponding to the GET parameter of each field in the data table and the field POST parameter name corresponding to the POST parameter of each field.

[0023] Determine whether the GET parameter name corresponding to the GET parameter of each field is the same as the POST parameter name corresponding to the POST parameter of each field.

[0024] The data type of each parameter is calculated by merging multiple GET parameters and POST parameters with the same GET parameter name and POST parameter name.

[0025] In an optional implementation, after the step of merging multiple GET parameters and POST parameters with the same GET parameter name and POST parameter name to calculate the data type of each parameter, the method further includes:

[0026] Based on the data type of each parameter, obtain the data constraint information of each parameter under the corresponding data type;

[0027] The data type and data constraint information of each parameter are used as the data information of each parameter.

[0028] In optional implementations, the data types of each parameter include integer type, enumeration type, and character type;

[0029] The step of obtaining the data constraint information of each parameter under the corresponding data type according to the data type of each parameter includes:

[0030] When multiple parameters are of integer type, the range of parameter values ​​for each parameter under the corresponding integer type is obtained;

[0031] When the data type of multiple parameters is an enumeration type, the enumeration string information and enumeration string length information of the multiple parameters under the corresponding enumeration type are obtained;

[0032] When multiple parameters are of character type, the string length information of the multiple parameters under the corresponding character type is obtained.

[0033] In an optional implementation, the preset duration is one day.

[0034] Secondly, embodiments of the present invention provide an API request filtering device applied to a proxy server;

[0035] The device includes:

[0036] The information extraction module is used to extract the index field and multiple parameters from the API request contained in the HTTP request in response to the HTTP request sent by the client.

[0037] An information processing module is used to generate a data table based on the index field and each of the parameters; analyze the data table to obtain data information for each of the parameters; and use the index field, the data table, and the data information for each of the parameters as filtering feature information.

[0038] The filtering module is used to filter the API request based on the filtering feature information, so as to forward the HTTP request containing the filtered API request to the API server, so that after the API server receives the HTTP request containing the filtered API request, it sends the response packet to the client through the proxy server.

[0039] Thirdly, embodiments of the present invention provide a proxy server, including a memory and a processor;

[0040] The memory is used to store computer programs;

[0041] The processor is configured to execute the computer program to implement the API request filtering method provided as described in the first aspect embodiment and / or in combination with possible implementations of the first aspect embodiment.

[0042] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the API request filtering method provided as described in the first aspect embodiments and / or in combination with possible implementations of the first aspect embodiments.

[0043] The beneficial effects of the embodiments of the present invention include, for example:

[0044] This invention provides an API request filtering method, apparatus, proxy server, and storage medium. By extracting the index field and multiple parameters from the API request sent by the client's HTTP request, generating a data table based on the index field and each parameter, and analyzing the data table to obtain the data information of each parameter, the method ultimately uses the index field, data table, and parameter data information as filtering feature information. This allows the proxy server to filter API requests based on the filtering feature information. The entire process greatly increases system security, and unknown API requests can be clearly identified based on the aforementioned filtering feature information. This results in high filtering efficiency, low filtering cost, and significantly improved system performance.

[0045] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0046] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0047] Figure 1 An exemplary structural block diagram of a proxy server provided in an embodiment of the present invention is shown;

[0048] Figure 2 A flowchart illustrating an API request filtering method provided in an embodiment of the present invention is shown.

[0049] Figure 3This diagram illustrates the interaction between a client and an API server through a proxy server in an API request filtering method provided by an embodiment of the present invention.

[0050] Figure 4 This is a second schematic flowchart of an API request filtering method provided by an embodiment of the present invention;

[0051] Figure 5 The third flowchart of an API request filtering method provided by an embodiment of the present invention is shown;

[0052] Figure 6 The fourth flowchart illustrates an API request filtering method provided by an embodiment of the present invention.

[0053] Figure 7 The fifth illustration shows a flowchart of an API request filtering method provided by an embodiment of the present invention;

[0054] Figure 8 This illustration shows a flowchart of an API request filtering method provided by an embodiment of the present invention. Figure 6 ;

[0055] Figure 9 An exemplary structural block diagram of an API request filtering device provided by an embodiment of the present invention is shown.

[0056] Icons: 110-Proxy server; 1101-Memory; 1102-Processor; 1103-Communication interface; 300-API request filtering device; 301-Information extraction module; 302-Information processing module; 303-Filtering module. Detailed Implementation

[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0058] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0059] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0060] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.

[0061] Please refer to the following: Figure 1 , Figure 1 An exemplary structural block diagram of a proxy server 110 provided in an embodiment of the present invention is shown, as follows: Figure 1 As shown, the proxy server 110 includes a memory 1101, a processor 1102, and a communication interface 1103. The memory 1101, processor 1102, and communication interface 1103 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0062] The memory 1101 can be used to store software programs and modules. The processor 1102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 1101. The communication interface 1103 can be used to communicate with other node devices for signaling or data.

[0063] The memory 1101 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.

[0064] The processor 1102 can be an integrated circuit chip with signal processing capabilities. The processor 1102 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0065] Based on the aforementioned proxy server 110, the following executive description uses the proxy server 110 as the execution subject to illustrate an API request filtering method provided in this embodiment of the invention. Please refer to [link / reference]. Figure 2 , Figure 2 The diagram shows a flowchart of an API request filtering method provided by an embodiment of the present invention.

[0066] like Figure 2 As shown, the above API request filtering method is applied to proxy server 110, and the above API request filtering method may include the following steps:

[0067] S210, in response to an HTTP request sent by the client, extracts the index field and multiple parameters from the API request contained in the HTTP request.

[0068] S220 generates a data table based on the index field and various parameters.

[0069] S230, Analyze the data table to obtain data information for each parameter.

[0070] S250 uses the data information of the index field, data table, and each parameter as filtering feature information.

[0071] S260 filters API requests based on filtering feature information, so that HTTP requests containing the filtered API requests are forwarded to the API server. After receiving the HTTP request containing the filtered API requests, the API server sends the response packet to the client through the proxy server.

[0072] The above steps implement the process of extracting the index field and multiple parameters from the API request contained in the HTTP request sent by the client, generating a data table based on the index field and each parameter, analyzing the data table to obtain the data information of each parameter, and finally using the index field, data table and the data information of each parameter as filtering feature information, so that the proxy server can filter the API request based on the filtering feature information.

[0073] Step S210 involves extracting the index field and multiple parameters from the API request contained in the HTTP request sent by the client.

[0074] In this embodiment of the invention, the index field in the API request can be the PATH field information in the API request, and the multiple parameters in the API request can specifically be multiple GET parameters and multiple POST parameters in the API request. After receiving the HTTP request, the proxy server will extract the PATH field information and multiple GET parameters and multiple POST parameters in the API request contained in the HTTP request for subsequent processing.

[0075] In this embodiment of the invention, after extracting the index field and multiple parameters from the API request contained in the HTTP request, steps S220 and S230 are then executed to generate a data table based on the index field and each parameter, and to analyze the data table to obtain the data information of each parameter.

[0076] Specifically, for step S220, the process of generating a data table based on the index field and each parameter can be achieved by merging all GET parameters and POST parameters into a list of information, and then storing the list of information in a data table that uses the index field (i.e., the PATH field information) as the index of the data table.

[0077] Using the PATH field as an index for the data table facilitates subsequent storage. Since all GET and POST parameters are generally in list format, these two types of parameters can be combined into a list and then stored in a data table that uses the PATH field as its index.

[0078] Furthermore, the data table needs to be analyzed to obtain the data information for each parameter. The data table can be extracted and analyzed at intervals of each time unit. The specific analysis process can be achieved by obtaining the field GET parameter name corresponding to each field GET parameter and the field POST parameter name corresponding to each field POST parameter in the data table, and then checking whether the field GET parameter name corresponding to each field GET parameter and the field POST parameter name corresponding to each field POST parameter are the same.

[0079] Furthermore, multiple GET parameters and POST parameters with the same GET parameter name and POST parameter name can be merged and their data types calculated to obtain the data type of each parameter.

[0080] In this embodiment of the invention, the calculated data types generally fall into the following four categories:

[0081] First, integer type: all historical data are integers and are therefore considered integer type.

[0082] Secondly, enumeration type: Historical data that repeatedly uses the same word, and the total number of words is less than five, is considered an enumeration type.

[0083] Third, hash type: data that conforms to hash characteristics, has a fixed length, and a clearly defined range of characters.

[0084] Fourth, character type: Historical data shows no obvious pattern and is categorized as character type.

[0085] After determining the data types of each parameter through the above process, data constraint information for each parameter under the corresponding data type can be obtained. This data constraint information may include the integer value range for integer data types, specific enumeration string information for each enumeration data type, or string length information for character data types.

[0086] In this embodiment of the invention, after obtaining the data type and corresponding data constraint information of each parameter, the data type and corresponding data constraint information of each parameter can be used as the data information of each parameter. Then, steps S250 and S260 are executed to use the index field, data table and the data information of each parameter as filtering feature information. The API request is filtered based on the filtering feature information so that the HTTP request containing the filtered API request is forwarded to the API server. After the API server receives the HTTP request containing the filtered API request, it sends the response packet to the client through the proxy server so that the client can finally interact with the API server through the proxy server.

[0087] It should be noted that an HTTP proxy is a network proxy service that forwards HTTP requests and responses through a proxy server. For example, Figure 3 This illustration shows a schematic diagram of the interaction between a client and an API server through a proxy server in an API request filtering method provided by an embodiment of the present invention. Figure 3As shown, when a client sends an HTTP request, the client first sends the request to the proxy server, and then the proxy server forwards the request to the target server. When the target server returns a response, the proxy server sends the response back to the client. That is, the target business server is not visible to the client; the client can only send requests to the proxy server, which is responsible for forwarding the requests to the actual server.

[0088] Furthermore, HTTP proxies can filter and modify requests and responses to enforce access control policies, such as blocking specific URLs or domains, filtering malicious content or advertisements, etc.

[0089] Therefore, based on the API request filtering method in this embodiment of the invention, the API request filtering method can be used to filter the API requests contained in the HTTP requests sent by the client according to the obtained filtering feature information, and the API requests that do not conform to the filtering feature information are regarded as invalid and not allowed. Finally, the HTTP requests containing the filtered API requests can be forwarded to the API server.

[0090] For example, after filtering out malicious content or advertisements from API requests included in HTTP requests, the API server can receive secure HTTP requests. When ultimately interacting with the client through the proxy server, this can prevent system service failures or even the leakage of sensitive system data caused by API requests carrying malicious content or advertisements.

[0091] This invention provides an API request filtering method that extracts the index field and multiple parameters from the API request sent by the client's HTTP request. A data table is generated based on the index field and each parameter, and the data table is analyzed to obtain the data information of each parameter. Finally, the index field, data table, and data information of each parameter are used as filtering feature information, enabling the proxy server to filter API requests based on the filtering feature information. The entire process greatly increases system security, and unknown API requests can be clearly identified based on the aforementioned filtering feature information. This method offers high filtering efficiency, low filtering cost, and significantly improves system performance.

[0092] Optionally, the specific process of extracting the index field and multiple parameters from the API request contained in the HTTP request in response to an HTTP request sent by the client can be implemented through the following steps:

[0093] exist Figure 2 Based on this, please refer to Figure 4 , Figure 4This illustrates a second flowchart of the API request filtering method provided in this embodiment of the invention. The multiple parameters include multiple GET parameters and multiple POST parameters. Step S210, in response to an HTTP request sent by the client, involves extracting the index field and multiple parameters from the API request contained in the HTTP request.

[0094] S211, in response to an HTTP request sent by the client, extracts the PATH field information and multiple GET parameters and multiple POST parameters from the API request contained in the HTTP request.

[0095] S212, use the PATH field as an index field.

[0096] The above steps enable the proxy server to extract the index field and multiple parameters from the API request contained in the HTTP request after receiving the HTTP request sent by the client.

[0097] Alternatively, the specific process of generating a data table based on the indexed fields and parameters can be implemented through the following steps:

[0098] exist Figure 4 Based on this, please refer to Figure 5 , Figure 5 This illustrates the third flowchart of an API request filtering method provided by an embodiment of the present invention. Step S220, which involves generating a data table based on an index field and various parameters, includes:

[0099] S221, merge all GET parameters and POST parameters into a list.

[0100] S222, Store the list information in a data table that uses the index field as the index of the data table to generate the data table.

[0101] The above steps realize the process of generating a data table based on the index field and various parameters.

[0102] Optionally, the specific process of analyzing the data table to obtain the data information of each parameter can be achieved through the following steps:

[0103] exist Figure 4 Based on this, please refer to Figure 6 , Figure 6 The fourth flowchart of the API request filtering method provided in this embodiment of the invention is shown. The data information includes data types. Step S230 involves analyzing the data table to obtain the data information of each parameter, including:

[0104] S231, Analyze the data table at preset time intervals to obtain the field GET parameter name corresponding to the GET parameter of each field and the field POST parameter name corresponding to the POST parameter of each field in the data table.

[0105] S232, check one by one whether the GET parameter name corresponding to the GET parameter of each field is the same as the POST parameter name corresponding to the POST parameter of each field.

[0106] If the field name corresponding to the GET parameter is different from the field name corresponding to the POST parameter, return to step S232.

[0107] S233: Merge multiple GET parameters and POST parameters with the same GET parameter name and POST parameter name, and then calculate the data type to obtain the data type of each parameter.

[0108] The above steps realize the process of analyzing the data table to obtain the data information of each parameter.

[0109] Optionally, after obtaining the data type of each parameter in step S230 as data information, the data constraint information of each parameter under the corresponding data type can also be obtained according to the data type of each parameter, and finally the data type of each parameter and the corresponding data constraint information are used as the data information of each parameter. The above process can be specifically implemented through the following steps:

[0110] exist Figure 6 Based on this, please refer to Figure 7 , Figure 7 The fifth step of the flowchart of the API request filtering method provided in this embodiment of the invention is shown. After step S233, which involves merging multiple GET parameters and POST parameters with the same GET parameter name and POST parameter name to calculate the data type of each parameter, the API request filtering method further includes:

[0111] S240: Obtain the data constraint information of each parameter under the corresponding data type based on the data type of each parameter.

[0112] S241, the data type and data constraint information of each parameter are used as the data information of each parameter.

[0113] The above steps enable the further processing of the data constraint information of each parameter under the corresponding data type as the data information of each parameter.

[0114] Optionally, the specific process of obtaining the data constraint information of each parameter under the corresponding data type can be achieved through the following steps:

[0115] exist Figure 7 Based on this, please refer to Figure 8 , Figure 8 The sixth flowchart of the API request filtering method provided in this embodiment of the invention is shown. The data types of each parameter include integer type, enumeration type, and character type. Step S240, which obtains the data constraint information of each parameter under the corresponding data type, includes:

[0116] S2401, when multiple parameters are of integer type, obtain the range of parameter values ​​for the corresponding integer type.

[0117] S2402, when the data type of multiple parameters is an enumeration type, obtain the enumeration string information and enumeration string length information of the multiple parameters under the corresponding enumeration type.

[0118] S2403, when multiple parameters are of character type, obtain the string length information of the multiple parameters under the corresponding character type.

[0119] The above steps realize the process of obtaining the data constraint information of each parameter under the corresponding data type based on the data type of each parameter.

[0120] Optionally, the preset duration is one day.

[0121] In this embodiment of the invention, setting the preset duration to one day allows the data table obtained in step S230 to be extracted and analyzed at one-day intervals, so that the data information of each parameter obtained is more accurate.

[0122] Based on the same inventive concept, this embodiment of the invention also provides an API request filtering device 300, which is used to execute the process steps in the above embodiments and achieve the corresponding technical effects.

[0123] Specifically, please refer to Figure 9 The API request filtering device 300 is applied to the proxy server 110. The API request filtering device 300 includes an information extraction module 301, an information processing module 302, and a filtering module 303.

[0124] The information extraction module 301 is used to respond to the HTTP request sent by the client and extract the index field and multiple parameters contained in the API request in the HTTP request.

[0125] The information processing module 302 is used to generate a data table based on the index field and each parameter, analyze the data table to obtain the data information of each parameter, and use the index field, the data table and the data information of each parameter as filtering feature information.

[0126] The filtering module 303 is used to filter API requests based on filtering feature information, so as to forward the HTTP request containing the filtered API request to the API server, so that after the API server receives the HTTP request containing the filtered API request, it sends the response packet to the client through the proxy server.

[0127] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium storing a computer program thereon, which, when executed by processor 1102, implements an API request filtering method provided in the above embodiments.

[0128] The steps executed by the aforementioned computer program during runtime will not be described in detail here, but can be found in the explanation of the API request filtering method described above.

[0129] In this embodiment of the invention, by using the above-mentioned API request filtering method, device, proxy server and storage medium, the system can be prevented from being attacked by unknown API requests, thereby solving the problem of system failure or data leakage caused by the system being attacked by unknown API requests, and effectively ensuring the stable operation of the system.

[0130] In the several embodiments provided in this application, it should be understood that the disclosed methods can also be implemented in other ways. The embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0131] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0132] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0133] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An API request filtering method, characterized in that, Used in proxy servers; The method includes: In response to an HTTP request sent by a client, the index field and multiple parameters in the API request included in the HTTP request are extracted, including: in response to an HTTP request sent by a client, the PATH field information and multiple GET parameters and multiple POST parameters in the API request included in the HTTP request are extracted; the PATH field information is used as an index field; wherein, the multiple parameters include multiple GET parameters and multiple POST parameters; A data table is generated based on the index field and each of the parameters; The data table is analyzed to obtain the data information for each parameter; The index field, data table, and data information of each parameter are used as filtering feature information; The API request is filtered based on the filtering feature information, so that the HTTP request containing the filtered API request is forwarded to the API server. After receiving the HTTP request containing the filtered API request, the API server sends the response packet to the client through the proxy server.

2. The API request filtering method according to claim 1, characterized in that, The step of generating a data table based on the index field and each of the parameters includes: Combine all the GET and POST parameters of the fields into a list. The list information is stored in a data table that uses the index field as the index of the data table to generate a data table.

3. The API request filtering method according to claim 1, characterized in that, The data information includes data types; The step of analyzing the data table to obtain the data information of each parameter includes: The data table is analyzed at preset time intervals to obtain the field GET parameter name corresponding to the GET parameter of each field in the data table and the field POST parameter name corresponding to the POST parameter of each field. Determine one by one whether the GET parameter name corresponding to the GET parameter of each field is the same as the POST parameter name corresponding to the POST parameter of each field; The data type of each parameter is calculated by merging multiple GET parameters and POST parameters with the same GET parameter name and POST parameter name.

4. The API request filtering method according to claim 3, characterized in that, After the step of merging multiple GET parameters and POST parameters with the same GET parameter name and POST parameter name to calculate the data type of each parameter, the method further includes: Based on the data type of each parameter, obtain the data constraint information of each parameter under the corresponding data type; The data type and data constraint information of each parameter are used as the data information of each parameter.

5. The API request filtering method according to claim 4, characterized in that, The data types of each parameter include integer type, enumeration type, and character type; The step of obtaining the data constraint information of each parameter under the corresponding data type according to the data type of each parameter includes: When multiple parameters are of integer type, the range of parameter values ​​for each parameter under the corresponding integer type is obtained; When the data type of multiple parameters is an enumeration type, the enumeration string information and enumeration string length information of the multiple parameters under the corresponding enumeration type are obtained; When multiple parameters are of character type, the string length information of the multiple parameters under the corresponding character type is obtained.

6. The API request filtering method according to claim 4, characterized in that, The preset duration is one day.

7. An API request filtering device, characterized in that, Used in proxy servers; The device includes: The information extraction module is used to extract an index field and multiple parameters from the API request included in the HTTP request in response to an HTTP request sent by the client, including: extracting the PATH field information and multiple GET parameters and multiple POST parameters from the API request included in the HTTP request in response to an HTTP request sent by the client; using the PATH field information as an index field; wherein, the multiple parameters include multiple GET parameters and multiple POST parameters; An information processing module is used to generate a data table based on the index field and each of the parameters; analyze the data table to obtain data information for each of the parameters; and use the index field, the data table, and the data information for each of the parameters as filtering feature information. The filtering module is used to filter the API request based on the filtering feature information, so as to forward the HTTP request containing the filtered API request to the API server, so that after the API server receives the HTTP request containing the filtered API request, it sends the response packet to the client through the proxy server.

8. A proxy server, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is used to execute the computer program to implement the API request filtering method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the API request filtering method as described in any one of claims 1-6.