Application programming interface risk detection method, device, equipment and medium

By analyzing the API interface call log and combining field deviation detection and box graph, the API risk detection steps are simplified, and the cumbersome problems of API risk detection in the existing technology are solved, reducing costs and improving accuracy.

CN113360916BActive Publication Date: 2024-11-26QI AN XIN TECHNOLOGY GROUP INC +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110682804.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-18
Publication Date
2024-11-26
Estimated Expiration
2041-06-18

AI Technical Summary

Technical Problem

In the prior art, API risk detection steps are cumbersome, consuming a lot of manpower and material costs, and it is difficult to simplify.

Method used

By analyzing the API's interface call log, determining the risk category to be detected, filtering out the field values ​​of the target field, and determining whether there is an abnormality in the field value. Combining field deviation detection and box graph methods is used to improve detection accuracy and simplify risk detection steps .

Benefits of technology

It has achieved simplification of API risk detection, reduced labor and material costs, improved detection accuracy, and avoided missed detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113360916B_ABST
    Figure CN113360916B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of network security technology, and discloses a risk detection method, device, equipment and medium for an application programming interface. The method includes determining the risk category to be detected; filtering out the field value of the target field corresponding to the risk category from the interface call log of the application programming interface within a preset time range; if there is an abnormal field value in the field value, it is determined that the application programming interface has a risk. In this way, risk detection of different risk categories can be performed through the API interface call log, which simplifies the cumbersome operation of risk detection and reduces the manpower and material costs consumed by risk detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, and more specifically, to a risk detection method, apparatus, device and medium for an application programming interface. Background Art

[0002] With the development of IoT technology, the application scope of applications is becoming more and more extensive. For example, applications are widely used in banking, retail, transportation, self-driving cars, and smart cities.

[0003] Among them, the Application Programming Interface (API) is a key component of the application. By calling the API provided by the platform, the application can share data with the platform and use the functions provided by the platform.

[0004] Under the existing technology, API security issues are usually avoided through API gateways. However, this requires deploying API gateways in the system and designing different security mechanisms for different API security issues. The operation steps are cumbersome and will consume a lot of manpower and material costs.

[0005] Therefore, when conducting risk detection on APIs, how to simplify the cumbersome steps of API risk detection and reduce the manpower and material costs is a technical problem that needs to be solved. Summary of the invention

[0006] The purpose of the embodiments of the present application is to provide a risk detection method, device, equipment and medium for an application programming interface, so as to simplify the cumbersome steps of API risk detection and reduce the manpower and material costs when performing risk detection on the API.

[0007] In one aspect, a risk detection method for an application programming interface is provided, comprising:

[0008] Identify the risk categories to be tested;

[0009] Filter out the field values ​​of the target fields corresponding to the risk categories from the interface call logs of the application programming interface within a preset time range;

[0010] If there are abnormal field values ​​in the field values, it is determined that there is a risk in the application programming interface.

[0011] In the above implementation process, risk detection is performed only by calling the log through the API interface, which simplifies the tedious operation of risk detection and reduces the manpower and material costs consumed by risk detection.

[0012] Preferably, the risk categories include any one or any combination of the following:

[0013] Identity authentication risk, resource restriction risk, resource authorization risk, and function authorization risk;

[0014] The target fields corresponding to the identity authentication risk include at least: the number of identity authentication failures;

[0015] The target field corresponding to the resource limit risk includes at least one of the following: resource request rate and resource request times;

[0016] The target fields corresponding to resource authorization risks include at least: the number of resource accesses;

[0017] The target fields corresponding to the function authorization risk include at least: the number of function calls.

[0018] In the above implementation process, different risk categories and target fields required for risk detection are set according to the actual application scenarios.

[0019] Preferably, there are multiple field values. If there are abnormal field values ​​among the field values, it is determined that there are risks in the application programming interface, including:

[0020] Determine the mean and standard deviation of multiple field values ​​of the target field;

[0021] Based on each field value, mean value, and standard deviation of the target field, determine whether there are abnormal field values;

[0022] If so, it is determined that an abnormal field value exists and that the application programming interface is at risk;

[0023] Otherwise, a box plot method is used to determine whether there are abnormal field values ​​in the field values ​​of the target field, and if it is determined that there are abnormal field values, it is determined that there is a risk in the application programming interface.

[0024] In the above implementation process, the method of detecting risks by field deviation is combined with the box plot method, which improves the accuracy of risk detection and avoids the problem of missed risk detection.

[0025] Preferably, judging whether there are abnormal field values ​​based on each field value, average value, and standard deviation of the target field includes:

[0026] Filter out the field values ​​that meet the preset filtering conditions from multiple field values ​​of the target field;

[0027] Determine the absolute value of the difference between each filtered field value and the average value;

[0028] Determine the corresponding field deviation based on each absolute value and standard deviation;

[0029] If it is determined that there is a field deviation within a preset abnormal deviation range among the field deviations, it is determined that there is an abnormal field value; otherwise, it is determined that there is no abnormal field value.

[0030] In the above implementation process, abnormal field values ​​in each field value can be screened out according to the field deviation.

[0031] Preferably, from the multiple field values ​​of the target field, field values ​​that meet the preset screening conditions are screened out, including:

[0032] Filter out a specified number of field values ​​from multiple field values ​​of the target field, where the minimum value of the filtered field values ​​is not less than the maximum value of the unfiltered field values;

[0033] Alternatively, a specified number of field values ​​are filtered out from multiple field values, wherein the maximum value among the filtered field values ​​is not greater than the minimum value among the unfiltered field values.

[0034] In the above implementation process, the field values ​​are screened, thereby reducing the amount of data processing and improving the data processing speed.

[0035] Preferably, the interface call log includes: an application programming interface access log and an application programming interface authentication log; the method further includes:

[0036] Based on the information in the application programming interface authentication log, the application programming interface access log is associated with the object that calls the application programming interface access log.

