Kong gateway-based plug-in parameter validity verification building method and device, and medium
The modular verification plugin check_plugin automates the verification of Kong gateway plugin parameters, resolving the proxy service failure issue caused by native plugin configuration errors. It provides clear error messages and automatic repair functions, improving configuration efficiency and system reliability.
Patent Information
- Application Number
- CN202510956939.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2025-10-31
AI Technical Summary
The native plugin for the Kong gateway lacks validation functionality when configuring key parameters, making it easy for typos to cause proxy service failures. Furthermore, it lacks user-friendly error messages, requiring maintenance personnel to spend a significant amount of time locating and fixing configuration errors.
The check_plugin, a verification plugin with a modular design, is configured and automatically verifies plugin parameters through the Konga client. It includes integrity checks, syntax and semantic analysis, and provides multi-channel error messages and automatic repair suggestions.
It enables automated verification of plugin parameters, improving configuration efficiency and system reliability, reducing operation and maintenance costs, and enhancing the accuracy of business decisions and system performance.
Smart Images

Figure CN120880935A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software design technology, specifically to a method, device, and medium for establishing a plugin parameter validity verification system based on a Kong gateway. Background Technology
[0002] In recent years, with the rapid development of information technology, various information systems have brought greater convenience and assistance to people's lives and work. Service instances may run on different hosts and ports, and the Kong gateway knows the location of each service through its service discovery mechanism. When a request arrives, the API gateway performs dynamic routing, that is, it determines which service instance to forward the request to based on the request content, such as the URL path, request parameters, or header information. This dynamic routing mechanism allows clients to disregard the specific location of the backend service, ensuring service scalability and transparency for service consumers.
[0003] However, the native Kong gateway plugin currently suffers from a lack of parameter validation. The native plugin lacks validation functionality when configuring key parameters (such as log forwarding address, port, protocol, etc.), which can easily lead to proxy service failure due to writing errors. If users enter incorrect information, it may cause proxy forwarding to fail, and it is difficult to quickly locate the problem. There is a lack of user-friendly error prompts, and maintenance personnel need to spend a lot of time locating and fixing configuration errors. Summary of the Invention
[0004] The technical objective of this invention is to provide a method, device, and medium for verifying the validity of plugin parameters based on the Kong gateway. This addresses the problems of the inability to automatically verify key parameters when users use native plugins on the Kong gateway, the susceptibility of proxy service failure due to writing errors, the lack of user-friendly error messages, and the significant time required for maintenance personnel to locate and fix configuration errors.
[0005] The technical objective of this invention is achieved as follows: a method for establishing a plugin parameter validity verification system based on a Kong gateway, the specific method of which is as follows:
[0006] The check_plugin is designed with a modular structure.
[0007] Place the verification plugin check_plugin in Kong's custom plugin directory, configure plugins=bundled,check_plugin in kong.conf, and import the verification plugin check_plugin using the Konga client;
[0008] The plugins used to configure the proxy service using the Konga client;
[0009] Automated verification: First, the completeness of the required parameters of each plugin used is checked. When filling in the parameters, the monitoring mechanism is triggered. Then, the parameter format is analyzed in terms of syntax and semantics. Finally, context-related validation is performed on the filled HTTP request parameters.
[0010] The backend analyzes the configured parameters, that is, it analyzes the results returned by each plugin based on the content of the request; where the content of the request is the URL path, request parameters or header information;
[0011] The check_plugin is used to determine whether the analysis was successful.
[0012] If successful, a success message will be displayed on the page;
[0013] If unsuccessful, the verification result will be returned through multiple channels including API, logs, and interface, providing tiered error messages (error / warning / suggestion), generating detailed repair guidance documentation, and supporting automatic repair suggestions (one-click correction function).
[0014] As a preferred option, the check_plugin validation plugin includes a parameter parser, a rule engine, and a feedback processor;
[0015] The parameter parser is used to automatically scan the native Kong plugin after the validation plugin check_plugin is deployed. It uses a global table to store the cached scan data, uses the dofile method to pre-write the .lua files of the native plugin, extracts the fields required by the parameters of each .lua file, and combines the known field validation rules to put the extracted and standardized configuration parameters from the Konga client into the global table.
[0016] The rule engine is used to access the global table, pass the extracted parameter configuration to the rule engine for processing, and activate the pre-written plugin rule logic according to different native plugins. When using any native plugin later, you can directly reference the rule.
[0017] When using native plugins, the feedback processor prioritizes calling the validation logic in the rules engine; if the requirements are not met, a structured error report is generated on the page, and the user can modify the parameters based on the report content.
[0018] As a preferred option, the plugins used to configure the proxy service using the Konga client are as follows:
[0019] Automatically identify plugin types and load corresponding verification templates: After selecting the native plugin to be verified, the verification plugin check_plugin calls the verification logic already written in the rule engine;
[0020] Real-time monitoring of parameter changes triggers a pre-validation mechanism. The logic activated in the rule engine calls the monitoring mechanism when the user inputs parameters. If the input parameters are detected to be inconsistent with the requirements of the validation plugin check_plugin, an error message will be displayed before the input is completed.
[0021] Better yet, when the native plugin is a logging plugin, the logging plugin's verification method is called to verify the compliance of the request address, request method, and request timeout parameters;
[0022] When the native plugin is a rate limiting plugin, the verification method of the rate limiting plugin is called to verify the compliance of the request size limit and request traffic limit parameters.
[0023] As a preferred approach, the monitoring mechanism is as follows: the logic in the rule engine is called when the native plugin is used, defined by the debug.sethook function, to monitor the required parameters of the request address, request method, and restriction conditions. If the request does not conform to the rule logic written by the rule engine, the user is prompted to make modifications.
[0024] As a preferred approach, the parameter format is subjected to syntactic and semantic analysis as follows:
[0025] When filling in parameters, the string.byte() and string.find functions are called to convert the characters to their corresponding ASCII codes;
[0026] Check whether the parameter is within the ASCII code range of English letters to prevent non-compliant parameters from appearing in the check_plugin validation plugin.
[0027] As a preferred approach, context-related validation is performed on the entered HTTP request parameters as follows:
[0028] Automatically assemble the request method, request parameters, and request address parameters into a complete request for pre-requesting;
[0029] Check the return value to see if it matches the expected result.
[0030] As a preferred option, the verification process of the check_plugin is as follows:
[0031] (1) Configure the Kong proxy service to use the check_plugin for verification;
[0032] (2) The configuration of the check_plugin is as follows: select the service that needs to be proxied by the check_plugin and select the native plugin that needs to be verified;
[0033] (3) Save and submit to the backend for verification processing;
[0034] (4) The backend verifies the validity of each native plugin:
[0035] ① If there are no problems, a message will appear indicating that the save was successful;
[0036] ②If there is a problem, an error message will be displayed and the problem with the native plugin will be pointed out.
[0037] An electronic device includes: a memory and at least one processor;
[0038] The memory contains computer programs;
[0039] The at least one processor executes the computer program stored in the memory, causing the at least one processor to execute the above-described method for verifying the validity of plug-in parameters based on the Kong gateway.
[0040] A computer-readable storage medium storing a computer program that can be executed by a processor to implement the above-described method for verifying the validity of plug-in parameters based on a Kong gateway.
[0041] The method, device, and medium for verifying the validity of plug-in parameters based on the Kong gateway of the present invention have the following advantages:
[0042] (i) Users of this invention can automatically complete parameter verification and obtain clear error prompts when configuring plugins, thereby improving configuration efficiency and system reliability. This solves the problems that when users configure Kong gateway plugins, key parameters have no verification function, and the proxy service is prone to failure due to writing errors. Furthermore, the lack of user-friendly error prompts means that maintenance personnel need to spend a lot of time locating and repairing configuration errors.
[0043] (ii) This invention effectively solves the core pain point that users cannot automatically verify key parameters when using the Kong gateway native plugin through an innovative parameter verification mechanism. It can not only improve the accuracy of business decisions and optimize system performance, but also discover potential system configuration patterns and abnormal modes through intelligent data analysis.
[0044] (III) This invention plays a crucial supporting role in functions such as acquiring access volume, service request statistics, and the latest published service list. The main function of the data analysis plugin is to help users perform data analysis more efficiently, thereby improving the accuracy of business decisions and optimizing product performance. It also helps users observe and analyze data more intuitively and discover misalignments in the configuration process. By prompting error and abnormal requests for rectification, it reduces the time cost of finding and modifying errors, greatly saving operation and maintenance costs. Attached Figure Description
[0045] The invention will be further described below with reference to the accompanying drawings.
[0046] Appendix Figure 1 This is a flowchart illustrating the method for establishing a plugin parameter validity verification system based on the Kong gateway. Detailed Implementation
[0047] The following detailed description of the method, equipment, and medium for verifying the validity of plug-in parameters based on the Kong gateway of the present invention is provided with reference to the accompanying drawings and specific embodiments.
[0048] Example 1:
[0049] As attached Figure 1 As shown in the figure, this embodiment provides a method for establishing a plugin parameter validity verification system based on the Kong gateway. The method is as follows:
[0050] S1. The check_plugin verification plugin is designed with a modular structure.
[0051] S2. Place the verification plugin check_plugin into Kong's custom plugin directory, configure plugins=bundled,check_plugin in kong.conf, and import the verification plugin check_plugin using the Konga client;
[0052] S3. Configure the plugins used for the proxy service using the Konga client;
[0053] S4. Automated Validation: First, perform an integrity check on the required parameters of each plugin used. Trigger a monitoring mechanism when filling in the parameters. Then, perform syntax and semantic analysis on the parameter format and perform context-related validation on the filled HTTP request parameters.
[0054] S5. The backend analyzes the configured parameters, that is, it analyzes the results returned by each plugin based on the content of the request; where the content of the request is the URL path, request parameters or header information;
[0055] S6. Verify the plugin check_plugin to determine if the analysis was successful:
[0056] ① If successful, a success message will be displayed on the page;
[0057] ②If unsuccessful, the verification result will be returned through multiple channels such as API / log / interface, providing hierarchical error prompts (error / warning / suggestion), generating detailed repair guidance documents, and supporting automatic repair suggestions (one-click correction function).
[0058] In step S1 of this embodiment, the verification plugin check_plugin includes a parameter parser, a rule engine, and a feedback processor;
[0059] The parameter parser is used to automatically scan the native Kong plugin after the validation plugin check_plugin is deployed. It uses a global table to store the cached scan data, uses the dofile method to pre-write the .lua files of the native plugin, extracts the fields required by the parameters of each .lua file, and combines the known field validation rules to put the extracted and standardized configuration parameters from the Konga client into the global table.
[0060] The rule engine is used to access the global table, pass the extracted parameter configuration to the rule engine for processing, and activate the pre-written plugin rule logic according to different native plugins. When using any native plugin later, you can directly reference the rule.
[0061] When using native plugins, the feedback processor prioritizes calling the validation logic in the rules engine; if the requirements are not met, a structured error report is generated on the page, and the user can modify the parameters based on the report content.
[0062] The installation steps for the verification plugin check_plugin in step S1 of this embodiment are as follows:
[0063] S101. Locate the directory where Kong plugins are stored, which is usually \kong\plugins. Place the plugins in this directory.
[0064] S102. Modify the kong.conf configuration file. The configuration file is usually stored in / etc / kong. Modify the kong.conf file node: plugins=bundled,check_plugin.
[0065] S103, Restart the Kong gateway.
[0066] The specific plugins used in step S3 of this embodiment to configure the proxy service using the Konga client are as follows:
[0067] S301. Automatically identify plugin types and load corresponding verification templates: After selecting the native plugin to be verified, the verification plugin check_plugin calls the verification logic already written in the rule engine.
[0068] S302. Real-time monitoring of parameter changes triggers a pre-validation mechanism. The logic activated in the rule engine calls the monitoring mechanism when the user inputs parameters. If the input parameters are detected to be inconsistent with the requirements of the validation plugin check_plugin, an error message will be displayed before the input is completed.
[0069] In this embodiment, when the native plugin is a logging plugin, the logging plugin's verification method is called to verify the compliance of the request address, request method, and request timeout parameters.
[0070] In this embodiment, when the native plugin is a rate limiting plugin, the verification method of the rate limiting plugin is called to verify the compliance of the request size limit and request traffic limit parameters.
[0071] The monitoring mechanism in this embodiment is as follows: the logic in the rule engine is called when the native plugin is used by defining the debug.sethook function, and the required parameters of the request address, request method and restriction conditions are monitored. If the request does not conform to the rule logic written by the rule engine, the user is prompted to make modifications.
[0072] The specific steps of performing syntax and semantic analysis on the parameter format in step S4 of this embodiment are as follows:
[0073] S4-101. When filling in parameters, call the string.byte() and string.find functions to convert the characters into their corresponding ASCII codes;
[0074] S4-102. Determine whether the parameter is within the ASCII code range of English letters to prevent non-compliant parameters from appearing in the check_plugin validation plugin.
[0075] In step S4 of this embodiment, the execution context-related verification specifically checks the entered HTTP request parameters as follows:
[0076] S4-201, automatically assemble the request method, request parameters, and request address parameters into a complete request for pre-request;
[0077] S4-202. Check the return value to see if it is the expected result.
[0078] The verification process of the check_plugin in this embodiment is as follows:
[0079] (1) Configure the Kong proxy service to use the check_plugin for verification;
[0080] (2) The configuration of the check_plugin is as follows: select the service that needs to be proxied by the check_plugin and select the native plugin that needs to be verified;
[0081] (3) Save and submit to the backend for verification processing;
[0082] (4) The backend verifies the validity of each native plugin:
[0083] ① If there are no problems, a message will appear indicating that the save was successful;
[0084] ②If there is a problem, an error message will be displayed and the problem with the native plugin will be pointed out.
[0085] Example 2:
[0086] This embodiment also provides an electronic device, including: a memory and a processor;
[0087] The memory stores the instructions executed by the computer.
[0088] The processor executes the computer execution instructions stored in the memory, causing the processor to execute the plug-in parameter validity verification method based on the Kong gateway in any embodiment of the present invention.
[0089] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor can be a microprocessor or any conventional processor.
[0090] Memory is used to store computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, at least one application program required for a function, etc.; the data storage area can store data created based on the use of the terminal, etc. In addition, memory can also include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart memory cards (SMC), secure digital cards (SD cards), flash memory cards, at least one disk storage device, flash memory devices, or other volatile solid-state storage devices.
[0091] Example 3:
[0092] This embodiment also provides a computer-readable storage medium storing multiple instructions, which are loaded by a processor to cause the processor to execute the plug-in parameter validity verification method based on the Kong gateway in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium may be provided, on which software program code implementing the functions of any of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device may read and execute the program code stored in the storage medium.
[0093] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.
[0094] Storage media embodiments for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.
[0095] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0096] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion unit connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion unit execute some and all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for establishing a plugin parameter validity verification system based on a Kong gateway, characterized in that, The method is as follows: The check_plugin is designed with a modular structure. Place the verification plugin check_plugin in Kong's custom plugin directory, configure plugins=bundled,check_plugin in kong.conf, and import the verification plugin check_plugin using the Konga client; The plugins used to configure the proxy service using the Konga client; Automated verification: First, the completeness of the required parameters of each plugin used is checked. When filling in the parameters, the monitoring mechanism is triggered. Then, the parameter format is analyzed in terms of syntax and semantics. Finally, context-related validation is performed on the filled HTTP request parameters. The backend analyzes the configured parameters, that is, it analyzes the results returned by each plugin based on the content of the request; where the content of the request is the URL path, request parameters or header information; The check_plugin is used to determine whether the analysis was successful. If successful, a success message will be displayed on the page; If unsuccessful, the verification result will be returned through multiple channels including API, logs, and interface, providing tiered error messages, generating detailed repair guidance documents, and supporting automatic repair suggestions.
2. The method for establishing a plugin parameter validity verification system based on a Kong gateway according to claim 1, characterized in that, The check_plugin validation plugin includes a parameter parser, a rule engine, and a feedback processor. The parameter parser is used to automatically scan the native Kong plugin after the validation plugin check_plugin is deployed. It uses a global table to store the cached scan data, uses the dofile method to pre-write the .lua files of the native plugin, extracts the fields required by the parameters of each .lua file, and combines the known field validation rules to put the extracted and standardized configuration parameters from the Konga client into the global table. The rule engine is used to access the global table, pass the extracted parameter configuration to the rule engine for processing, and activate the pre-written plugin rule logic according to different native plugins. When using any native plugin later, you can directly reference the rule. The feedback processor is used to prioritize calling the validation logic in the rule engine when using native plugins; If the requirements are not met, a structured error report will be generated on the page, and the user can modify the parameters according to the report content.
3. The method for establishing a plugin parameter validity verification system based on a Kong gateway according to claim 1, characterized in that, The plugins used to configure the proxy service using the Konga client are as follows: Automatically identify plugin types and load corresponding verification templates: After selecting the native plugin to be verified, the verification plugin check_plugin calls the verification logic already written in the rule engine; Real-time monitoring of parameter changes triggers a pre-validation mechanism. The logic activated in the rule engine calls the monitoring mechanism when the user inputs parameters. If the input parameters are detected to be inconsistent with the requirements of the validation plugin check_plugin, an error message will be displayed before the input is completed.
4. The method for establishing a plugin parameter validity verification system based on a Kong gateway according to claim 3, characterized in that, When the native plugin is a logging plugin, the logging plugin's verification method is called to verify the compliance of the request address, request method, and request timeout parameters; When the native plugin is a rate limiting plugin, the verification method of the rate limiting plugin is called to verify the compliance of the request size limit and request traffic limit parameters.
5. The method for establishing a plugin parameter validity verification system based on a Kong gateway according to claim 1, characterized in that, The monitoring mechanism works as follows: the native plugin is defined in the debug.sethook function to call the logic in the rule engine when it is used, and monitors the required parameters of the request address, request method and restriction conditions. If it does not conform to the rule logic written in the rule engine, the user is prompted to make modifications.
6. The method for establishing a plugin parameter validity verification system based on a Kong gateway according to claim 1, characterized in that, The syntax and semantic analysis of the parameter format is performed as follows: When filling in parameters, the string.byte() and string.find functions are called to convert the characters to their corresponding ASCII codes; Check whether the parameter is within the ASCII code range of English letters to prevent non-compliant parameters from appearing in the check_plugin validation plugin.
7. The method for establishing a plugin parameter validity verification system based on a Kong gateway according to claim 1, characterized in that, Perform context-related validations on the entered HTTP request parameters as follows: Automatically assemble the request method, request parameters, and request address parameters into a complete request for pre-requesting; Check the return value to see if it matches the expected result.
8. The method for establishing a plugin parameter validity verification system based on a Kong gateway according to claim 1, characterized in that, The verification process of the check_plugin is as follows: (1) Configure the Kong proxy service to use the check_plugin for verification; (2) The configuration of the check_plugin is as follows: select the service that needs to be proxied by the check_plugin and select the native plugin that needs to be verified; (3) Save and submit to the backend for verification processing; (4) The backend verifies the validity of each native plugin: ①If there are no problems, a message will appear indicating that the save was successful; ②If there is a problem, an error message will be displayed and the problem with the native plugin will be pointed out.
9. An electronic device, characterized in that, include: Memory and at least one processor; The memory contains computer programs; The at least one processor executes the computer program stored in the memory, causing the at least one processor to perform the plug-in parameter validity verification construction method based on the Kong gateway as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed by a processor to implement the plug-in parameter validity verification method based on the Kong gateway as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Gateway system and loading method of custom plug-in thereof
CN116431238A
Method for processing type conversion abnormity when request-transfer plug-in of Kong gateway is transmitted into null array
CN117812003A
Cloud application configuration parameter verification method and device, electronic equipment and storage medium
CN119556976A
Systems and methods for monitor an access gateway
US20100138534A1