Security protection method and device of interface, computer equipment and storage medium

By generating interface metadata and obtaining pre-built interface call chains, the authentication key leakage and interface call sequence problems in API security protection measures are solved, efficient security control of the interface is achieved, and security is enhanced and protection capabilities.

CN119004440APending Publication Date: 2024-11-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310575726.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-19
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

The security protection measures of existing APIs are difficult to prevent unauthorized access and malicious calls caused by the leakage of authentication keys, and cannot effectively limit the order and relationship of interface calls, resulting in increased security risks.

Method used

By generating interface metadata, obtaining pre-built interface call chains, and performing chain relationship detection, access control is performed based on the detection results, ensuring that interface calls comply with predefined rules and preventing unauthorized and malicious calls.

Benefits of technology

Effectively prevent unauthorized access and malicious calls, enhance the security and reliability of the interface, limit the risks brought about by the leakage of authentication keys, and improve the security protection capabilities of the interface.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119004440A_ABST
    Figure CN119004440A_ABST
Patent Text Reader

Abstract

The invention relates to an interface security protection method and device, computer equipment, a storage medium and a computer program product, the method can be applied to the field of cloud technology, and the method comprises the following steps: when an interface calling request passes security authentication, generating interface metadata according to the interface calling request; the interface metadata comprises chained calling information for describing a target interface specified by the interface calling request; obtaining a pre-constructed interface calling chain; when the target interface is the interface on the interface calling chain, chain type relation detection is conducted on the chain type calling information according to the interface calling chain, and a chain type relation detection result is obtained; and performing access control on the target interface according to the chain relation detection result. By adopting the method, the security and protection capability of the interface can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, computer equipment and storage medium for protecting an interface. Background Art

[0002] API (Application Programming Interface) is a set of rules, protocols, and tools that define the interactions between software components. It provides a method that allows different software components to communicate and interact without direct access to source code or programs.

[0003] In order to prevent APIs from being called maliciously, authentication based on an asymmetric key algorithm is currently used to implement access control when APIs are called. In an enterprise environment, an API is usually limited to being bound to only one authentication key pair, and one authentication key pair can be bound to multiple different APIs, which means that if an authentication key pair is leaked, an attacker can use this authentication key pair to access all APIs bound to it, resulting in data leakage and security risks. Summary of the invention

[0004] Based on this, it is necessary to provide an interface security protection method, device, computer equipment and storage medium that can improve the security protection effect of the interface in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for protecting an interface. The method comprises:

[0006] When the interface call request passes the security authentication, interface metadata is generated according to the interface call request; the interface metadata includes chain call information describing the target interface specified by the interface call request;

[0007] Get the pre-built interface call chain;

[0008] When the target interface is an interface on the interface call chain, performing a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result;

[0009] Access control is performed on the target interface according to the chain relationship detection result.

[0010] In a second aspect, the present application also provides a safety protection device for an interface. The device comprises:

[0011] An interface metadata generation module, used to generate interface metadata according to an interface call request when the interface call request passes the security authentication; the interface metadata includes chain call information describing the target interface specified by the interface call request;

[0012] The interface call chain acquisition module is used to obtain the pre-built interface call chain;

[0013] A chain relationship detection module, used for performing a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result when the target interface is an interface on the interface call chain;

[0014] An access control module is used to perform access control on the target interface according to the chain relationship detection result.

[0015] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0016] When the interface call request passes the security authentication, interface metadata is generated according to the interface call request; the interface metadata includes chain call information describing the target interface specified by the interface call request;

[0017] Get the pre-built interface call chain;

[0018] When the target interface is an interface on the interface call chain, performing a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result;

[0019] Access control is performed on the target interface according to the chain relationship detection result.

[0020] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0021] When the interface call request passes the security authentication, interface metadata is generated according to the interface call request; the interface metadata includes chain call information describing the target interface specified by the interface call request;

[0022] Get the pre-built interface call chain;

[0023] When the target interface is an interface on the interface call chain, performing a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result;

[0024] Access control is performed on the target interface according to the chain relationship detection result.

[0025] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0026] When the interface call request passes the security authentication, interface metadata is generated according to the interface call request; the interface metadata includes chain call information describing the target interface specified by the interface call request;

[0027] Get the pre-built interface call chain;

[0028] When the target interface is an interface on the interface call chain, performing a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result;

[0029] Access control is performed on the target interface according to the chain relationship detection result.

[0030] The above-mentioned interface security protection method, device, computer equipment, storage medium and computer program product generate interface metadata according to the interface call request after the interface call request passes the security authentication, the interface metadata includes chain call information describing the target interface specified by the interface call request, obtains the pre-built interface call chain, and when the target interface is an interface on the interface call chain, performs chain relationship detection on the chain call information according to the interface call chain to obtain the chain relationship detection result, and performs access control on the target interface according to the chain relationship detection result. By performing security authentication on the interface call request, the identity and authority of the caller can be ensured to be legitimate, and unauthorized Access and malicious calls enhance the security of the interface; by generating interface metadata and obtaining the pre-built interface call chain, the interface call can be chained and detected, and access to the target interface can be controlled based on the chained detection results, thereby ensuring that the calling sequence and relationship of the interface comply with predefined rules, preventing unauthorized access and malicious calls (such as scattered calls or out-of-order calls), and enhancing the security and reliability of the interface; at the same time, it can limit the risk of leakage of authentication key pairs, and through strict chained call rules and access control, effectively reduce the possibility of abuse of leaked authentication key pairs, and improve the security and protection capabilities of the interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 An application environment diagram of a security protection method for an interface in an embodiment;

[0032] Figure 2 A schematic diagram of a flow chart of a method for protecting a security interface in one embodiment;

[0033] Figure 3 A schematic diagram of an interface call chain in one embodiment;

[0034] Figure 4 A schematic diagram of an interface call chain in another embodiment;

[0035] Figure 5 A schematic diagram of an interface call chain in another embodiment;

[0036] Figure 6 A schematic diagram of a control strategy detection step in an embodiment;

[0037] Figure 7 A schematic diagram of a flow chart of calling a detection step in an embodiment;

[0038] Figure 8 A schematic diagram of a flow chart of calling a detection step in another embodiment;

[0039] Fig. 9 A schematic diagram of a resource configuration page in an embodiment;

[0040] Fig.10 A schematic diagram of a resource configuration page in another embodiment;

[0041] Fig.11 A schematic diagram of a flow chart of a method for protecting a security interface in one embodiment;

[0042] Fig.12 A schematic diagram of data flow of a security protection method for an interface in an embodiment;

[0043] Fig.13 A schematic diagram of a flow chart of a method for protecting a security interface in another embodiment;

[0044] Fig.14 A structural block diagram of a safety protection device for an interface in an embodiment;

[0045] Fig.15 A structural block diagram of a safety protection device for an interface in an embodiment;

[0046] Fig.16 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0048] The interface security protection method provided in the embodiment of the present application can be applied to the field of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize data calculation, storage, processing, and sharing.

[0049] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.

[0050] Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, allowing various application systems to obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". From the user's perspective, the resources in the "cloud" are infinitely scalable and can be obtained at any time, used on demand, expanded at any time, and paid for by use.

[0051] As a provider of basic cloud computing capabilities, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.