[0037] Preferably, the identity authentication risk refers to the risk of abnormal authentication during user identity authentication;

[0038] Resource limitation risk refers to the risk of overload when resources are called;

[0039] Resource authorization risk refers to the risk of unauthorized calls when resources are called;

[0040] Function authorization risk refers to the risk of unauthorized calls when a function is called.

[0041] In the above implementation process, different security issues can be detected through different categories of risks.

[0042] In one aspect, a risk detection device for an application programming interface is provided, comprising:

[0043] A first determination unit, used to determine a risk category to be detected;

[0044] A screening unit, used to screen out field values ​​of target fields corresponding to risk categories from the interface call logs of the application programming interface within a preset time range;

[0045] The second determining unit is used to determine that there is a risk in the application programming interface if there is an abnormal field value in the field value.

[0046] Preferably, the risk categories include any one or any combination of the following:

[0047] Identity authentication risk, resource restriction risk, resource authorization risk, and function authorization risk;

[0048] The target fields corresponding to the identity authentication risk include at least: the number of identity authentication failures;

[0049] The target field corresponding to the resource limit risk includes at least one of the following: resource request rate and resource request times;

[0050] The target fields corresponding to resource authorization risks include at least: the number of resource accesses;

[0051] The target fields corresponding to the function authorization risk include at least: the number of function calls.

[0052] Preferably, the field value is multiple, and the second determining unit is used for:

[0053] Determine the mean and standard deviation of multiple field values ​​of the target field;

[0054] Based on each field value, mean value, and standard deviation of the target field, determine whether there are abnormal field values;

[0055] If so, it is determined that an abnormal field value exists and that the application programming interface is at risk;

[0056] Otherwise, a box plot method is used to determine whether there are abnormal field values ​​in the field values ​​of the target field, and if it is determined that there are abnormal field values, it is determined that there is a risk in the application programming interface.

[0057] Preferably, the second determining unit is used to: filter out field values ​​that meet preset filtering conditions from multiple field values ​​of the target field;

[0058] Determine the absolute value of the difference between each filtered field value and the average value;

[0059] Determine the corresponding field deviation based on each absolute value and standard deviation;

[0060] If it is determined that there is a field deviation within a preset abnormal deviation range among the field deviations, it is determined that there is an abnormal field value; otherwise, it is determined that there is no abnormal field value.

[0061] Preferably, the second determining unit is used to: filter out a specified number of field values ​​from a plurality of field values ​​of the target field, wherein a minimum value among the filtered field values ​​is not less than a maximum value among the unfiltered field values;

[0062] Alternatively, a specified number of field values ​​are filtered out from multiple field values, wherein the maximum value among the filtered field values ​​is not greater than the minimum value among the unfiltered field values.

[0063] Preferably, the interface call log includes: an application programming interface access log and an application programming interface authentication log; the second determination unit is further used for:

[0064] Based on the information in the application programming interface authentication log, the application programming interface access log is associated with the object that calls the application programming interface access log.

[0065] Preferably, the identity authentication risk refers to the risk of abnormal authentication during user identity authentication;

[0066] Resource limitation risk refers to the risk of overload when resources are called;

[0067] Resource authorization risk refers to the risk of unauthorized calls when resources are called;

[0068] Function authorization risk refers to the risk of unauthorized calls when a function is called.

[0069] On the one hand, an electronic device is provided, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the method provided in various optional implementations of risk detection of any of the above-mentioned application programming interfaces are executed.

[0070] On the one hand, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method provided in various optional implementations of risk detection of any of the above-mentioned application programming interfaces are executed.

[0071] In the risk detection method, device, equipment and medium of the application programming interface provided in the embodiment of the present application, the risk category to be detected is determined; the field value of the target field corresponding to the risk category is screened out from the interface call log of the application programming interface within a preset time range; if there is an abnormal field value in the field value, it is determined that the application programming interface has a risk. In this way, risk detection of different risk categories can be performed through the API interface call log, which simplifies the tedious operation of risk detection and reduces the manpower and material costs consumed by risk detection.

[0072] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0074] Figure 1 A flowchart of a method for risk detection of an application programming interface provided in an embodiment of the present application;

[0075] Figure 2 An implementation flow chart of an identity authentication risk detection method provided in an embodiment of the present application;

[0076] Figure 3 A flowchart of an implementation method of a resource limitation risk detection method provided in an embodiment of the present application;

[0077] Figure 4 A flowchart of a resource authorization risk detection method provided in an embodiment of the present application;

[0078] Figure 5 A flowchart of an implementation method of a function authorization risk detection method provided in an embodiment of the present application;

[0079] Figure 6 A flowchart of a risk detection and alarm method provided in an embodiment of the present application;

[0080] Figure 7 A structural block diagram of an API risk detection device provided in an embodiment of the present application;

[0081] Figure 8 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0082] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0083] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0084] First, some terms involved in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.

[0085] Terminal device: can be a mobile terminal, a fixed terminal or a portable terminal, such as a mobile phone, a station, a unit, a device, a multimedia computer, a multimedia tablet, an Internet node, a communicator, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a personal communication system device, a personal navigation device, a personal digital assistant, an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an electronic book device, a gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof. It is also foreseeable that the terminal device can support any type of interface for the user (such as a wearable device), etc.

[0086] Server: It can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.

[0087] API: is a set of definitions, programs and protocols, whose main function is to provide a common set of functions. For example, an application can call the API provided by the platform to make the platform execute the application's commands (actions) to achieve a certain function without having to develop the application to achieve the function.

[0088] In order to simplify the cumbersome steps of API risk detection and reduce the manpower and material costs when performing risk detection on API, the embodiments of the present application provide a risk detection method, device, equipment and medium for application programming interface.

[0089] In the embodiment of the present application, the execution subject may be an electronic device, and optionally, the electronic device may be a server or a terminal device, which is not limited here. In one embodiment, the electronic device is a server whose operating environment is based on the X86 architecture, and the software system version of the server is Centos7.4 1708 version, python3.6.

