Code reuse processing method and device
By analyzing and quering the code files and script files of the online business, and combining the pre-configured code reuse inspection strategy, suspected code reuse messages are generated and risk identification are detected, the problem of inability to effectively check the reuse of code and database configuration in the existing technology is solved, comprehensive inspection and risk management of code reuse is realized, and the security and stability of the system are improved.
Patent Information
- Application Number
- CN202411628082.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-28
AI Technical Summary
The prior art cannot effectively check the reuse of code and database configuration, which makes it difficult to ensure the security and quality of the production environment.
By obtaining the code files and script files for the business to be launched, submitting them to the version management tool for analysis, determining the full code of the host object, and using a pre-configured code reuse check strategy, querying the association analysis table and transaction information to generate suspected code reuse packets and identify risks.
It realizes comprehensive inspection and risk management of code reuse, improves the security and stability of the system, reduces potential security risks and compatibility issues, and improves development efficiency and code quality.
Smart Images

Figure CN119536718A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a code reuse processing method and device. Background Art
[0002] In the era of rapid development of the Internet, the phenomenon of code resource reuse is common. As production safety issues are increasingly valued, a comprehensive inspection of the reuse of code and its database configuration must be carried out before each business deployment, and all reuse situations must be verified, which is crucial to improving the safety and quality of the production environment. At present, there are few effective inspection methods for code and database configuration reuse, so it is particularly urgent to explore and implement a more efficient and reliable inspection mechanism. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a code reuse processing method and device, which can at least solve the problem that the reuse of code and database configuration cannot be checked in the prior art.
[0004] To achieve the above object, according to one aspect of an embodiment of the present invention, a code reuse processing method is provided, comprising:
[0005] Obtain code files and script files for the business to be launched, submit the code files and script files to the version management tool for analysis and processing, and obtain a list; wherein the list includes the transaction code;
[0006] Determine the host object of the business to be launched, access the full code of the host object in the server to query the information related to each transaction code;
[0007] Determine an association analysis table in a database, use a code reuse check strategy configured in advance for the association analysis table, determine transaction information related to the association analysis table, and query information related to each transaction code in the association analysis table and the transaction information;
[0008] In response to the query operation being completed, based on the information related to each transaction code, a suspected code reuse message is generated and sent to the audit node for risk identification, so as to issue an alarm reminder if the identification result shows that there is a risk.
[0009] Optionally, the association analysis table is a request input domain table, and the determining of transaction information related to the association analysis table to query information related to each transaction code in the association analysis table and the transaction information includes:
[0010] querying in the request input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the request input domain table;
[0011] Identify the secondary inter-network transaction associated with each transaction code, obtain the request record corresponding to each transaction code from the secondary inter-network transaction, and obtain the request parameter from the request record.
[0012] Optionally, the association analysis table is a transaction input domain table, and the determining of transaction information related to the association analysis table to query information related to each transaction code in the association analysis table and the transaction information includes:
[0013] querying in the transaction input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the transaction input domain table;
[0014] Identify the secondary inter-network transaction associated with each transaction code, obtain a request record corresponding to each transaction code from the secondary inter-network transaction, and obtain a request parameter from the request record;
[0015] Accessing the backend code file of the relevant host object in the server to obtain the code related to each transaction code;
[0016] According to the transaction code mapping table, the historical transaction code corresponding to each transaction code is determined, and then the historical code related to the historical transaction code is obtained.
[0017] Optionally, the association analysis table is a system parameter table, and the determining of transaction information related to the association analysis table to query information related to each transaction code in the association analysis table and the transaction information includes:
[0018] The system parameter table is queried to determine whether each transaction code exists, and in response to a query result that each transaction code exists, a request parameter corresponding to each transaction code in the system parameter table is obtained.
[0019] Optionally, the code files and script files are submitted to a version management tool for analysis and processing to obtain a list, including:
[0020] Submitting the code file to a version management tool for analysis and processing to obtain a first list; and submitting the script file to a version management tool for analysis and processing to obtain a second list;
[0021] Using a preset format conversion method, converting the formats of the transaction codes in the first list and the second list, integrating the first list and the second list after the format conversion to obtain a list; or
[0022] The first list and the second list are integrated to obtain a list, and a preset format conversion method is used to convert the format of the transaction code in the list.
[0023] Optionally, the full code includes a front-end page file and a back-end code file, and the querying of information related to each transaction code includes:
[0024] Using a preset first query method, querying a code related to each transaction code from the front-end page file;
[0025] The preset second query method is used to query the code related to each transaction code from the backend code file.
[0026] To achieve the above object, according to another aspect of an embodiment of the present invention, a code multiplexing processing device is provided, comprising:
[0027] The analysis module is used to obtain the code files and script files of the business to be launched, submit the code files and script files to the version management tool for analysis and processing, and obtain a list; wherein the list includes the transaction code;
[0028] The information determination module is used to determine the host object of the business to be launched, access the full code of the host object in the server, and query the information related to each transaction code;
[0029] Determine an association analysis table in a database, use a code reuse check strategy configured in advance for the association analysis table, determine transaction information related to the association analysis table, and query information related to each transaction code in the association analysis table and the transaction information;
[0030] The risk identification module is used to generate a suspected code reuse message in response to the completion of the query operation based on the information related to each transaction code and send it to the audit node for risk identification, so as to issue an alarm reminder when the identification result shows that there is a risk.
[0031] Optionally, the association analysis table is a request input domain table, and the information determination module is used to:
[0032] querying in the request input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the request input domain table;
[0033] Identify the secondary inter-network transaction associated with each transaction code, obtain the request record corresponding to each transaction code from the secondary inter-network transaction, and obtain the request parameter from the request record.
[0034] Optionally, the association analysis table is a transaction input domain table, and the information determination module is used to:
[0035] querying in the transaction input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the transaction input domain table;
[0036] Identify the secondary inter-network transaction associated with each transaction code, obtain a request record corresponding to each transaction code from the secondary inter-network transaction, and obtain a request parameter from the request record;
[0037] Accessing the backend code file of the relevant host object in the server to obtain the code related to each transaction code;
[0038] According to the transaction code mapping table, the historical transaction code corresponding to each transaction code is determined, and then the historical code related to the historical transaction code is obtained.
[0039] Optionally, the association analysis table is a system parameter table, and the information determination module is used to:
[0040] The system parameter table is queried to determine whether each transaction code exists, and in response to a query result that each transaction code exists, a request parameter corresponding to each transaction code in the system parameter table is obtained.
[0041] Optionally, the analysis module is used to:
[0042] Submitting the code file to a version management tool for analysis and processing to obtain a first list; and submitting the script file to a version management tool for analysis and processing to obtain a second list;
[0043] Using a preset format conversion method, converting the formats of the transaction codes in the first list and the second list, integrating the first list and the second list after the format conversion to obtain a list; or
[0044] The first list and the second list are integrated to obtain a list, and a preset format conversion method is used to convert the format of the transaction code in the list.
[0045] Optionally, the full code includes a front-end page file and a back-end code file, and the information determination module is used to:
[0046] Using a preset first query method, querying a code related to each transaction code from the front-end page file;
[0047] The preset second query method is used to query the code related to each transaction code from the backend code file.
[0048] To achieve the above objective, according to another aspect of an embodiment of the present invention, a code multiplexing processing electronic device is provided.
[0049] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-mentioned code reuse processing methods.
[0050] To achieve the above object, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned code reuse processing methods is implemented.
[0051] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer program product is provided. A computer program product according to an embodiment of the present invention includes a computer program, and when the program is executed by a processor, the code reuse processing method provided by the embodiment of the present invention is implemented.
[0052] According to the solution provided by the present invention, an embodiment of the above invention has the following advantages or beneficial effects: by performing data cleaning on the code files and script files of the online business, obtaining the transaction code to be matched, and using the internal code logic to perform automatic reuse checks, it is ensured that no verification content is missed due to human negligence, thereby achieving comprehensive inspection and risk management of code reuse, improving the security and stability of the system, reducing potential safety hazards and compatibility issues, and improving development efficiency and code quality.
[0053] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0055] Figure 1 This is a schematic diagram of the main flow of a code reuse processing method according to an embodiment of the present invention;
[0056] FIG2 (a) is a schematic flow chart of an optional code reuse processing method according to an embodiment of the present invention;
[0057] FIG2( b ) is a schematic flow chart of another optional code reuse processing method according to an embodiment of the present invention;
[0058] Figure 3 is a schematic diagram of main modules of a code reuse processing device according to an embodiment of the present invention;
[0059] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0060] Figure 5 It is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0061] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0062] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0063] In the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The acquisition, transmission, storage, use, and processing of data in the technical solution of the present invention are in compliance with the relevant provisions of national laws and regulations, and are used for legal and reasonable purposes, and are not shared, disclosed, or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities.
[0064] For user information, necessary measures should be taken to prevent illegal access to such personal information data, ensure that persons who have access to personal information data comply with relevant laws and regulations, and ensure the security of user personal information. Once such user personal information data is no longer needed, risks should be minimized by limiting or even prohibiting data collection and / or deleting data. When applicable, including in certain relevant applications, protect user privacy by de-identifying data, such as by removing specific identifiers (e.g., date of birth, etc.), controlling the amount or specificity of stored data (e.g., collecting location data at the city level rather than at the specific address level), controlling how data is stored, and / or other methods of de-identification.
[0065] Code reuse generally occurs in the following scenarios:
[0066] 1. Modular development: In large software projects, functions are divided into multiple modules to facilitate the reuse of the same code between different projects or different functions.
[0067] 2. Open source libraries and frameworks: Developers use open source libraries and frameworks to speed up the development process. These libraries and frameworks contain a lot of reusable code.
[0068] 3. Legacy system maintenance: When maintaining and updating old systems, developers may reuse existing code to reduce development time and costs.
[0069] 4. Teamwork: In team development, developers may reuse code already written by their colleagues to improve work efficiency.
[0070] 5. Templates and design patterns: Using design patterns and code templates can help developers reuse similar code structures and logic in different projects.
[0071] 6. API call: By calling existing APIs, developers can reuse the functionality of remote services without having to reimplement the same logic.
[0072] 7. Configuration files and scripts: When deploying and configuring the environment, reusing existing configuration files and scripts can reduce duplication of work and improve consistency.
[0073] Although code reuse can improve development efficiency and reduce duplication of work, it may also bring some problems, mainly including:
[0074] 1. Security risks: The reused code may have security vulnerabilities. If these vulnerabilities are not fixed in time, the entire system may be threatened.
[0075] 2. Compatibility issues: Code reuse between different projects or modules may cause compatibility issues, especially when versions are updated or dependencies change.
[0076] 3. Difficulty in maintenance: Reused code may be scattered across multiple projects, making maintenance complicated. If a function needs to be modified, it may need to be updated in multiple places.
[0077] 4. Intellectual property issues: When using open source libraries or third-party codes, there may be authorization and intellectual property issues involved. Failure to comply with relevant licensing agreements may lead to legal risks.
[0078] 5. Performance issues: Reused code may not be suitable for a specific scenario, resulting in performance degradation. For example, general code may not perform optimally in a specific situation.
[0079] 6. Inconsistent code quality: The reused code may come from different developers or teams, resulting in inconsistent code style and quality, affecting the readability and maintainability of the overall code.
[0080] To address these issues, the development team should adopt reasonable management and review mechanisms to ensure the security and effectiveness of code reuse.
[0081] See also Figure 1, which shows a main flow chart of a code reuse processing method provided by an embodiment of the present invention, comprising the following steps:
[0082] S101: Obtain code files and script files of the business to be launched, submit the code files and script files to a version management tool for analysis and processing, and obtain a list; wherein the list includes a transaction code;
[0083] S102: Determine the host object of the service to be launched, access the full code of the host object in the server, and query the information related to each transaction code;
[0084] S103: determining an association analysis table in a database, using a code reuse check strategy configured in advance for the association analysis table, determining transaction information related to the association analysis table, and querying information related to each transaction code in the association analysis table and the transaction information;
[0085] S104: In response to the query operation being completed, based on the information related to each transaction code, a suspected code reuse message is generated and sent to the audit node for risk identification, so as to issue an alarm reminder if the identification result indicates that there is a risk.
[0086] In the above implementation, this solution describes in detail the inspection logic of code and database configuration reuse, and designs a method for internal code reuse security inspection in an enterprise to provide more rigorous protection for safe production. In the current era of paying attention to Internet security, the deployment security of code and database is more important. Without this resource reuse inspection, it is very likely that verification of production branches will be missed, leading to production problems. Resource reuse inspection provides enterprises with more rigorous logical verification to ensure that there is no missed verification content due to factors such as human forgetfulness.
[0087] For step S101, first determine the services to be launched, such as transfer services, login services, and query services, and then obtain the code files and scripts corresponding to these services. The code files and scripts of the services are independent of each other. The code files are mainly responsible for implementing business functions, while the scripts are responsible for automation and auxiliary tasks to ensure that the services can be deployed and run smoothly:
[0088] 1) Code files: These are source code files that implement specific business logic. For example, in a money transfer business, code files may include classes or functions for processing transfer requests, verifying user identities, updating account balances, etc. Common code file extensions include .java (Java), .py (Python), .js (JavaScript), etc.
[0089] 2) Scripts: These are script files used to automate tasks, usually for configuration, deployment, testing, or maintenance operations. For example, before going online, you may need to run some pre-check scripts, database migration scripts, or environment configuration scripts. Common script file extensions include .sh (Shell script), .sql (SQL script), .bat or .ps1 (Windows batch script), etc.
[0090] Next, submit these code files and scripts to the version management tool Git for analysis, and obtain the specific submission content through the Git version submission record, so as to obtain a list including transaction codes. For example, for the transfer business, you can obtain the relevant code change records, including the newly added or modified transaction codes, to form a detailed list for further review and verification.
[0091] In this solution, the version management tool Git is required to analyze the code files and scripts respectively to obtain a list. Taking the code file as an example, for example, to ensure that each submission has clear submission information, including the business name and change description, use the Git command to analyze the submission history and extract the content and change information of each submission. Then extract key information from the submission history, such as transaction code, file path, modification type, etc. This solution preferably considers the transaction code. The process of obtaining the list of script files including the transaction code is similar.
[0092] In actual operation, the transaction codes included in the list of code files and the list of script files may be different. For example, the list of code files includes three transaction codes 123, while the list of script files includes four 1234. Therefore, it is necessary to integrate these two lists to obtain the list of the business to be launched, including the four transaction codes 1234. For example, for the transfer business, the above steps can be used to obtain the list of transaction codes to ensure that all changes are recorded and reviewed.
[0093] Furthermore, in actual operation, different personnel have different writing standards, which leads to different formats of transaction codes in code files and script files of different personnel. To address this problem, this solution sets a preset format conversion method to convert the transaction codes in the aforementioned list into a unified format. For example, all transaction codes are converted to uppercase, leading and trailing spaces are removed, and specific separators are used uniformly. Here, the format conversion can be performed first and then integrated, or the integration can be performed first and then the format conversion, with no specific restrictions. Through format conversion, the format of all transaction codes can be ensured to be consistent, which is convenient for subsequent review and verification.
[0094] For step S102, first determine the host object of the service to be launched. Assuming that a new service is to be launched in an application, this application can be called a "target application" or a "host application". Both terms can be used to refer to the application program that is about to launch a new service. For example, if a new loan service is added to a bank APP, the bank APP is the target application or host application.
[0095] Assuming that the list includes transaction codes 1234, for each transaction code, check the code resource reuse logic. Take transaction code 1 as an example, connect to the server, obtain the full code base of the host object, such as accessing the full code base of the bank APP, search for transaction code 1 in the full code base, find all code files and locations containing transaction code 1, and filter out all code snippets or files involving transaction code 1 to ensure that all relevant logic is covered. Organize the filtered code snippets and generate a detailed report, including file path, code line number, and specific code content, for further review and verification. Through the above steps, you can ensure a comprehensive check on the code resource reuse of transaction code 1 to improve code quality and production safety.
[0096] In the transaction scenario, the transaction code is unique. When the transaction code is unique, the code file name corresponding to the transaction code will also use the transaction code as a unique identifier. Therefore, the transaction code can be used to perform association analysis on the code. This solution mainly considers jsp association analysis and bean file association analysis.
[0097] 1. Jsp association analysis mainly checks whether jsp page files have transaction reuse and whether there are redirection operations in jsp page files to ensure that jsp pages are not reused. If jsp pages are reused, each jsp page needs to be covered for verification. The specific steps are as follows:
[0098] 1) Determine the transaction code: Extract the transaction code from the list, such as transaction code 1.
[0099] 2) Find the jsp file: Find the jsp file containing transaction code 1 in the page directory of the host object.
[0100] 3) Check reuse: Check whether these jsp files have transaction reuse, that is, whether there are multiple jsp pages using the same transaction code.
[0101] 4) Check the redirection operation: Check whether there is a redirection operation in the relevant jsp page file to ensure that there is no redirection to the page of other transaction codes.
[0102] 5) Verify reuse: If jsp pages are found to be reused, each jsp page needs to be covered for verification to ensure that the functions of each page are correct.
[0103] 2. Bean file association analysis mainly checks whether there is transaction reuse in the java page file and whether there is method reuse in the java file. If there is bean reuse, it is necessary to cover the interfaces or pages involved in each bean for verification. The specific steps are as follows:
[0104] 1) Determine the transaction code: Extract the transaction code from the list, such as transaction code 1.
[0105] 2) Find the bean file: Search for the bean file containing transaction code 1 in the backend execution logic directory of the host object.
[0106] 3) Check reuse: Check whether these bean files have transaction reuse, that is, whether there are multiple beans using the same transaction code.
[0107] 4) Check method reuse: Check whether there is method reuse in the relevant Java files to ensure that different transaction logics are not implemented by calling the same method.
[0108] 5) Verify reuse: If beans are found to be reused, it is necessary to cover the interfaces or pages involved in each bean for verification to ensure that the functions of each interface or page are correct.
[0109] Through the above steps, we can ensure a comprehensive check on the reuse of the jsp pages and bean files of transaction code 1, thereby improving code quality and production safety.
[0110] Step S103 can be performed simultaneously with step S102 or sequentially. The order of precedence is not limited here. The database includes three parts: request input field, transaction input field and system parameters. The following is a detailed explanation of each part:
[0111] 1. Request input domain: the parameters transmitted when the client accesses, that is, the content that needs to be sent in the front-end request. It is used to receive requests initiated by the client and ensure that the back-end service can correctly parse and process these parameters. For example, in the user login scenario, the request input domain may include user name, password, verification code, etc.
[0112] 2. Transaction input domain: Parameters required when accessing the backend service, that is, the content that the backend service requires the request to be sent. It is used to ensure that the backend service can correctly process the transaction request and complete the corresponding business logic. For example, in the transfer business, the transaction input domain may include the transfer amount, the receiving account, the transfer notes, etc.
[0113] 3. System parameters: some technical parameters used for system configuration and control. Used to manage and control the operating environment and technical settings of the system to ensure the stability and security of the system. For example, IP parameters: allow or deny access to specific IP addresses. Check parameters: used for system health checks and performance monitoring.
[0114] You can also include some special parameters to set up the system for specific transactions, such as: Login: login timeout, maximum number of attempts, etc. Weak password: password complexity requirements, password expiration time, etc. Change password: old password verification, new password strength check, etc. IP restriction: allow or prohibit access from certain IP addresses. Service machine configuration: specify the list of servers where the service runs. Server switching: automatically switch to the backup server when the main server fails. Deny access: deny access requests from certain users based on specific conditions.
[0115] Database association analysis is divided into three aspects: request input domain analysis, transaction input domain analysis, and system parameter analysis. Therefore, the tables containing the request input domain, transaction input domain, and system parameters can all be called association analysis tables. These three tables are essential in the execution of each transaction, so they must also be checked during code reuse analysis. Database association analysis mainly involves the analysis of the same input domain fields and system parameters.
[0116] In the first embodiment, the association analysis table is a request input domain table. The request input domain is essentially a transaction attribute, and the transaction attribute is used to unify the specification and format. When a request is received, the request contains a transaction code. The request input domain table pre-configures the necessary parameter names of the transaction code. The system needs to determine whether the request parameters contain these necessary parameters. If not, an error is returned; if included, proceed to the next step.
[0117] Therefore, the information related to the transaction code can be analyzed according to the request input domain, as shown in Figure 2 (a). There is no order relationship between these two steps. According to the transaction code in the list, check the request input domain table to check whether the transaction code exists, for example, transaction code 1. If transaction code 1 exists, list the necessary request parameters corresponding to transaction code 1, or highlight them. In addition, identify the secondary inter-network transaction associated with transaction code 1. For example, transaction code 1 may involve two sub-transactions: 1-1 (back-end identity verification) and 1-2 (transfer). Obtain the request corresponding to transaction code 1 from the secondary inter-network transaction and list these request parameters from the request.
[0118] In actual situations, there is no secondary inter-network transaction for simple transactions, only one transaction request. However, in actual work, some transactions need to obtain the results after two internal requests and then feedback to the customer. This is called a secondary inter-network transaction. The process of identifying the secondary inter-network transaction associated with transaction code 1 can be as follows: find the configuration information of transaction code 1 in the transaction configuration table to see if there is an identifier for the secondary inter-network transaction. If there is a secondary inter-network transaction identifier, obtain the sub-transaction information associated with transaction code 1 from the transaction configuration table. For example, transaction code 1 may involve two sub-transactions: 1-1 (back-end identity verification) and 1-2 (transfer). Obtain the request parameters of each sub-transaction from the sub-transaction information and list these parameters.
[0119] Embodiment 2: The correlation analysis table is a transaction input domain table. This process is more complicated than the aforementioned request input domain, and needs to go through four processes: checking the transaction input domain table, code, secondary network, and network conversion, as shown in Figure 2 (b). There is no causal relationship between these four steps.
[0120] 1. Query the transaction input domain table to confirm whether transaction code 1 exists. If so, list transaction code 1 and its corresponding required request parameters and highlight them.
[0121] 2. Check whether transaction code 1 is associated with a secondary inter-network transaction. If there is a secondary inter-network transaction, obtain the sub-transaction information associated with transaction code 1 from the transaction configuration table, such as 1-1 and 1-2, obtain the request parameters of each sub-transaction and list them.
[0122] 3. Get all codes related to transaction code 1 from the backend execution logic Java file of the host object (such as APP) on the server and list them.
[0123] 4. The code will change with historical changes. For example, the backend transaction code configured before a transaction is an old transaction such as 410407. Later, the backend of 410407 is upgraded to the new generation of standardized transactions P1DBCS07. If it is changed uniformly, a large number of local transactions will be involved. Therefore, a transaction code mapping table is set to automatically map 410407 to P1DBCS07. Here, the historical transaction code corresponding to transaction code 1 can be determined according to the transaction code mapping table, assuming it is a, and then the historical code related to the historical transaction code a can be obtained.
[0124] Through the above steps, it is possible to ensure a comprehensive check of transaction code 1 and its associated secondary inter-network transactions, back-end execution logic code and historical code, thereby improving the security and stability of the system.
[0125] Example 3: System parameter table. System parameters are generally not changed significantly. Therefore, the system parameter table is queried here to confirm whether there are system parameters corresponding to transaction code 1. The system parameters corresponding to transaction code 1 are listed, including but not limited to IP parameters, inspection parameters, and feature parameters (such as login settings, password policies, IP restrictions, service machine configuration, server switching, access control, etc.). Through the above steps, it can be ensured that the system parameters of transaction code 1 are fully checked to ensure that the system configuration is correct.
[0126] For step S104, after obtaining the code information and request parameters related to transaction code 1, a suspected code reuse message is generated based on this information, and the suspected code reuse message is sent to the audit node for risk audit. Assume that the suspected code reuse message includes: 1) transaction code: 1. 2) Request necessary parameters: parameter 1: Zhang San, parameter 2: Li Si. 3) System parameters: IP parameter: 192.168.1.1, check parameter: enable, feature parameter: login timeout: 30 minutes, password complexity requirement: more than 8 digits, including numbers and letters. 4) Back-end execution logic code: file path: / src / main / java / com / example / service / TransactionService.java, code snippet 1: identity verification logic, code snippet 2: transfer logic. 5) Secondary inter-network transaction: sub-transaction 1-1: back-end identity verification, request parameters: user ID, password; sub-transaction 1-2: transfer, request parameters: transfer amount, receiving account.
[0127] In addition, the message can also include code files and script files for the business to be launched. The generated suspected code reuse message is sent to the audit node. After the audit node receives the message, it is manually reviewed to determine whether the code logic reuse is reasonable and whether there are risks, such as whether it affects the original functions of the APP. If there is an impact, it is determined that there is a risk and an alarm reminder is automatically triggered, such as informing the staff responsible for the business to be launched that after changing any of the code files and script files, the code logic reuse check logic still needs to be executed. Through the above steps, it can be ensured that the code information and request parameters of each transaction code are fully checked, and potential code reuse problems are discovered and handled in a timely manner, thereby improving the security and stability of the system.
[0128] The method provided in the above embodiment obtains the code files and script files of the business to be launched and submits them to the version management tool for analysis and processing, generates a list of transaction codes, then determines the host object of the business to be launched and accesses the full code of the host object in the server, queries the information related to each transaction code, and then determines the association analysis table in the database, uses the pre-configured code reuse check strategy, queries the information related to each transaction code, and finally generates a suspected code reuse message based on the query result and sends it to the audit node for risk identification. If the identification result is that there is a risk, an alarm reminder is issued, thereby realizing comprehensive inspection and risk management of code reuse, improving the security and stability of the system, reducing potential security risks and compatibility issues, and improving development efficiency and code quality.
[0129] In the current context where the country attaches great importance to Internet security, the secure deployment of code and database configuration is particularly important. In order to ensure the code quality, a code security inspection method is designed, which can be applied within the enterprise or interact with the outside, such as when third-party code is needed. The transaction code to be matched is obtained through data cleaning, and the internal code logic is used for automatic inspection to ensure that no verification content is missed due to human negligence. This method realizes comprehensive inspection and risk management of code reuse, improves the security and stability of the system, reduces potential security risks and compatibility issues, and improves development efficiency and code quality.
[0130] See also Figure 3 , shows a schematic diagram of main modules of a code reuse processing device 300 provided in an embodiment of the present invention, including:
[0131] The analysis module 301 is used to obtain the code files and script files of the business to be launched, submit the code files and script files to the version management tool for analysis and processing, and obtain a list; wherein the list includes the transaction code;
[0132] The information determination module 302 is used to determine the host object of the service to be launched, access the full code of the host object in the server, and query the information related to each transaction code;
[0133] Determine an association analysis table in a database, use a code reuse check strategy configured in advance for the association analysis table, determine transaction information related to the association analysis table, and query information related to each transaction code in the association analysis table and the transaction information;
[0134] The risk identification module 303 is used to generate a suspected code reuse message based on the information related to each transaction code in response to the completion of the query operation and send it to the review node for risk identification, so as to issue an alarm reminder when the identification result shows that there is a risk.
[0135] In the device of the embodiment of the present invention, the association analysis table is a request input domain table, and the information determination module 302 is used to:
[0136] querying in the request input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the request input domain table;
[0137] Identify the secondary inter-network transaction associated with each transaction code, obtain the request record corresponding to each transaction code from the secondary inter-network transaction, and obtain the request parameter from the request record.
[0138] In the device of the embodiment of the present invention, the association analysis table is a transaction input domain table, and the information determination module 302 is used to:
[0139] querying in the transaction input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the transaction input domain table;
[0140] Identify the secondary inter-network transaction associated with each transaction code, obtain a request record corresponding to each transaction code from the secondary inter-network transaction, and obtain a request parameter from the request record;
[0141] Accessing the backend code file of the relevant host object in the server to obtain the code related to each transaction code;
[0142] According to the transaction code mapping table, the historical transaction code corresponding to each transaction code is determined, and then the historical code related to the historical transaction code is obtained.
[0143] In the device of the embodiment of the present invention, the association analysis table is a system parameter table, and the information determination module 302 is used to:
[0144] The system parameter table is queried to determine whether each transaction code exists, and in response to a query result that each transaction code exists, a request parameter corresponding to each transaction code in the system parameter table is obtained.
[0145] In the device of the embodiment of the present invention, the analysis module 301 is used to:
[0146] Submitting the code file to a version management tool for analysis and processing to obtain a first list; and submitting the script file to a version management tool for analysis and processing to obtain a second list;
[0147] Using a preset format conversion method, converting the formats of the transaction codes in the first list and the second list, integrating the first list and the second list after the format conversion to obtain a list; or
[0148] The first list and the second list are integrated to obtain a list, and a preset format conversion method is used to convert the format of the transaction code in the list.
[0149] In the device of the embodiment of the present invention, the full code includes a front-end page file and a back-end code file, and the information determination module 302 is used to:
[0150] Using a preset first query method, querying a code related to each transaction code from the front-end page file;
[0151] The preset second query method is used to query the code related to each transaction code from the backend code file.
[0152] In addition, the specific implementation content of the device described in the embodiment of the present invention has been described in detail in the method described above, so the repeated content will not be described again here.
[0153] Figure 4 An exemplary system architecture 400 to which embodiments of the present invention may be applied is shown, including terminal devices 401 , 402 , 403 , a network 404 and a server 405 (only an example).
[0154] Terminal devices 401, 402, 403 may be various electronic devices with display screens and supporting web browsing, and may be installed with various communication client applications. Users may use terminal devices 401, 402, 403 to interact with server 405 via network 404 to receive or send messages, etc.
[0155] The network 404 is used to provide a medium for communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0156] The server 405 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403 (for example only). The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal device. It should be noted that the method provided in the embodiment of the present invention is generally executed by the server 405, and accordingly, the device is generally set in the server 405.
[0157] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0158] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0159] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0160] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0161] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0162] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0163] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0164] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an analysis module, an information determination module, and a risk identification module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the risk identification module may also be described as a "risk identification warning module".
[0165] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes any of the above code reuse processing methods.
[0166] The computer program product of the present invention comprises a computer program, and when the computer program is executed by a processor, the code reuse processing method in the embodiment of the present invention is implemented.
[0167] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A code reuse processing method, characterized in that: include: Obtain code files and script files for the business to be launched, submit the code files and script files to the version management tool for analysis and processing, and obtain a list; wherein the list includes the transaction code; Determine the host object of the business to be launched, access the full code of the host object in the server to query the information related to each transaction code; Determine an association analysis table in a database, use a code reuse check strategy configured in advance for the association analysis table, determine transaction information related to the association analysis table, and query information related to each transaction code in the association analysis table and the transaction information; In response to the query operation being completed, based on the information related to each transaction code, a suspected code reuse message is generated and sent to the audit node for risk identification, so as to issue an alarm reminder if the identification result shows that there is a risk.
2. The method according to claim 1, characterized in that: The association analysis table is a request input domain table, and the determining of transaction information related to the association analysis table to query information related to each transaction code in the association analysis table and the transaction information includes: querying in the request input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the request input domain table; Identify the secondary inter-network transaction associated with each transaction code, obtain the request record corresponding to each transaction code from the secondary inter-network transaction, and obtain the request parameter from the request record.
3. The method according to claim 1, characterized in that The association analysis table is a transaction input domain table, and the determining of transaction information related to the association analysis table to query information related to each transaction code in the association analysis table and the transaction information includes: querying in the transaction input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the transaction input domain table; Identify the secondary inter-network transaction associated with each transaction code, obtain a request record corresponding to each transaction code from the secondary inter-network transaction, and obtain a request parameter from the request record; Accessing the backend code file of the relevant host object in the server to obtain the code related to each transaction code; According to the transaction code mapping table, the historical transaction code corresponding to each transaction code is determined, and then the historical code related to the historical transaction code is obtained.
4. The method according to claim 1, characterized in that: The association analysis table is a system parameter table, and the determining of transaction information related to the association analysis table to query information related to each transaction code in the association analysis table and the transaction information includes: The system parameter table is queried to determine whether each transaction code exists, and in response to a query result that each transaction code exists, a request parameter corresponding to each transaction code in the system parameter table is obtained.
5. The method according to claim 1, characterized in that The code files and script files are submitted to the version management tool for analysis and processing to obtain a list, including: Submitting the code file to a version management tool for analysis and processing to obtain a first list; and submitting the script file to a version management tool for analysis and processing to obtain a second list; Using a preset format conversion method, converting the formats of the transaction codes in the first list and the second list, integrating the first list and the second list after the format conversion to obtain a list; or The first list and the second list are integrated to obtain a list, and a preset format conversion method is used to convert the format of the transaction code in the list.
6. The method according to claim 1, characterized in that The full code includes the front-end page file and the back-end code file. The query information related to each transaction code includes: Using a preset first query method, querying a code related to each transaction code from the front-end page file; The preset second query method is used to query the code related to each transaction code from the backend code file.
7. A code multiplexing processing device, characterized in that: include: The analysis module is used to obtain the code files and script files of the business to be launched, submit the code files and script files to the version management tool for analysis and processing, and obtain a list; wherein the list includes the transaction code; The information determination module is used to determine the host object of the business to be launched, access the full code of the host object in the server, and query the information related to each transaction code; Determine an association analysis table in a database, use a code reuse check strategy configured in advance for the association analysis table, determine transaction information related to the association analysis table, and query information related to each transaction code in the association analysis table and the transaction information; The risk identification module is used to generate a suspected code reuse message in response to the completion of the query operation based on the information related to each transaction code and send it to the audit node for risk identification, so as to issue an alarm reminder when the identification result shows that there is a risk.
8. The device according to claim 7, characterized in that The association analysis table is a transaction input domain table, and the information determination module is used to: querying in the transaction input domain table whether each transaction code exists, and in response to the query result being yes, obtaining the request parameter corresponding to each transaction code in the transaction input domain table; Identify the secondary inter-network transaction associated with each transaction code, obtain a request record corresponding to each transaction code from the secondary inter-network transaction, and obtain a request parameter from the request record; Accessing the backend code file of the relevant host object in the server to obtain the code related to each transaction code; According to the transaction code mapping table, the historical transaction code corresponding to each transaction code is determined, and then the historical code related to the historical transaction code is obtained.
9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.