[0052] The interface security protection method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown, the terminal 10 communicates with the server 104 and the server 106 through the network. The data storage system can store data that the server 106 needs to process. The data storage system can be integrated on the server 106, or placed on the cloud or other servers. Server 104 is a server deployed with an API gateway, and server 106 is a server that provides resources. The security protection of the interface is executed by server 104, and specifically can be executed by the API gateway deployed on server 104. Taking the server 104 executing the security protection method of the above-mentioned interface as an example, terminal 102 sends an interface call request to server 104, and server 104 performs security authentication on the interface call request. When the interface call request passes the security authentication, interface metadata is generated according to the interface call request; the interface metadata includes chain call information describing the target interface specified by the interface call request; a pre-built interface call chain is obtained; when the target interface is an interface on the interface call chain, a chain relationship detection is performed on the chain call information according to the interface call chain to obtain a chain relationship detection result; access control is performed on the target interface according to the chain relationship detection result. For example, when the chain relationship detection result is passed, the target interface is called to access server 106 to obtain resources, and when the chain relationship detection result is not passed, the target interface is refused to be called.

[0053] Among them, the terminal 102 can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Servers 104 and 106 can be independent physical servers, or server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide 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, CDN, and big data and artificial intelligence platforms. The terminal 102 and the server 104 and the server 106 can be directly or indirectly connected via wired or wireless communications, and this application does not limit this.

[0054] In one embodiment, Figure 2 As shown, a method for protecting an interface is provided, which is applied to Figure 1 The computer device in the example is used to illustrate, including the following steps:

[0055] S202: When the interface call request passes the security authentication, generate interface metadata according to the interface call request.

[0056] Among them, the interface refers to the Application Programming Interface (API), which is a set of rules, protocols and tool sets that define the interaction between software components. It provides a method that allows different software components to communicate and interact without directly accessing source code or programs. The API defines the interface and communication protocol between software components, and stipulates how data is transmitted, called and interacted between them. Through the API, developers can use the functions and services of already written software components without understanding their internal implementation details.

[0057] Interface metadata is information that describes the key attributes and calling relationships of the target. Data related to the key attributes may include communication protocols, path information, domain names, parameters, and other information. The communication protocol specifically refers to the communication protocol supported by the API, such as HTTP, HTTPS, etc. The path information indicates the specific API access path; the domain name refers to the domain name information of the API request, which is used to indicate the host name or domain name to which the API belongs; the parameter refers to the parameter information of the API, which indicates the parameters passed when the API is called, including the parameter name, type, format, etc.; the data related to the calling relationship may include chain calling information that describes the target interface specified by the interface calling request, etc. The chain calling information includes whether the API is an interface node. If it is an interface node, the chain calling information also includes the API's interface type, predecessor interface node, successor interface node, calling order of the interface node, and calling time interval, etc.

[0058] The target interface refers to the interface to be called. The interface to be called refers to the specific interface that needs to be accessed and called when making an API call. Specifically, the interface to be called refers to the interface exposed by the callee (API provider). It defines the functions and services that can be accessed and called by external applications. The interface to be called can be a variety of different APIs, such as query interface, create interface, update interface, delete interface, etc., which can be determined according to business needs and interface design.

[0059] It is understandable that when making an API call, the caller (API caller) needs to specify the interface to be called in order to perform the corresponding data transmission and operation. The interface to be called is usually defined and described by the API provider in the API document or related API management platform, including the name of the interface, input parameters, return results, calling method, access path and other information. By calling the interface to be called, the API caller can request and obtain the results of specific functions, such as querying data, sending requests, performing operations, etc. The interface to be called is usually called through the HTTP / HTTPS protocol, using specific request methods (such as GET, POST, PUT, DELETE) and parameter passing methods (such as URL parameters, request body, request header) to pass the information required for the call.

[0060] It should be noted that whether an API is an interface node refers to whether the API is an interface node on the interface call chain. The interface call chain is composed of a series of interfaces. These interfaces are connected in a certain order and relationship to form an orderly call chain. The interface call chain describes the call order and dependency relationship between different interfaces and is used to implement specific business logic or functions. Each interface in the interface call chain can be called an interface node. Each interface node can be divided into its node type according to its function. Specifically, it can include context type interface nodes and business type nodes. The context type can also be called control type. The context type interface node does not execute specific business logic, but is used to control the process and call order of the interface call chain, and can also be used to identify the interface call chain; the business type interface node is used to implement specific business functions or data access. They execute actual business logic, process data, perform operations, etc. These interface nodes may include data query, data processing, business calculation, data persistence and other functions according to specific business needs. The business type interface node is the core node in the interface call chain and is directly responsible for implementing the processing and execution of business logic.

[0061] The predecessor interface node refers to the interface node that is called before the target interface in the interface call chain where the target interface is located, and the successor interface node refers to the interface node that is called after the target interface in the interface call chain where the target interface is located.

[0062] like Figure 3As shown in the figure, the interface call chain 1 corresponding to business 1 includes three interface nodes, namely API a1, API b1 and API c1. The interface type of API a1 is context type, that is, API a1 plays a role of context control in the interface call chain. The interface types of API b1 and API c1 are business types, that is, API b1 and API c1 execute actual business logic. The calling order of the three interface nodes is API a1, API b1 and API c1. The calling interval threshold T between API a1 and API b1 ab1 , the call interval threshold T between API b1 and API c1 bc1 That is, when accessing business 1 normally, you need to call API a1 first and call it at the preset calling time interval T ab1 API b1 is called within a preset calling time interval T bc1 API c1 is called internally. For API b1, API a1 is its predecessor interface node and API c1 is its successor interface node.

[0063] like Figure 4 As shown in the figure, the interface call chain 2 corresponding to the business 2 includes five interface nodes, namely, API a2, API b2, API c2, API d2 and API e2. Among them, the interface types of API a2 and API b2 are context types, that is, API a2 and API b2 play the role of context control in the interface call chain. The interface types of API c2, API d2 and API e2 are business types, that is, API c2, API d2 and API e2 execute the actual business logic. The calling order of the five interface nodes is that API a2 and API b2 call in sequence. After completing the call to API b2, API c2, API d2 and API e2 are called. The calling order between API c2, API d2 and API e2 is not fixed. The calling interval threshold between API a2 and API b2 is T ab2 , the call interval threshold T between API b2 and API c2 (or API d2, or API e2) bc2 That is, when accessing business 2 normally, you need to call API a2 first and call it at the preset calling time interval T ab2 API b2 is called within a preset calling time interval T bc2 API c2, API d2, or API e2 is called internally. For API b2, API a2 is its predecessor interface node, and API c2, API d2, and API e2 are its successor interface nodes.

[0064] like Figure 5 As shown in the figure, the interface call chain 3 corresponding to the business 3 includes five interface nodes, namely, API a3, API b3, API c3, API d3 and API e3. Among them, the interface types of API a3, API b3 and API c3 are context types, that is, API a3, API b3 and API c3 play the role of context control in the interface call chain. The interface types of API d3 and API e3 are business types, that is, API d3 and API e3 execute the actual business logic. The calling order of the five interface nodes is API a3, API b3 and API c3 are called in sequence. After completing the call to API c3, any one of API d3 and APIe3 is called. The calling interval threshold between API a3 and API b3 is T ab3 , the call interval threshold T between API b3 and API c3 bc3 , the call interval threshold T between API c3 and API d3 (or API e3) cd3 That is, when accessing service 3, you need to call API a3 first and then call it at the preset calling time interval T. ab3 API b3 is called within the preset calling time interval T bc3 API c3 is called within a preset calling time interval T cd3 API d3 or API e3 is called internally. For APIb3, API a3 is its predecessor interface node, and API c3, API d3 and API e3 are its successor interface nodes.