[0090] See also Figure 1 As shown, it is an implementation flow chart of a risk detection method of an application programming interface provided in an embodiment of the present application. The specific implementation process of the method is as follows:

[0091] Step 100: Determine the risk category to be detected.

[0092] Specifically, the risk category to be detected may be a default setting or may be determined according to a user's instruction.

[0093] In one implementation, a risk category to be detected selected by a user from among various risk categories is obtained.

[0094] Among them, the risk categories may include any one or any combination of the following: Broken Authentication risk, resource restriction risk, resource authorization risk (Broken Object Level Authorization, BOLA) and function authorization risk (Broken Function Level Authorization, BFLA).

[0095] Among them, identity authentication risk refers to the risk of abnormal authentication when a user performs identity authentication.

[0096] For example, when a user authenticates through the authentication API to log in to the platform, attackers may try to log in by guessing the user's password. Therefore, if the authentication API is called multiple times by the same user in a short period of time, there may be an authentication risk.

[0097] Resource limitation risk refers to the risk of overload when resources are called.

[0098] For example, when making resource requests through an API, attackers may occupy too many service resources of the platform through a large number of API requests, making it impossible for legitimate users to get a service response, thus launching a Denial of Service (DoS) attack on the platform. Therefore, if a large number of requests are made through the API in a short period of time, there may be a risk of resource limitation.

[0099] Resource authorization risk refers to the risk of unauthorized calls when resources are called.

[0100] For example, when accessing resources through an API, attackers may use unauthorized resource names to illegally call unauthorized resources. Therefore, if the number of resource accesses by a user calling an API to access a specified resource is much lower than the corresponding resource accesses of other users, there may be a resource authorization risk.

[0101] Function authorization risk refers to the risk of unauthorized calls when a function is called.

[0102] For example, since the APIs of some management functions are public, or the API parameters of API function calls may be predicted, ordinary users may illegally call specified functions that only administrators have the right to call through predicted API parameters without authorization. Therefore, if the number of function calls made by a user through API calls to specify functions is much lower than the number of corresponding function calls made by other users, there may be a risk of function authorization.

[0103] In actual applications, risk categories can also be set according to actual application scenarios and are not restricted here.

[0104] In this way, different risk categories can be set according to different API risk issues, so that in subsequent steps, different target fields can be set for different risk categories to perform corresponding risk detection.

[0105] Step 101: Filter out the field value of the target field corresponding to the risk category from the interface call log of the application programming interface within a preset time range.

[0106] Specifically, the field value of the target field corresponding to the risk category to be detected is filtered out from the interface call log of the user calling the API within a preset time range.

[0107] In one implementation, when filtering out the field value of the target field corresponding to the risk category, the following steps may be used:

[0108] S1011: Obtaining, from a log storage device, an interface call log of a user calling an API within a preset time range.

[0109] Optionally, the log storage device can be a search server (ElasticSearch, ES) or other device. The interface call log can be obtained periodically or in real time, or when a log acquisition instruction is received. The number of users can be one or more, and the number of application programming interfaces can be one or more, and there is no limitation here.

[0110] In actual applications, the preset time range can be set according to the actual application scenario. For example, the preset time range can be 1 day, 1 week, 1 month, etc., and is not limited here.

[0111] In this way, you can select interface call logs for risk detection according to the preset time range.

[0112] S1012: Obtain a target field set for the risk category to be detected.

[0113] Specifically, the target field corresponding to the identity authentication risk includes at least: the number of identity authentication failures.

[0114] The target field corresponding to the resource limit risk includes at least one of the following: resource request rate and resource request times.

[0115] The target field corresponding to the resource authorization risk includes at least: the number of resource access times.

[0116] The target fields corresponding to the function authorization risk include at least: the number of function calls.

[0117] In the embodiment of the present application, the target field corresponding to the risk category is taken as the above-mentioned field as an example for explanation. In actual applications, the target field corresponding to the risk category may also be other fields. The number of target fields set corresponding to each risk category may be one or more, and there is no limitation here.

[0118] The interface call log includes: application programming interface access log (API access log) and application programming interface authentication log (API authentication log). The API access log contains the field value of the target field during the API call process, and the API authentication log contains the object that called the API during the API call process.

[0119] In one embodiment, before executing step 101, the API access log can also be associated with the object that calls the API access log based on the information in the API authentication log, that is, an association relationship is established between the API calling object and the field value of the target field in the API calling process, so that the risk of a specific object calling the API can be easily detected.

[0120] In this way, the target fields for risk detection can be obtained.

[0121] S1013: Extracting the field value of the target field from each interface call log.

[0122] Specifically, the target field can be understood as a parameter variable set for risk, and the field value can be understood as the actual value of the target field obtained, that is, the variable value of the parameter variable. For example, the parameter variable is x and the parameter value is 9.

[0123] In the embodiment of the present application, the number of field values ​​is taken as an example for description. In actual applications, the number of field values ​​can be one.

[0124] Furthermore, the extracted field value of the target field and the corresponding object association may be stored in a database.

[0125] Optionally, the database may be a reference database or a database constructed by the user. Different databases may be used for different data types.

[0126] In this way, after determining the risk category to be detected, data used to determine whether the API has the risk category to be detected can be filtered out from the interface call log, and the filtered data can be stored in the database.

[0127] Step 102: If there are abnormal field values ​​in the field values, it is determined that there is a risk in the application programming interface.

[0128] Specifically, when executing step 102, the following steps may be adopted:

[0129] S1021: Determine the average value and standard deviation of multiple field values ​​of the target field.

[0130] Specifically, for each target field, perform the following steps:

[0131] Determine the mean and standard deviation of multiple field values ​​for a target field.

[0132] Furthermore, subsequent API risk judgment can be performed only for designated objects. Field values ​​of designated users can be first screened out from multiple field values ​​of a target field, and then the average value and standard deviation of the screened multiple field values ​​can be determined.

[0133] In this way, the mean and standard deviation of the field values ​​can be determined.

[0134] S1022: Based on each field value, average value and standard deviation of the target field, determine whether there is an abnormal field value. If so, execute S1023; otherwise, execute S1024.

[0135] Specifically, when executing S1022, the following steps may be adopted:

[0136] Step a: Filter out the field values ​​that meet the preset filter conditions from the multiple field values ​​of the target field.

[0137] Specifically, when executing step a, any of the following methods may be used:

[0138] Method 1: Filter out a specified number of field values ​​from multiple field values ​​of the target field. The minimum value of the filtered field values ​​must not be less than the maximum value of the unfiltered field values.

[0139] For example, assuming the specified number is 2, since it is necessary to satisfy that the minimum value of the filtered field values ​​is not less than the maximum value of the unfiltered field values, it can be determined that from the multiple field values ​​(5, 6, 7, 8, 9, 10) of the target field, two field values ​​with larger values ​​are filtered out, that is, 9 and 10 are filtered out. After verification, it can be satisfied that the minimum value 9 of the filtered field values ​​is not less than the maximum value 8 of the unfiltered field values.

[0140] It should be noted that the greater the number of identity authentication failures, the greater the possibility of identity authentication risks, and the greater the resource request rate or the number of resource requests, the greater the possibility of resource limitation risks. Therefore, when detecting identity authentication risks and resource limitation risks, method 1 can be used to filter field values.

[0141] Method 2: Filter out a specified number of field values ​​from multiple field values ​​of the target field. The maximum value of the filtered field values ​​must not be greater than the minimum value of the unfiltered field values.

[0142] For example, assuming the specified number is 2, since it is necessary to satisfy that the maximum value of the filtered field values ​​is not greater than the minimum value of the unfiltered field values, it can be determined that from the multiple field values ​​(5, 6, 7, 8, 9, 10) of the target field, two field values ​​with smaller values ​​are filtered out, that is, 5 and 6 are filtered out. After verification, it can satisfy that the maximum value 6 of the filtered field values ​​is not greater than the minimum value 7 of the unfiltered field values.

[0143] Optionally, the specified quantity may be one or more, and may be a fixed setting or determined according to user instructions.

[0144] It should be noted that, under normal circumstances, if it is determined that there is an abnormal field value, that is, an outlier, among multiple field values, it can be determined that there is a risk. Therefore, the specified number can be 1. In this way, the data processing efficiency is relatively high. Furthermore, in order to improve the accuracy of risk detection, it is also possible to determine whether there is a risk through multiple or all field values. Therefore, the specified number can be set according to the actual application scenario, and there is no restriction here.

[0145] In actual applications, the preset filtering conditions may also be other filtering conditions set according to actual application scenarios, which are not limited here.

[0146] It should be noted that the smaller the number of resource accesses, the greater the possibility of resource authorization risks, and the smaller the number of function calls, the greater the possibility of function authorization risks. Therefore, when detecting resource authorization risks and function authorization risks, the above method 2 can be used to screen field values.

[0147] Step b: Determine the absolute value of the difference between each screened field value and the average value.

[0148] Step c: Determine the corresponding field deviation based on each absolute value and standard deviation.

[0149] Among them, the field deviation is positively correlated with the absolute value and negatively correlated with the standard deviation.

[0150] In one implementation, the field deviation is the ratio of the absolute value to the standard deviation.

[0151] Step d: If it is determined that there is a field deviation in the preset abnormal deviation range among the field deviations, execute S1023; otherwise, execute S1024.

[0152] In actual applications, the preset abnormal deviation range can be set according to the actual application scenario. For example, the preset abnormal deviation range is that the field deviation is greater than 10, which is not limited here.

[0153] S1023: Determine that there are abnormal field values ​​and that there are risks in the application programming interface.

[0154] S1024: Use a box plot method to determine whether there is an abnormal field value in the field value of the target field. If so, execute S1025; otherwise, execute S1026.

[0155] S1025: Determine that there are abnormal field values ​​and determine that there are risks in the application programming interface.

[0156] S1026: Determine that there are no abnormal field values ​​and determine that there are no risks in the application programming interface.

[0157] It should be noted that the method of judging whether there are abnormal field values ​​through field deviation is mainly used to detect field values ​​that conform to the normal distribution. For example, the method of using field deviation to detect abnormal field values ​​can be applied to the anti-fraud field, such as whether the user payment amount is abnormal, whether the user payment frequency is abnormal, and whether the number of purchases of specific products is abnormal.

[0158] Therefore, if it is determined that there are no abnormal field values, it may be that there is indeed no risk, or it may be that the distribution of the field values ​​does not conform to the normal distribution, resulting in the failure to detect the actual abnormal field values. Since the box plot can be used to detect both normally and non-normally distributed data, in the embodiment of the present application, when it is determined by field deviation that there are no abnormal field values, the box plot can be further used to perform risk detection again. In this way, the method of detecting abnormal field values ​​using field deviation is combined with the method of detecting abnormal field values ​​using box plot, which improves the accuracy of abnormal field value detection and reduces the risk of missed detection of abnormal field values.

[0159] Furthermore, when performing risk detection, only one of the above two methods may be used for detection, or it may be determined in advance whether the data group to be detected conforms to the normal distribution, and then a suitable detection method may be further selected, which is not limited here.

[0160] Furthermore, the associated information such as the user who called the API and the calling time can be determined based on the abnormal field value, and the abnormal field value and the associated information can be written into a message queue, such as a Kafka message queue, and an alarm can be sent to the administrator through the message queue.

[0161] Furthermore, steps 100 to 102 may be performed after periodic dormancy according to a preset trigger time, thereby enabling periodic risk detection of the API.

[0162] Among them, the preset trigger time can be a default setting, or can be set according to user instructions. For example, the preset trigger time is 1 day, which is not limited here.