[0065] It can be seen from the above three interface call chain examples that in the embodiments of the present application, under normal business access conditions, access to any business needs to first call the interface node of its context type according to the corresponding chain call relationship, and then call the interface node of the corresponding business type. Therefore, when an interface node of one or some business types is attacked, it is possible to detect whether the interface nodes of the upper and lower types are called normally, and whether the call to the interface node of the business type complies with the chain call, to discover abnormal interface calls, thereby improving the security of the interface.

[0066] Security authentication refers to the process of authenticating and verifying the permissions of interface call requests. Through security authentication, it can be confirmed whether the identity and permissions of the caller are legal to ensure that only authorized users or applications can access and call the interface.

[0067] Specifically, when receiving an interface call request, the computer device may perform security authentication on the interface call request, and after the security authentication passes, obtain request data of the interface call request, and generate interface metadata based on the request data.

[0068] In one embodiment, the request data includes data such as communication protocol, path information, domain name, parameters, interface identifier, business identifier and access control information of the interface call chain corresponding to the business identifier. The computer device generates chain call information based on the interface identifier, business identifier and access control information of the interface call chain corresponding to the business identifier, and generates interface metadata based on the chain call information, communication protocol, path information, domain name and parameters.

[0069] It is understandable that in some cases of malicious interface calls, the interface call is not a chain call, and the request data of the interface call request sent does not carry data such as the business identifier and the access control information of the interface call chain corresponding to the business identifier, so that the interface metadata containing the chain call information cannot be generated; in other cases of malicious interface calls, the interface caller forges the business identifier and the access control information of the interface call chain corresponding to the business identifier, so that the interface identifier in the request data of the interface call request does not match the business identifier, for example, the target interface corresponding to the interface identifier is not the interface node on the interface call chain corresponding to the business identifier; in other cases of malicious interface calls In this case, the interface caller forges the business identifier and the access control information of the interface call chain corresponding to the business identifier, so that the target interface corresponding to the interface identifier is the interface node on the interface call chain corresponding to the business identifier, but the access control information of the interface call chain corresponding to the business identifier does not match the current calling method of the target interface corresponding to the interface identifier. Therefore, the access control information of the interface call chain corresponding to the business identifier needs to be further verified. In an embodiment of the present application, after generating the interface metadata, the chain call information of the target interface specified by the interface call request described in the interface metadata is further detected to achieve further security protection verification of the interface call request.

[0070] In one embodiment, the computer device constructs the interface metadata in the form of JSON, XML, etc. The process of generating the interface metadata is described by taking an example, as shown in the following code:

[0071]

[0072] Among them, protocol indicates the communication protocol of the API, url indicates the path information of the API, such as " / corp / apicall / step", hostname indicates the domain name information of the API request, parameter indicates the API parameter information, call_interval indicates the call time interval between the specified API call and its predecessor interface node, "is_context_type" indicates whether it is a context type node, "is_api_link" indicates whether the API is a node in the API chain, "precursor_api" indicates the list of predecessor interface nodes, "successor_api" indicates the list of successor interface nodes, and "successor_api_rule" indicates the execution relationship of the successor interface nodes. If the value is "and", it means that all need to be executed, "or" means that one of them needs to be executed, and "seq" means that they need to be executed in the order specified by "successor_api".

[0073] S204, obtaining a pre-built interface call chain.

[0074] The pre-built interface call chain is a series of interface call sequences and relationships that are pre-defined and configured based on business requirements, and is used to implement specific business logic or process control. The interface call chain consists of a series of interfaces that are connected in a certain order and relationship to form an ordered call chain. The interface call chain describes the call sequence and dependency relationship between different interfaces, and is used to implement specific business logic or functions. For example, based on the needs of business 1, Figure 3 The interface call chain 1 shown in the figure is constructed based on the needs of business 2. Figure 4 The interface call chain 2 shown in the figure is constructed based on the needs of business 3. Figure 5 Interface call chain 3 is shown.

[0075] Specifically, the computer device can obtain the pre-built interface call chain from the interface call chain library, wherein the interface call chain library is a collection for storing and managing multiple interface call chains.

[0076] It is understandable that during the system or application development phase, developers first clarify the required business logic or process, and specifically understand the interfaces involved in the system and the dependencies between them. Based on the interface functions, data processing order, dependencies, etc., the interfaces involved are divided into different nodes. Each node represents a specific interface. The calling order of each interface node is determined according to the business logic and data flow. According to the determined calling order, the calling relationship between the interface nodes is configured. Specifically, the calling relationship can be configured through configuration files, database tables, workflow engines, etc., and control nodes can be added as needed to control the start of the entire interface call chain. These control nodes may not directly execute business logic, but are used to identify the start of the call chain, or execute some additional control logic. After constructing the interface call chain corresponding to each business, the constructed interface call chain can be stored in the interface call chain library, which is a collection for storing and managing pre-built interface call chains.

[0077] In one embodiment, the computer device may also obtain a service identifier from the interface call request, determine a corresponding interface call chain identifier based on the service identifier, and obtain an interface call chain corresponding to the interface call chain identifier from an interface call chain library.

[0078] S206: When the target interface is an interface on the interface call chain, a chain relationship detection is performed on the chain call information according to the interface call chain to obtain a chain relationship detection result.

[0079] Among them, chain relationship detection is the process of verifying and checking the order and relationship between interface nodes in the interface call chain. Its purpose is to ensure that the interface is called according to the predefined order and rules to meet the requirements of business processes or logic.

[0080] Specifically, after obtaining the interface call chain, the computer device determines whether the target interface is an interface on the interface call chain. If not, it determines that the interface call request is an abnormal interface call request, and rejects the call to the target interface. If so, it obtains the access control information of the interface call chain, and performs a chain relationship detection on the chain call information of the target interface based on the access control information of the interface call chain to obtain a chain relationship detection result.

[0081] The access control information is the access control information when performing a chain call of an interface, and the relevant information of the specific interface call chain includes the interface nodes in the interface call chain, the calling order of each interface node, the calling time interval between adjacent interface nodes, etc.

[0082] It can be understood that, based on the access control information of the interface call chain, chain relationship detection is performed on the chain call information of the target interface, which can ensure that the interface is called according to the predefined order and rules.

[0083] S208: Perform access control on the target interface according to the chain relationship detection result.

[0084] The chain relationship detection result includes whether the chain relationship detection passes or fails, and access control refers to whether access is allowed or denied.

[0085] Specifically, after obtaining the chain relationship detection result, the computer device determines whether to allow access to the target interface based on the result of the chain relationship detection. If the chain relationship detection passes, it means that the current interface call request meets the predefined chain call sequence and rules, and access to the target interface is allowed; if the chain relationship detection fails, it means that the previous interface call request does not meet the requirements of the call chain, then access to the target interface is denied, and an appropriate error response is returned to the terminal that initiated the interface call request.