[0163] In the embodiment of the present application, there is no need to install an API gateway, nor is there a need to add specific API security policies to the API. All that is needed is to analyze the API interface call logs to detect risks of various risk categories, and to locate the associated API caller and detailed associated information such as the call time when it is determined that there is a risk. The risk detection results containing abnormal field values, associated information, and risk categories can be sent to management personnel for risk alerts, so that management personnel can conduct further API risk confirmation and API repair, etc., thereby improving the security of API calls. Furthermore, a preset trigger time can be configured according to the actual application scenario, and risk detection can be performed periodically to achieve risk monitoring of the API. Furthermore, thresholds such as preset abnormal deviation ranges can also be adjusted according to the actual application scenario, and the field deviation detection and box plot detection methods are combined to improve the accuracy of risk detection.

[0164] The following uses multiple application scenarios to further explain in detail the method for determining abnormal field values ​​using field deviations of field values ​​in the above embodiment.

[0165] Scenario 1: Identity authentication risk detection scenario. Figure 2 The figure shows an implementation flow chart of an identity authentication risk detection method. The specific implementation process of the method is as follows:

[0166] Step 200: Determine that the risk category to be detected is identity authentication risk.

[0167] Step 201: Determine that the target field corresponding to the identity authentication risk is the number of identity authentication failures.

[0168] Step 202: Obtain the API interface call log within a preset time range.

[0169] Step 203: Filter out multiple field values ​​corresponding to the number of identity authentication failures from the interface call log.

[0170] Furthermore, based on the association between the user and the multiple field values ​​corresponding to the number of identity authentication failures, it is also possible to filter out the multiple field values ​​corresponding to the number of identity authentication failures when the specified user calls the API for identity authentication, so as to detect in subsequent steps whether there is an identity authentication risk when the specified user calls the API for identity authentication.

[0171] In one embodiment, before executing step 203, the API access log contains a field value of the number of identity authentication failures during the API call process, and the API authentication log contains the user who called the API during the API call process, and an association is established between the user who called the API and the field value of the corresponding number of identity authentication failures.

[0172] Step 204: Determine the average value and standard deviation of multiple field values ​​of the number of identity authentication failures.

[0173] Step 205: Filter out field values ​​that meet preset filtering conditions from multiple field values ​​of the number of identity authentication failures.

[0174] The minimum value of the filtered field values ​​must not be less than the maximum value of the unfiltered field values.

[0175] In one implementation, a maximum field value is screened out from multiple field values ​​of the number of identity authentication failures.

[0176] Step 206: Determine the corresponding field deviation according to each of the screened field values, the average value and the standard deviation.

[0177] Step 207: If it is determined that there is a field deviation within a preset abnormal deviation range among the field deviations, it is determined that there is an abnormal field value, and it is determined that there is an identity authentication risk in the API.

[0178] Table 1

[0179]

[0180] For example, see Table 1, which is a statistical table of the number of authentication failures for a user. Table 1 shows the field values ​​in the interface call log of the user accessing the " / auth" API, including the date, time, and number of authentication failures. The date (day) is day1, day2, etc. The whole day is divided into 7 time periods, 00:00-05:59, 06:00-08:00, etc., and aij is the number of authentication failures in the jth time period on the i-th day. i is the date, and j is the time period. Assuming that the preset time range is 00:00-05:59 every day, a11, a21, a31, etc. are filtered out, and the maximum value a31 in the group of data is determined to be an abnormal field value, which means that there is an authentication risk. Further, the maximum value a31 is written into the database.

[0181] In this way, it can be determined whether there is an authentication risk.

[0182] It should be noted that when executing step 200 to step 207, the specific steps refer to the above-mentioned step 100 to step 102, which will not be repeated here.

[0183] Scenario 2: Resource limitation risk detection scenario. Figure 3 As shown, it is an implementation flow chart of a resource limitation risk detection method. The specific implementation process of the method is as follows:

[0184] Step 300: Determine that the risk category to be detected is a resource limitation risk.

[0185] Step 301: Determine that the target field corresponding to the resource limitation risk is the resource request rate.

[0186] Step 302: Obtain the API interface call log within a preset time range.

[0187] Step 303: Filter out multiple field values ​​corresponding to the resource request rate from the interface call log.

[0188] Furthermore, based on the association between the user and the multiple field values ​​corresponding to the resource request rate, multiple field values ​​corresponding to the resource request rate when the specified user calls the API to make a resource request can be filtered out, so that in the subsequent steps, it is detected whether there is a resource limitation risk when the specified user calls the API to make a resource request.

[0189] In one embodiment, before executing step 303, the API access log contains the field value of the resource request rate during the API call process, and the API authentication log contains the user who calls the API during the API call process, and an association is established between the user who calls the API and the field value of the corresponding resource request rate.

[0190] In this way, the user who calls the API each time and the corresponding field value of the resource request rate can be determined.

[0191] Step 304: Determine the average value and standard deviation of multiple field values ​​of the resource request rate.

[0192] Step 305: Filter out field values ​​that meet preset filtering conditions from multiple field values ​​of resource request rates.

[0193] The minimum value of the filtered field values ​​must not be less than the maximum value of the unfiltered field values.

[0194] In one implementation, a maximum field value is screened out from multiple field values ​​of the resource request rate.

[0195] Step 306: Determine the corresponding field deviation according to each of the screened field values, the average value and the standard deviation.

[0196] Step 307: If it is determined that there is a field deviation in the preset abnormal deviation range among the field deviations, it is determined that there is an abnormal field value, and it is determined that there is a resource limitation risk for the API.

[0197] Table 2

[0198]

[0199] For example, see Table 2, which is an example table of resource request rates for a user. Table 2 shows the field values ​​in the interface call log of the user accessing the " / mainpage" API, including date, time, and number of authentication failures. The date (day) is day1, day2, etc. The whole day is divided into 7 time periods, 00:00-05:59, 06:00-08:00, etc., and bij / h is the resource request rate in the jth time period on the i-th day. The resource request rate is the number of resource requests for the API per hour, i is the date, j is the time period, and h is the hour. Assuming that the preset time range is 00:00-05:59 every day, the resource request rates screened out from Table 2 are b11 / h, b21 / h, and b31 / h, respectively. The maximum value b31 / h in this group of data is determined to be an abnormal field value, and it is determined that there is a risk of resource limitation.