[0086] In the above embodiment, after the interface call request passes the security authentication, the computer device generates interface metadata according to the interface call request, the interface metadata includes chain call information describing the target interface specified in the interface call request, obtains a pre-built interface call chain, and when the target interface is an interface on the interface call chain, performs a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result, and performs access control on the target interface according to the chain relationship detection result. By performing security authentication on the interface call request, the identity and authority of the caller can be ensured to be legitimate, unauthorized access and malicious calls can be prevented, and security protection can be enhanced. The security of the interface; by generating interface metadata and obtaining the pre-built interface call chain, the interface call can be chained and detected, and access to the target interface can be controlled based on the chained detection results, thereby ensuring that the calling sequence and relationship of the interface comply with predefined rules, preventing unauthorized access and malicious calls (such as scattered calls or out-of-order calls), and enhancing the security and reliability of the interface; at the same time, it can limit the risk of leakage of authentication key pairs, and through strict chained call rules and access control, effectively reduce the possibility of abuse of leaked authentication key pairs, and improve the security and protection capabilities of the interface.

[0087] In one embodiment, the chain relationship detection result includes a first detection result, the interface metadata includes the interface type of the target interface, and the computer device performs a chain relationship detection on the chain call information according to the interface call chain. The process of obtaining the chain relationship detection result specifically includes the following steps: when the interface type is a context type, obtaining access control information of a pre-built interface call chain; performing a control policy detection on the chain call information according to the access control information to obtain a first detection result.

[0088] Specifically, after obtaining the interface metadata, the computer device can determine the interface type of the target interface based on the interface metadata. When the interface type of the target interface is a context type and the target interface is an interface on a pre-built interface call chain, the chain call information in the interface metadata is subjected to control policy detection based on the access control information of the interface call chain to obtain a first detection result.

[0089] In one embodiment, when the computer device determines that the interface type of the target interface is a context type and the target interface is an interface on a pre-built interface call chain, it determines whether the interface type of the target interface on the pre-built interface call chain is also a context type. If so, it executes a step of performing a control policy detection on the chain call information in the interface metadata according to the access control information of the interface call chain to obtain a first detection result. If not, it determines that the chain relationship detection result is a detection anomaly.

[0090] In the above embodiment, when the interface type is a context type, the computer device can identify potential security risks and abnormal situations, such as abnormal calling sequences, illegal calling combinations, etc., by obtaining access control information of a pre-built interface call chain and performing control policy detection on the chain call information according to the access control information, thereby helping to timely discover and prevent potential security vulnerabilities and attack behaviors, and improving the security and protection capabilities of the interface.

[0091] In one embodiment, a computer device controls and detects chain call information according to access control information, and the process of obtaining a first detection result includes the following steps: determining the associated interface of the target interface, the call interval between adjacent interfaces, and the calling method of the associated interface according to the chain call information; detecting the matching between the associated interface of the target interface, the call interval between adjacent interfaces, and the calling method of the associated interface and the access control information, respectively, to obtain a first detection result; wherein the first detection result is a normal detection.

[0092] Among them, the associated interface refers to at least one of the predecessor interface node and the successor interface node of the target interface, the calling interval between adjacent interfaces is the calling interval between adjacent interface nodes, and the calling method of the associated interface is the calling order of the predecessor interface node or the successor interface node. For example, if the successor interface nodes are API b4 and API c4, the calling method is whether APIb4 and API c4 are called sequentially, simultaneously, or selectively.

[0093] Specifically, after determining the associated interface of the target interface according to the chain call information, the determined associated interface can be compared with the associated interface of the target interface in the access control information of the pre-built interface call chain. If the two are inconsistent, it is determined that the interface call request is abnormal, that is, the chain relationship detection result is a detection abnormality. If the two are consistent, the call time interval between adjacent interfaces is determined according to the chain call information, and the determined call time interval is compared with the call time interval of adjacent interface nodes in the access control information of the pre-built interface call chain. If the two are inconsistent, it is determined that the interface call request is abnormal, that is, the chain relationship detection result is a detection abnormality. If the two are consistent, the calling method of the associated interface is determined according to the chain call information, and the calling method of the determined associated interface is compared with the calling method of the associated interface nodes in the access control information of the pre-built interface call chain. If the two are inconsistent, it is determined that the interface call request is abnormal, that is, the chain relationship detection result is a detection abnormality. If the two are consistent, it is determined that the interface call request is normal, and a first detection result is obtained, wherein the first detection result is a normal detection.

[0094] It is understandable that in some cases of malicious interface calls, the chain call information in the interface metadata is generated based on forged information, that is, the interface type of the target interface, the call time interval of the corresponding associated interface, and the calling method of the associated interface may all be forged. Therefore, it is necessary to further compare it with the access control information of the pre-built interface call chain to achieve further security protection verification of the interface call request.

[0095] like Figure 6 As shown, when the target interface (API x) exists on the pre-built interface call chain and belongs to the context type, the associated interface determined based on the chain call information is compared with the associated interface in the access control information of the pre-built interface call chain. If the associated interfaces are consistent, the calling time interval determined based on the chain call information is compared with the calling time interval in the access control information of the pre-built interface call chain. If the calling time intervals are consistent, the calling method determined based on the chain call information is compared with the calling method in the access control information of the pre-built interface call chain. If the calling methods are also consistent, it is determined that the chain detection passes. When the associated interfaces are inconsistent, or the calling time intervals are inconsistent, or the calling methods are inconsistent, it is determined that the chain detection fails.

[0096] In the above embodiment, the computer device determines the associated interface of the target interface, the calling interval between adjacent interfaces and the calling method of the associated interface according to the chain calling information; detects the matching between the associated interface of the target interface, the calling interval between adjacent interfaces and the calling method of the associated interface and the access control information respectively, and can identify potential security risks and abnormal situations, such as abnormal calling sequence, abnormal calling time interval, illegal calling combination, etc., thereby helping to timely discover and prevent potential security vulnerabilities and attack behaviors, and improving the security and protection capabilities of the interface.

[0097] In one embodiment, the chain relationship detection result also includes a second detection result. The computer device performs a chain relationship detection on the chain call information according to the interface call chain. The process of obtaining the chain relationship detection result also includes the following steps: when the interface type is a business type, determining the historical call information that matches the chain call information; performing a call detection on the historical call information according to the access control information to obtain a second detection result.

[0098] The historical call information refers to previous interface call information, and specifically may be call information of a predecessor interface node of a target interface.

[0099] Specifically, after obtaining the interface metadata, the computer device can determine the interface type of the target interface based on the interface metadata. When the interface type of the target interface is a business type and the target interface is an interface on a pre-built interface call chain, determine the historical call information that matches the chain call information; perform a call detection on the historical call information based on the access control information to obtain a second detection result.

[0100] In one embodiment, when the computer device determines that the interface type of the target interface is a business type and the target interface is an interface on a pre-built interface call chain, it determines whether the interface type of the target interface on the pre-built interface call chain is also a business type. If so, it executes the step of determining historical call information that matches the chain call information, performing call detection on the historical call information according to the access control information, and obtaining a second detection result. If not, it determines that the chain relationship detection result is a detection anomaly.