[0200] It should be noted that when executing step 300 to step 307, the specific steps refer to the above-mentioned step 100 to step 102, which will not be repeated here.

[0201] Scenario 3: Resource authorization risk detection scenario. Figure 4 The figure shows an implementation flow chart of a resource authorization risk detection method. The specific implementation process of the method is as follows:

[0202] Step 400: Determine that the risk category to be detected is resource authorization risk.

[0203] Step 401: Determine that the target field corresponding to the resource authorization risk is the number of resource accesses.

[0204] Step 402: Obtain the API call log within a preset time range.

[0205] Step 403: Filter out multiple field values ​​corresponding to resource access times from the interface call log.

[0206] Specifically, according to the interface call log, the user who calls the API, the resources accessed through the API and the field values ​​of the resource access times are determined, and an association relationship among the user, the resource and the field values ​​of the resource access times is established.

[0207] If the number of target resources is one, then according to the above association relationship, multiple field values ​​corresponding to the number of resource accesses of each user accessing the target resource through the API.

[0208] If there are multiple target resources, the following steps may be performed for each target resource respectively: according to the above association relationship, multiple field values ​​corresponding to one target resource are determined.

[0209] In this way, in the subsequent steps, after determining that there are abnormal field values ​​in the field values ​​of any target resource, the abnormal user associated with the any target resource and the abnormal field value can be determined based on the above-mentioned association relationship, thereby determining that there is a resource authorization risk when the abnormal user accesses any target resource through the API.

[0210] It should be noted that the above association relationship may also be executed before executing step 403, which is not limited here.

[0211] Step 404: Determine the average value and standard deviation of multiple field values ​​of resource access times.

[0212] Step 405: Filter out field values ​​that meet preset filtering conditions from multiple field values ​​of resource access times.

[0213] The maximum value of the filtered field values ​​is not greater than the minimum value of the unfiltered field values.

[0214] In one implementation, a minimum field value is screened out from multiple field values ​​of resource access times.

[0215] Step 406: Determine the corresponding field deviation according to each of the screened field values, the average value and the standard deviation.

[0216] Step 407: If it is determined that there is a field deviation within a preset abnormal deviation range among the field deviations, it is determined that there is an abnormal field value, and it is determined that there is a resource authorization risk in the API.

[0217] Table 3

[0218]

[0219] See Table 3, which is an example table of user resource access times. In Table 3, the field value of the resource access times of each user (user) calling the API to access each resource includes resource (resource), resource access times (times) and user identification information. Resources include resource 1, resource 2, and so on.

[0220] For example, assuming that the target resource is resource 1, and the preset abnormal deviation range is less than 10, then in Table 3, a group of data for accessing resource 1 is times11, times12, etc., and the minimum value of the number of accesses in this group of data is determined to be times11. Then, according to times11, times12, etc., it is determined that the deviation of the field corresponding to times11 is 5<10, and the number of resource accesses times11 of user user11 accessing resource 1 in this group of data is abnormal, and it is determined that there is a resource authorization risk for resource 1, and then the abnormal related information is written into the database.

[0221] It should be noted that when executing step 400 to step 407, the specific steps refer to the above-mentioned step 100 to step 102, which will not be repeated here.

[0222] Scenario 4: Function authorization risk detection scenario. Figure 5 The figure shows an implementation flow chart of a function authorization risk detection method. The specific implementation process of the method is as follows:

[0223] Step 500: Determine that the risk category to be detected is a function authorization risk.

[0224] Step 501: Determine that the target field corresponding to the function authorization risk is the number of function calls.

[0225] Step 502: Obtain the API interface call log within a preset time range.

[0226] Step 503: Filter out multiple field values ​​corresponding to the function call times from the interface call log.

[0227] In one implementation, based on the interface call log, the user who calls the API, the function called through the API and the field values ​​of the function call times are determined, and an association relationship is established among the user, the target function and the field values ​​of the function call times.

[0228] If the number of target functions is 1, multiple field values ​​corresponding to the number of function calls for each user to access the target function through the API are determined based on the above association relationship.

[0229] If there are multiple target functions, the following steps can be performed for each target function respectively: based on the above association relationship, multiple field values ​​corresponding to one target function are determined.

[0230] In this way, in the subsequent steps, after determining that there are abnormal field values ​​in the field values ​​of any target function, the abnormal user associated with any target function and the abnormal field value can be determined based on the above-mentioned association relationship, thereby determining that there is a function authorization risk when the abnormal user calls any target function through the API.

[0231] It should be noted that the above association relationship may also be executed before executing step 503, which is not limited here.

[0232] Step 504: Determine the average value and standard deviation of multiple field values ​​of the function call times.

[0233] Step 505: Filter out field values ​​that meet preset filtering conditions from multiple field values ​​of the function call times.

[0234] The maximum value of the filtered field values ​​is not greater than the minimum value of the unfiltered field values.

[0235] In one implementation, the minimum field value is screened out from multiple field values ​​of the function call times.

[0236] Step 506: Determine the corresponding field deviation according to each of the screened field values, the average value and the standard deviation.

[0237] Step 507: If it is determined that there is a field deviation within a preset abnormal deviation range among the field deviations, it is determined that there is an abnormal field value, and it is determined that there is a functional authorization risk in the API.

[0238] Table 4

[0239]

[0240] See Table 4, which is an example table of the number of function calls by users through API calls. Table 4 includes functions, function call times (times), and user identification information (user). The functions are: GET, POST, and PUT. The function call timeskL is the number of resource accesses by user L to resource K.

[0241] For example, assuming that the target function is POST, the preset abnormal deviation range is less than 10. In Table 3, a group of data using POST is times21, times22, etc., and the minimum value of the number of function calls in this group of data is times21. Then, according to times21, times22, etc., it is determined that the deviation of the corresponding field of times21 is 5<10, and it is determined that times21 in this group of data is an abnormal field value, that is, it is determined that the number of function calls of user user21 calling POST is abnormal, and it is determined that POST has a function authorization risk, and then the abnormal related information is written into the database.

[0242] See also Figure 6 As shown, it is an implementation flow chart of a risk detection and alarm method provided in an embodiment of the present application. The specific implementation process of the method is as follows:

[0243] Step 600: Determine whether a preset trigger time has been reached.

[0244] Step 601: Obtain unprocessed interface call logs from a log storage device.

[0245] Step 602: extracting the field value of the target field set for the risk category to be detected from each interface call log.

[0246] Furthermore, the extracted interface call logs and field values ​​are stored in a reference database.

[0247] Step 603: Determine abnormal field values ​​among the field values.

[0248] Furthermore, the determined abnormal field values ​​and related information are stored in a risk database.

[0249] Step 604: Determine the risk detection result according to the determined abnormal field value.

[0250] Step 605: Add the risk detection results and abnormal field values ​​to the Kafka message queue.

[0251] Step 606: Send an alarm to the management personnel through the Kafka message queue, and execute step 600.

[0252] Based on the same inventive concept, an API risk detection device is also provided in an embodiment of the present application. Since the principle of solving the problem by the above-mentioned device and equipment is similar to a method of API risk detection, the implementation of the above-mentioned device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0253] like Figure 7 As shown, it is a schematic diagram of the structure of an API risk detection device provided in an embodiment of the present application, including:

[0254] A first determining unit 701 is used to determine a risk category to be detected;

[0255] A screening unit 702 is used to screen out field values ​​of target fields corresponding to risk categories from the interface call logs of the application programming interface within a preset time range;

[0256] The second determining unit 703 is configured to determine that there is a risk in the application programming interface if there is an abnormal field value in the field value.

[0257] Preferably, the risk categories include any one or any combination of the following:

[0258] Identity authentication risk, resource restriction risk, resource authorization risk, and function authorization risk;

[0259] The target fields corresponding to the identity authentication risk include at least: the number of identity authentication failures;

[0260] The target field corresponding to the resource limit risk includes at least one of the following: resource request rate and resource request times;

[0261] The target fields corresponding to resource authorization risks include at least: the number of resource accesses;

[0262] The target fields corresponding to the function authorization risk include at least: the number of function calls.

[0263] Preferably, the field value is multiple, and the second determining unit 703 is used to:

[0264] Determine the mean and standard deviation of multiple field values ​​of the target field;

[0265] Based on each field value, mean value, and standard deviation of the target field, determine whether there are abnormal field values;

[0266] If so, it is determined that an abnormal field value exists and that the application programming interface is at risk;

[0267] Otherwise, a box plot method is used to determine whether there are abnormal field values ​​in the field values ​​of the target field, and if it is determined that there are abnormal field values, it is determined that there is a risk in the application programming interface.

[0268] Preferably, the second determining unit 703 is used to: filter out field values ​​that meet a preset filter condition from multiple field values ​​of the target field;

[0269] Determine the absolute value of the difference between each filtered field value and the average value;

[0270] Determine the corresponding field deviation based on each absolute value and standard deviation;

[0271] If it is determined that there is a field deviation within a preset abnormal deviation range among the field deviations, it is determined that there is an abnormal field value; otherwise, it is determined that there is no abnormal field value.

[0272] Preferably, the second determining unit 703 is used to: filter out a specified number of field values ​​from a plurality of field values ​​of the target field, wherein the minimum value of the filtered field values ​​is not less than the maximum value of the unfiltered field values;

[0273] Alternatively, a specified number of field values ​​are filtered out from multiple field values, wherein the maximum value among the filtered field values ​​is not greater than the minimum value among the unfiltered field values.

[0274] Preferably, the interface call log includes: an application programming interface access log and an application programming interface authentication log; the second determining unit 703 is further used to:

[0275] Based on the information in the application programming interface authentication log, the application programming interface access log is associated with the object that calls the application programming interface access log.

[0276] Preferably, the identity authentication risk refers to the risk of abnormal authentication during user identity authentication;

[0277] Resource limitation risk refers to the risk of overload when resources are called;

[0278] Resource authorization risk refers to the risk of unauthorized calls when resources are called;

[0279] Function authorization risk refers to the risk of unauthorized calls when a function is called.

[0280] In the risk detection method, device, equipment and medium of the application programming interface provided in the embodiment of the present application, the risk category to be detected is determined; the field value of the target field corresponding to the risk category is screened out from the interface call log of the application programming interface within a preset time range; if there is an abnormal field value in the field value, it is determined that the application programming interface has a risk. In this way, risk detection of different risk categories is performed through the API interface call log, which simplifies the tedious operation of risk detection and reduces the manpower and material costs consumed by risk detection.

[0281] Figure 8 FIG. 8 is a schematic diagram showing the structure of an electronic device 8000. Figure 8 As shown, the electronic device 8000 includes: a processor 8010, a memory 8020, a power supply 8030, a display unit 8080, and an input unit 8050.

[0282] The processor 8010 is the control center of the electronic device 8000. It connects various components using various interfaces and lines, and performs various functions of the electronic device 8000 by running or executing software programs and / or data stored in the memory 8020, thereby monitoring the electronic device 8000 as a whole.

[0283] In the embodiment of the present application, when the processor 8010 calls the computer program stored in the memory 8020, the following is executed: Figure 1 The embodiments shown in the drawings provide a method for API risk detection.

[0284] Optionally, the processor 8010 may include one or more processing units; preferably, the processor 8010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and applications, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 8010. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips.

[0285] The memory 8020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, various applications, etc.; the data storage area may store data created according to the use of the electronic device 8000, etc. In addition, the memory 8020 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices, etc.