[0101] In the above embodiment, when the interface type is a business type, the computer device determines the historical call information that matches the chain call information, and performs call detection on the historical call information according to the access control information. It can verify whether the historical call complies with the specifications of the chain call to identify the abnormal situations that have occurred, such as abnormal call sequence, abnormal call time interval, etc., thereby helping to timely discover and prevent potential security vulnerabilities and attack behaviors, and improving the security and protection capabilities of the interface.

[0102] In one embodiment, the process of a computer device determining historical call information that matches chain call information includes the following steps: determining an associated interface of a target interface based on the chain call information; and determining the historical call information of the associated interface as historical call information that matches the chain call information.

[0103] Among them, the associated interface refers to at least one of the predecessor interface node and the successor interface node of the target interface. In this embodiment, it may specifically refer to the predecessor interface node of the target interface. The historical call information of the associated interface may specifically be the call information of the predecessor interface node of the target interface. It can be understood that if the current interface call request is a request to call the target interface, then the predecessor interface node of the target interface should have been called.

[0104] Specifically, after determining the associated interface of the target interface based on the chain call information, the historical call information of the associated interface can be obtained from the interface call record, log or other stored information, and the historical call information can be checked according to the access control information of the constructed interface call chain to obtain a second detection result.

[0105] In the above embodiment, the computer device determines the associated interface of the target interface based on the chain call information, and determines the historical call information of the associated interface as the historical call information that matches the chain call information, so that it can verify whether the historical call complies with the specifications of the chain call based on the historical call information to identify the abnormal situations that have occurred, thereby helping to timely discover and prevent potential security vulnerabilities and attack behaviors, and improving the security and protection capabilities of the interface.

[0106] In one embodiment, a computer device performs a call detection on historical call information according to access control information, and the process of obtaining a second detection result includes the following steps: determining a historical call time interval and a historical call method based on the historical call information; detecting the matching between the historical call time interval and the historical call method and the access control information, respectively, to obtain a second detection result; wherein the second detection result is a normal detection.

[0107] The historical calling time interval refers to the calling time interval between adjacent interfaces when the associated interfaces are actually called, and the historical calling mode refers to the calling order of the associated interfaces when the associated interfaces are actually called.

[0108] Specifically, after obtaining the historical call time interval of the associated interface, the computer device compares the historical call time interval with the call time interval of the adjacent interface node in the access control information of the pre-built interface call chain. If the historical call time interval is greater than the call time interval of the adjacent interface node, it is determined that the interface call request is abnormal, that is, the chain relationship detection result is a detection abnormality. If the historical call time interval is not greater than the call time interval of the adjacent interface node, the historical call mode is determined according to the historical call information, and the determined historical call mode is compared with the call mode of the associated interface node in the access control information of the pre-built interface call chain. If the two are inconsistent, it is determined that the interface call request is abnormal, that is, the chain relationship detection result is a detection abnormality. If the two are consistent, it is determined that the interface call request is normal, and a second detection result is obtained, wherein the second detection result is a detection normal.

[0109] like Figure 7 As shown, when the target interface (API x) exists on the pre-built interface call chain and belongs to the business type, the historical call time interval of the associated interface is compared with the call time interval in the access control information of the pre-built interface call chain. If the call time interval matches, the historical call method of the associated interface is compared with the call method in the access control information of the pre-built interface call chain. If the call methods are consistent, it is determined that the chain detection passes. When the call time interval does not match or the call methods are inconsistent, it is determined that the chain detection fails.

[0110] In the above embodiment, the computer device determines the historical call time interval and the historical call method based on the historical call information; detects the matching between the historical call time interval and the historical call method and the access control information respectively, and verifies whether the historical call complies with the specifications of the chain call to identify the abnormal situations that have occurred, such as abnormal call sequence, abnormal call time interval, etc., thereby helping to timely discover and prevent potential security vulnerabilities and attack behaviors, and improving the security and protection capabilities of the interface.

[0111] In one embodiment, the chain relationship detection result includes a third detection result. The computer device performs a chain relationship detection on the chain call information according to the interface call chain. The process of obtaining the chain relationship detection result includes the following steps: searching for a cache interface chain that matches the interface call chain in the interface call cache pool; when the cache interface chain is found, obtaining the cache chain call information corresponding to the cache interface chain; performing a call detection on the chain call information according to the cache chain call information to obtain the third detection result.

[0112] The interface call cache pool is a mechanism for storing previous interface call results or information. It is a storage area that can be used to temporarily store interface call response data, status information, error information, etc. The cache chain call information includes the call information of the called interface node in the cache chain.

[0113] It can be understood that when a cached interface chain that matches the interface call chain is found in the interface call cache pool, the relevant information cached in the interface call cache pool can be directly used to perform call detection on the chain call information without having to obtain the access control information of the pre-built interface call chain, and there is no need to build the entire chain call again, thereby improving the calling efficiency of the target interface.

[0114] Specifically, when the target interface is an interface on a pre-built interface call chain, the computer device obtains the interface chain identifier of the pre-built interface call chain, and based on the interface chain identifier, searches for the cache interface chain corresponding to the interface chain identifier in the interface call cache pool, and obtains the cache chain call information corresponding to the cache interface chain from the interface call cache pool, performs call detection on the chain call information according to the cache chain call information, and obtains a third detection result.

[0115] In the above embodiment, the computer device searches for a cache interface chain that matches the interface call chain in the interface call cache pool. When the cache interface chain is found, it obtains the cache chain call information corresponding to the cache interface chain, and performs call detection on the chain call information based on the cache chain call information, without having to obtain the access control information of the pre-built interface call chain, and without having to build the entire chain call again, thereby improving the calling efficiency of the target interface.

[0116] In one embodiment, a computer device performs a call detection on the chain call information according to the cache chain call information, and the process of obtaining a third detection result may specifically include the following steps: determining a cache call time interval and a cache call method based on the cache chain call information; detecting the matching between the cache call time interval and the cache call method and the chain call information, respectively, to obtain a third detection result; wherein the third detection result is that the detection is normal.

[0117] Specifically, after obtaining the cache chain call information, the computer device determines the call time interval of the called interface node based on the cache chain call information, that is, the cache call time interval, and compares the cache call time interval with the call time interval of the relevant interface in the chain call information. If the cache call time interval is greater than the call time interval of the relevant interface in the chain call information, it is determined that the interface call request is abnormal, that is, the chain relationship detection result is a detection abnormality. If the cache call time interval is not greater than the call time interval of the relevant interface in the chain call information, the call method of the called interface is determined according to the cache chain call information, that is, the cache call method, and the cache call method is compared with the cache call method of the relevant interface in the chain call information. If the two are inconsistent, it is determined that the interface call request is abnormal, that is, the chain relationship detection result is a detection abnormality. If the two are consistent, it is determined that the interface call request is normal, and a third detection result is obtained, wherein the third detection result is a detection normal. Among them, the called interface node is the predecessor interface node of the target interface.

[0118] It can be understood that when the chain relationship detection passes, access to the target interface is allowed to continue. After completing the access to the target interface, the target interface call information of the target interface can be generated, and the target interface call information is used as the cache call information of the corresponding interface node in the cache call chain, and cached in the interface call cache pool, so that when a call request about the subsequent interface node of the target interface is received, the cache call information can be obtained to perform chain relationship detection, thereby improving the efficiency of chain relationship detection.

[0119] In the above embodiment, the computer device determines the cache call time interval and the cache call mode based on the cache chain call information; detects the matching between the cache call time interval and the cache call mode and the chain call information respectively, so as to identify potential security risks and abnormal situations, such as abnormal call sequence, abnormal call time interval, illegal call combination, etc., thereby helping to timely discover and prevent potential security vulnerabilities and attack behaviors, and improving the security and protection capabilities of the interface.

[0120] In one embodiment, the computer device performs chain relationship detection on the chain call information according to the interface call chain, and the process of obtaining the chain relationship detection result also includes the following steps: if a cache interface chain matching the interface call chain is not found in the interface call cache pool, then after completing the call to the target interface, generate the target interface call information of the target interface; cache the target interface call information in the interface call cache pool.

[0121] The target interface call information of the target interface may include the timestamp of the call, request parameters, response data, etc., which are used to record and store detailed information of the interface call.

[0122] Specifically, if a cached interface chain that matches the interface call chain is not found in the interface call cache pool, it means that the interface call chain is the first call. Then, after other chain relationship detections are performed on the interface call request and the detections pass, the target interface is called. After completing the call to the target interface, the target interface call information of the target interface is generated, and the target interface call information is cached in the interface call cache pool. In this way, in subsequent interface calls, if the interface call chain matches and the cache is still valid, the cached target interface call information can be directly used for chain relationship detection, thereby improving the efficiency of chain relationship detection.

[0123] like Figure 8 As shown, when the target interface (API x) exists on the pre-built interface call chain, it is detected whether there is a cache interface chain matching the interface call chain in the interface cache pool. If not, it is considered that the chain detection has also passed, and after completing the call to the target interface, the interface call chain where the target interface is located is used as a new chain, and the call information of the new chain and the target interface is cached; if it exists, the cache call time interval between the predecessor interface nodes of the target interface in the cache call chain is obtained, and the cache call time interval is compared with the call time interval in the chain call information. If the call time intervals match, the cache call mode of the predecessor interface node of the target interface in the cache call chain is obtained, and the cache call mode is compared with the call mode in the chain call information. If the call modes are consistent, it is determined that the chain detection has passed. When the call time intervals do not match or the call modes are inconsistent, it is determined that the chain detection has failed.

[0124] In the above embodiment, the computer device generates target interface call information of the target interface after completing the call to the target interface, and caches the target interface call information in the interface call cache pool, so that in subsequent interface calls, if the interface call chain matches and the cache is still valid, the cached target interface call information can be directly used to perform chain relationship detection, thereby improving the efficiency of chain relationship detection.

[0125] In one embodiment, the security protection method of the above-mentioned interface also includes a process of pre-constructing an interface call chain, and the process of constructing the interface call chain specifically includes the following steps: in response to a resource access configuration operation on a target business, obtaining resource configuration information and access permission configuration information; based on the resource configuration information and access permission configuration information, generating an interface call chain corresponding to the target business and access control information of the interface call chain.

[0126] Among them, the resource access configuration operation can be a trigger operation on the resource access configuration control; the resource configuration information includes the resources corresponding to the target business and the interface of the resources corresponding to the target business, and the access permission configuration information includes the access permissions and control rules covering the resources corresponding to the target business, which includes which users, roles or organizations have the permission to access the resources corresponding to the target business, and specifies the operations they can perform or the data scope they can access. Through the access permission configuration information, fine-grained permission control can be performed on the resources corresponding to the target business to ensure that only users or roles with legal permissions can access the resources corresponding to the target business.

[0127] Specifically, developers can configure resource access for the target business on the resource configuration page, which displays a resource access configuration control. In response to a trigger operation on the resource access configuration control, the developer obtains the resource configuration information and access permission configuration information configured when the resource access for the target business is configured on the resource configuration page. Based on the resource configuration information and the access permission configuration information, the developer determines the interface type of the interface of the resource corresponding to the target business, the calling sequence of the interface, the calling interval between adjacent interfaces and other data. Based on the interface type of the interface of the resource corresponding to the target business, the calling sequence of the interface, the calling interval between adjacent interfaces and other data, the developer generates the interface call chain corresponding to the target business and the access control information of the interface call chain.

[0128] like Fig. 9 FIG. 1 shows a resource configuration page in an embodiment, in which the access rights of various roles or objects (such as department members) to different resources (business applications, network locations) can be configured; Fig.10 The figure shows a resource configuration page in another embodiment, on which sensitive permission access levels for different businesses can be configured.

[0129] In the above embodiment, the computer device obtains resource configuration information and access permission configuration information by responding to the resource access configuration operation of the target business; based on the resource configuration information and the access permission configuration information, an interface call chain corresponding to the target business and access control information of the interface call chain are generated, so that the interface call chain can be flexibly managed and controlled, such as dynamically configuring and adjusting the interface call chain according to specific business needs and access permission requirements, simplifying management and maintenance work, so as to better adapt to business changes and permission management needs; and by generating an interface call chain corresponding to the target business, unnecessary interface calls and data transmission can be reduced, thereby improving the efficiency and performance of the system; in addition, when accessing specific business resources, chain calls can be made based on the interface call chain corresponding to the business, and chain detection can be performed during chain calls, thereby improving the security of business resources.

[0130] In one embodiment, the interface call chain generated by the computer device includes at least two interfaces, and the authentication keys corresponding to the at least two interfaces are different. By using a different authentication key for each interface, even if the authentication key of a certain interface is leaked and the interface is attacked, it will not affect the security of other interfaces. In this way, the potential risk range can be limited to a smaller range, reducing the overall risk of the system.

[0131] In one embodiment, the computer device can also associate different authentication keys with different access rights and roles to ensure that only users or roles with corresponding authentication keys can access the corresponding interface; and by associating each authentication key with a specific user or role and verifying the validity of the authentication key, the identity of the user or role can be confirmed, and corresponding authorization operations can be performed according to their permissions.

[0132] In one embodiment, the security protection method of the above-mentioned interface also includes a process of performing security authentication on an interface call request, and the process specifically includes the following steps: when an interface call request is received, obtaining an authentication key of the target interface specified in the interface call request; performing security authentication on the interface call request based on the authentication key to obtain a security authentication result; when the interface call request passes the security authentication, the computer device generates interface metadata according to the interface call request, and the process specifically includes the following steps: when the security authentication result indicates that the interface call request passes the security authentication, generating interface metadata according to the interface call request.

[0133] Specifically, after receiving the interface call request, the computer device determines the interface identifier of the target interface based on the interface call request, and obtains the authentication key corresponding to the target interface based on the interface identifier of the target interface, and uses the obtained authentication key to verify the identity information in the interface call request to obtain an identity authentication result. After the identity authentication result indicates that the identity authentication is passed, the authentication key can also be used to perform signature verification on the interface call request to obtain a signature verification result to ensure that the interface call request has not been tampered with or modified during transmission. After the signature verification result indicates that the signature verification is passed, it is determined that the interface call request has passed the security authentication, and interface metadata is generated according to the interface call request.