[0286] The electronic device 8000 also includes a power source 8030 (such as a battery) for supplying power to various components. The power source can be logically connected to the processor 8010 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.

[0287] The display unit 8080 may be used to display information input by a user or information provided to a user, various menus of the electronic device 8000, and in the embodiment of the present invention, is mainly used to display the display interface of each application in the electronic device 8000 and objects such as text and pictures displayed in the display interface. The display unit 8080 may include a display panel 8041. The display panel 8041 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), and the like.

[0288] The input unit 8050 may be used to receive information such as numbers or characters input by the user. The input unit 8050 may include a touch panel 8051 and other input devices 8052. The touch panel 8051, also known as a touch screen, may collect user touch operations on or near it (such as operations performed by the user using a finger, a stylus, or any other suitable object or accessory on or near the touch panel 8051).

[0289] Specifically, the touch panel 8051 can detect the user's touch operation, detect the signal brought by the touch operation, convert these signals into touch point coordinates, send them to the processor 8010, and receive and execute the command sent by the processor 8010. In addition, the touch panel 8051 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. Other input devices 8052 can include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.

[0290] Of course, the touch panel 8051 can cover the display panel 8041. When the touch panel 8051 detects a touch operation on or near it, it transmits it to the processor 8010 to determine the type of touch event, and then the processor 8010 provides corresponding visual output on the display panel 8041 according to the type of touch event. Figure 8 In the embodiment, the touch panel 8051 and the display panel 8041 are used as two independent components to implement the input and output functions of the electronic device 8000, but in some embodiments, the touch panel 8051 and the display panel 8041 can be integrated to implement the input and output functions of the electronic device 8000.

[0291] The electronic device 8000 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, according to the needs of specific applications, the electronic device 8000 may also include other components such as a camera. Since these components are not the key components used in the embodiments of the present application, Figure 8 It is not shown and will not be described in detail.

[0292] Those skilled in the art will understand that Figure 8 The electronic device is merely an example and does not limit the electronic device, and may include more or less components than those shown in the figure, or may combine certain components, or may include different components.

[0293] In an embodiment of the present application, a readable storage medium stores a computer program, and when the computer program is executed by a processor, a communication device can perform each step in the above embodiment.

[0294] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.

[0295] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0296] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0297] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0298] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0299] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0300] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A risk detection method for an application programming interface, characterized in that: include: Identify the risk categories to be tested; Filtering out the field value of the target field corresponding to the risk category from the interface call log of the application programming interface within a preset time range; If there is an abnormal field value in the field value, it is determined that there is a risk in the application programming interface; There are multiple field values, and if there is an abnormal field value among the field values, determining that there is a risk in the application programming interface includes: Determine the mean and standard deviation of multiple field values ​​of the target field; According to each field value of the target field, the average value and the standard deviation, determining whether there is an abnormal field value; If so, it is determined that there is an abnormal field value, and that the application programming interface is at risk; Otherwise, a box plot method is used to determine whether there are abnormal field values ​​in the field value of the target field, and if it is determined that there are abnormal field values, it is determined that there is a risk in the application programming interface.

2. The method according to claim 1, characterized in that The risk categories include any one or any combination of the following: Identity authentication risk, resource restriction risk, resource authorization risk, and function authorization risk; The target field corresponding to the identity authentication risk includes at least: the number of identity authentication failures; The target field corresponding to the resource limitation risk includes at least one of the following: resource request rate and resource request times; The target field corresponding to the resource authorization risk includes at least: the number of resource accesses; The target field corresponding to the function authorization risk includes at least: the number of function calls.

3. The method according to claim 1, characterized in that The determining whether there is an abnormal field value according to each field value of the target field, the average value, and the standard deviation includes: Filtering out field values ​​that meet preset filtering conditions from multiple field values ​​of the target field; Determine the absolute value of the difference between each of the selected field values ​​and the average value; Determining a corresponding field deviation according to each absolute value and the standard deviation respectively; If it is determined that there is a field deviation within a preset abnormal deviation range among the field deviations, it is determined that there is an abnormal field value; otherwise, it is determined that there is no abnormal field value.

4. The method according to claim 3, characterized in that The step of filtering out a field value that meets a preset filtering condition from a plurality of field values ​​of the target field includes: Filtering a specified number of field values ​​from multiple field values ​​of the target field, wherein the minimum value of the filtered field values ​​is not less than the maximum value of the unfiltered field values; Alternatively, a specified number of field values ​​are screened out from the plurality of field values, wherein the maximum value among the screened out field values ​​is not greater than the minimum value among the unscreened field values.

5. The method according to claim 1, characterized in that The interface call log includes: an application programming interface access log and an application programming interface authentication log; the method further includes: Based on the information in the application programming interface authentication log, the application programming interface access log is associated with the object that calls the application programming interface access log.

6. The method according to claim 2, characterized in that The identity authentication risk refers to the risk of abnormal authentication during user identity authentication; The resource limitation risk refers to the risk of overload when resources are called; The resource authorization risk refers to the risk of unauthorized calling when resources are called; The function authorization risk refers to the risk of unauthorized calling when the function is called.

7. A risk detection device for an application programming interface, characterized in that: include: A first determination unit, used to determine a risk category to be detected; A screening unit, configured to screen out field values ​​of target fields corresponding to the risk category from the interface call logs of the application programming interface within a preset time range; A second determining unit, configured to determine that the application programming interface has a risk if there is an abnormal field value in the field values; There are multiple field values, and the second determining unit is used to: Determine the mean and standard deviation of multiple field values ​​of the target field; According to each field value of the target field, the average value and the standard deviation, determining whether there is an abnormal field value; If so, it is determined that there is an abnormal field value, and that the application programming interface is at risk; Otherwise, a box plot method is used to determine whether there are abnormal field values ​​in the field value of the target field, and if it is determined that there are abnormal field values, it is determined that there is a risk in the application programming interface.

8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 6 is executed.

9. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is executed.