[0134] It is understandable that when the identity authentication demerit indicates that the identity authentication failed, or the signature verification result indicates that the signature verification failed, it is determined that the interface call is abnormal, and access to the target interface is denied.

[0135] In the above embodiment, when the computer device receives an interface call request, it obtains the authentication key of the target interface specified by the interface call request; based on the authentication key, the interface call request is security authenticated to obtain a security authentication result; when the security authentication result indicates that the interface call request passes the security authentication, interface metadata is generated according to the interface call request, which can ensure that only callers with legitimate authentication keys can access the target interface, thereby improving the security of the interface.

[0136] In one embodiment, Fig.11 As shown, a method for protecting an interface is also provided, which is applied to Figure 1 The computer device in the example is used to illustrate, including the following steps:

[0137] S1102, when the interface call request passes the security authentication, interface metadata is generated according to the interface call request; the interface metadata includes chain call information describing the target interface specified by the interface call request, and the interface type of the target interface.

[0138] S1104, obtaining a pre-built interface call chain.

[0139] S1106, when a cache interface chain matching the interface call chain is found in the interface call cache pool, cache chain call information corresponding to the cache interface chain is obtained; and a call detection is performed on the chain call information according to the cache chain call information to obtain a third detection result.

[0140] S1108, if no cache interface chain matching the interface call chain is found in the interface call cache pool, after completing the call to the target interface, target interface call information of the target interface is generated; and the target interface call information is cached in the interface call cache pool.

[0141] S1110, when the target interface is an interface on an interface call chain and the interface type of the target interface is a context type, obtain access control information of a pre-built interface call chain; perform control policy detection on the chain call information according to the access control information to obtain a first detection result.

[0142] S1112, when the target interface is an interface on the interface call chain and the interface type of the target interface is a business type, determine the historical call information that matches the chain call information; perform a call detection on the historical call information according to the access control information to obtain a second detection result.

[0143] This application also provides an application scenario, which applies the security protection method of the above interface, referring to Fig.12 As shown in the system structure diagram, the API caller initiates an API call request, and the API call request is distributed through the load balancer ( Fig.12In process ①), after reaching the API gateway, the API gateway parses the API call request, obtains the parsing result, and performs identity authentication based on the parsing result. If the identity authentication fails, the preset error message is directly returned to the API caller; if the identity authentication passes, the metadata information describing the target API (API X) specified by the API call request is constructed in the form of JSON, XML, etc., and the metadata information of the target API (API X) is sent to the API security component ( Fig.12 In process ②), the metadata information is tested through the API security component to obtain the test results, and the test results are returned to the API gateway ( Fig.12 In process ③), when the detection result is not passed, the API gateway returns a response message of refusing to call the target API to the API caller through the load balancer; when the detection result is passed, but the interface type of the target API is a context type, the API gateway returns a response message of calling the target API to the API caller through the load balancer ( Fig.12 Process ④); when the detection result is passed and the interface type of the target API is a business type, the API gateway forwards the call traffic of the target API to the backend server corresponding to the target API ( Fig.12 Process ⑤), and receive resources obtained from the backend server ( Fig.12 Process ⑥), and returns the received resources to the API caller through the load balancer ( Fig.12 In the process ④).

[0144] The API security component detects metadata information and obtains the detection results in the following process:

[0145] refer to Fig.13After receiving the metadata information of the target API, the API security component can obtain the pre-built interface call chain and determine whether the target API is on the pre-built interface call chain. If so, determine whether the interface call chain has been cached in the cache pool. If not, cache the call information of the target API in the cache pool after completing the call to the target API; if it has been cached, obtain the cache call information of the cache interface call chain from the cache pool, and perform access logic detection on the metadata information based on the cache call information. If the access logic is abnormal, return the result of the detection failure to the API gateway, so that the API gateway determines that the interface call request for the target API is abnormal based on the result and refuses to call the target API. If the access logic is normal, determine the interface type of the target API. If the interface type is a context type, detect the metadata information according to the access control information of the pre-built interface call chain. If the metadata information is abnormal, return the detection result to the API gateway. A failed result is returned to the API gateway so that the API gateway determines that the interface call request for the target API is abnormal based on the result and refuses to call the target API. If the metadata information is normal, a passed result is returned to the API gateway so that the API gateway determines that the interface call request for the target API is normal based on the result and calls the target API; if the interface type is not a context type (i.e., a business type), historical call information that matches the chain call information is determined; an access logic check is performed on the historical call information according to the access control information. If the access logic is abnormal, a failed result is returned to the API gateway so that the API gateway determines that the interface call request for the target API is abnormal based on the result and refuses to call the target API. If the access logic is normal, a passed result is returned to the API gateway so that the API gateway determines that the interface call request for the target API is normal based on the result and calls the target API.

[0146] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0147] Based on the same inventive concept, the embodiment of the present application also provides an interface security protection device for implementing the interface security protection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the security protection device for one or more interfaces provided below can refer to the limitations of the interface security protection method above, and will not be repeated here.

[0148] In one embodiment, Fig.14 As shown, a security protection device for an interface is provided, including: an interface metadata generation module 1402, an interface call chain acquisition module 1404, a chain relationship detection module 1406 and an access control module 1408, wherein:

[0149] The interface metadata generation module 1402 is used to generate interface metadata according to the interface call request when the interface call request passes the security authentication; the interface metadata includes chain call information describing the target interface specified by the interface call request;

[0150] The interface call chain acquisition module 1404 is used to acquire a pre-built interface call chain;

[0151] The chain relationship detection module 1406 is used to perform a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result when the target interface is an interface on the interface call chain;

[0152] The access control module 1408 is used to perform access control on the target interface according to the chain relationship detection result.

[0153] In the above embodiment, after the interface call request passes the security authentication, interface metadata is generated according to the interface call request, the interface metadata includes chain call information describing the target interface specified by the interface call request, and a pre-built interface call chain is obtained. When the target interface is an interface on the interface call chain, a chain relationship detection is performed on the chain call information according to the interface call chain to obtain a chain relationship detection result, and access control is performed on the target interface according to the chain relationship detection result. By performing security authentication on the interface call request, the identity and authority of the caller can be ensured to be legal, unauthorized access and malicious calls can be prevented, and the security of the interface is enhanced; by generating interface metadata and obtaining a pre-built interface call chain, a chain relationship detection can be performed on the interface call, and access control is performed on the target interface based on the chain relationship detection result, so that the calling order and relationship of the interface can be ensured to comply with predefined rules, unauthorized access and malicious calls (such as scattered calls or disorderly calls) can be prevented, and the security and reliability of the interface can be enhanced; at the same time, the risk of leakage of the authentication key pair can be limited. Through strict chain call rules and access control, the possibility of abuse of the leaked authentication key pair is effectively reduced, and the security and protection capabilities of the interface are improved.

[0154] In one embodiment, the chain relationship detection result includes a first detection result; the interface metadata includes the interface type of the target interface; the chain relationship detection module 1406 is used to: when the interface type is a context type, obtain the access control information of the pre-built interface call chain; perform control policy detection on the chain call information according to the access control information to obtain the first detection result.

[0155] In one embodiment, the chain relationship detection module 1406 is also used to: determine the associated interface of the target interface, the calling interval between adjacent interfaces and the calling method of the associated interface based on the chain call information; detect the matching between the associated interface of the target interface, the calling interval between adjacent interfaces, and the calling method of the associated interface and the access control information, and obtain a first detection result; wherein the first detection result is that the detection is normal.

[0156] In one embodiment, the chain relationship detection result also includes a second detection result; the chain relationship detection module 1406 is also used to: when the interface type is a business type, determine the historical call information that matches the chain call information; perform call detection on the historical call information according to the access control information to obtain the second detection result.

[0157] In one embodiment, the chain relationship detection module 1406 is further used to: determine the associated interface of the target interface based on the chain call information; and determine the historical call information of the associated interface as the historical call information matching the chain call information.

[0158] In one embodiment, the chain relationship detection module 1406 is also used to: determine the historical call time interval and the historical call method based on the historical call information; detect the matching between the historical call time interval and the historical call method and the access control information respectively, and obtain a second detection result; wherein the second detection result is normal detection.

[0159] In one embodiment, the chain relationship detection result includes a third detection result; the chain relationship detection module 1406 is also used to: search for a cache interface chain that matches the interface call chain in the interface call cache pool; when the cache interface chain is found, obtain the cache chain call information corresponding to the cache interface chain; perform call detection on the chain call information according to the cache chain call information to obtain a third detection result.

[0160] In one embodiment, the chain relationship detection module 1406 is also used to: determine the cache call time interval and cache call mode based on the cache chain call information; detect the matching between the cache call time interval and the cache call mode and the chain call information respectively, to obtain a third detection result; wherein the third detection result is that the detection is normal.

[0161] In one embodiment, the chain relationship detection module 1406 is also used to: if a cache interface chain matching the interface call chain is not found in the interface call cache pool, then after completing the call to the target interface, generate target interface call information of the target interface; and cache the target interface call information in the interface call cache pool.

[0162] In one embodiment, Fig.15 As shown, the device also includes an interface call chain configuration module 1410, which is used to: obtain resource configuration information and access permission configuration information in response to a resource access configuration operation on a target business; and generate an interface call chain corresponding to the target business and access control information of the interface call chain based on the resource configuration information and access permission configuration information.

[0163] In one embodiment, the interface call chain includes at least two interfaces, and the authentication keys corresponding to the at least two interfaces are different.

[0164] In one embodiment, Fig.15 As shown, the device also includes a security authentication module 1412, which is used to: when receiving an interface call request, obtain an authentication key of the target interface specified in the interface call request; perform security authentication on the interface call request based on the authentication key to obtain a security authentication result;

[0165] The interface metadata generation module 1402 is further used to: when the security authentication result indicates that the interface call request passes the security authentication, generate interface metadata according to the interface call request.

[0166] Each module in the security protection device of the above interface can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0167] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.16 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store interface call chain data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a security protection method for an interface is implemented.

[0168] Those skilled in the art will understand that Fig.16 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0169] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0170] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0171] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0172] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0173] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0174] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0175] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for protecting an interface, characterized in that: The method comprises: When the interface call request passes the security authentication, interface metadata is generated according to the interface call request; the interface metadata includes chain call information describing the target interface specified by the interface call request; Get the pre-built interface call chain; When the target interface is an interface on the interface call chain, performing a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result; Access control is performed on the target interface according to the chain relationship detection result.

2. The method according to claim 1, characterized in that The chain relationship detection result includes a first detection result; the interface metadata includes an interface type of the target interface; The performing chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result includes: When the interface type is a context type, obtaining access control information of the pre-built interface call chain; A control policy detection is performed on the chain call information according to the access control information to obtain a first detection result.

3. The method according to claim 2, characterized in that The performing control strategy detection on the chain call information according to the access control information to obtain a first detection result includes: Determine, according to the chain call information, the associated interface of the target interface, the call interval between adjacent interfaces, and the call mode of the associated interface; Detect the matching between the associated interface of the target interface, the calling interval between adjacent interfaces, and the calling mode of the associated interface and the access control information, and obtain the first detection result; wherein, the first detection result is normal detection.

4. The method according to claim 2, characterized in that: The chain relationship detection result also includes a second detection result; the chain relationship detection is performed on the chain call information according to the interface call chain to obtain the chain relationship detection result, including: When the interface type is a business type, determining historical call information matching the chain call information; Perform a call detection on the historical call information according to the access control information to obtain the second detection result.

5. The method according to claim 4, characterized in that The determining of the historical call information matching the chain call information includes: Determine an associated interface of the target interface based on the chain call information; The historical call information of the associated interface is determined as the historical call information matching the chain call information.

6. The method according to claim 4, characterized in that The performing call detection on the historical call information according to the access control information to obtain the second detection result includes: Determine a historical call time interval and a historical call mode based on the historical call information; The matching between the historical calling time interval and the historical calling mode and the access control information is detected to obtain the second detection result; wherein the second detection result is normal.

7. The method according to claim 1, characterized in that The chain relationship detection result includes a third detection result; the chain relationship detection is performed on the chain call information according to the interface call chain to obtain the chain relationship detection result, including: Searching the interface call cache pool for a cache interface chain that matches the interface call chain; When the cache interface chain is found, the cache chain call information corresponding to the cache interface chain is obtained; A call detection is performed on the chain call information according to the cache chain call information to obtain the third detection result.

8. The method according to claim 7, characterized in that The performing call detection on the chain call information according to the cache chain call information to obtain the third detection result includes: Determine a cache call time interval and a cache call mode based on the cache chain call information; The matching between the cache call time interval and the cache call mode and the chain call information is detected to obtain the third detection result; wherein the third detection result is that the detection is normal.

9. The method according to claim 7, characterized in that: The method further comprises: If no cache interface chain matching the interface call chain is found in the interface call cache pool, after completing the call to the target interface, target interface call information of the target interface is generated; The target interface call information is cached in the interface call cache pool.

10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: In response to a resource access configuration operation on a target business, obtaining resource configuration information and access permission configuration information; Based on the resource configuration information and the access permission configuration information, an interface call chain corresponding to the target business and access control information of the interface call chain are generated.

11. The method according to claim 10, characterized in that The interface call chain includes at least two interfaces, and the authentication keys corresponding to the at least two interfaces are different.

12. The method according to any one of claims 1 to 9, characterized in that The method further comprises: When an interface call request is received, obtaining an authentication key of a target interface specified in the interface call request; Perform security authentication on the interface call request based on the authentication key to obtain a security authentication result; When the interface call request passes the security authentication, generating interface metadata according to the interface call request includes: When the security authentication result indicates that the interface call request passes the security authentication, interface metadata is generated according to the interface call request.

13. A safety protection device for an interface, characterized in that: The device comprises: An interface metadata generation module, used to generate interface metadata according to an interface call request when the interface call request passes the security authentication; the interface metadata includes chain call information describing the target interface specified by the interface call request; The interface call chain acquisition module is used to obtain the pre-built interface call chain; A chain relationship detection module, used for performing a chain relationship detection on the chain call information according to the interface call chain to obtain a chain relationship detection result when the target interface is an interface on the interface call chain; An access control module is used to perform access control on the target interface according to the chain relationship detection result.

14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.

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

Citation Information

Cited By

  • Security authentication method and system based on universal interface of server

    CN122093058A