Code potential risk identification method and device, storage medium and computer equipment

By comparing the code of the version under test with the benchmark version, and using an AI code assistant tool to identify and integrate potential risks, the problem of low efficiency in code risk identification in existing technologies is solved, and the stability and reliability of the software system are improved.

CN121833025APending Publication Date: 2026-04-10GUANGZHOU PINWEI SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202512052298.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies cannot easily, efficiently, comprehensively, and accurately identify potential risks in code, which may lead to runtime errors and serious consequences in software systems during version iterations.

Method used

By comparing the code under test with the benchmark code, the first and second code assistant tools based on the big data model of artificial intelligence are used to identify potential risks in the differing code files, and deduplication and conflict detection are performed to generate the final risk information.

Benefits of technology

It enables simple, efficient, comprehensive and accurate identification of potential risks in code, reduces the probability of code failure in the production environment, and improves the operational stability and reliability of software systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833025A_ABST
    Figure CN121833025A_ABST
Patent Text Reader

Abstract

The invention provides a potential risk identification method and device of a code, a storage medium and computer equipment, and can compare a to-be-tested version code with a reference version code to determine a difference code file with code change in the to-be-tested version code, and perform potential risk identification on the difference code file by using a plurality of AI code assistant tools, so as to improve the identification accuracy of the potential risk of the to-be-tested version code. And obtaining multiple pieces of risk information. And then, carrying out duplicate removal and conflict detection processing on the risk information identified by the plurality of AI code assistant tools so as to integrate the plurality of pieces of risk information into final risk information. Therefore, the potential risk of the to-be-tested version code can be simply, efficiently, comprehensively and accurately identified, so that the probability that the code breaks down in a production environment is effectively reduced, and the running stability and reliability of a software system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and particularly relates to a potential risk identification method and device of code, a storage medium and a computer device. BACKGROUND

[0002] When a version iteration is performed on a software system, the new version code may have problems such as logical errors, syntax errors, null pointer risks, and unreasonable use of external dependencies. If the new version code with problems is directly deployed in a production environment, the software system will have running errors, thereby affecting the normal operation of the software system, and even causing serious consequences such as data loss and business interruption. Therefore, in order to ensure the stable operation of the software system, it is particularly important to effectively identify the potential risks of the code in the development and testing stages.

[0003] The traditional code risk identification method often relies on manual review. However, with the rapid increase in the size and complexity of the code, manual review is not only inefficient and complex to operate, but also difficult to accurately identify the potential risks of large-scale code. Therefore, it is urgent to provide a solution that can simply, efficiently, comprehensively and accurately identify the potential risks of the code. SUMMARY

[0004] The present application aims to at least solve one of the above technical defects, in particular the technical defect that the prior art cannot simply, efficiently, comprehensively and accurately identify the potential risks of the code.

[0005] In a first aspect, an embodiment of the present application provides a potential risk identification method of code, comprising:

[0006] comparing the to-be-tested version code with the benchmark version code to determine a difference code file;

[0007] performing potential risk identification on the difference code file through a first code assistant tool based on an artificial intelligence large model to obtain first risk information;

[0008] performing potential risk identification on the difference code file through a second code assistant tool based on an artificial intelligence large model to obtain second risk information;

[0009] performing deduplication and conflict detection processing on the first risk information and the second risk information to obtain final risk information for recording the potential risks of the to-be-tested version code.

[0010] In some embodiments, the first risk information comprises at least one set of first risk data, the first risk data comprising a code file path, a code line number and a risk type of a first risk code; the second risk information comprises at least one set of second risk data, the second risk data comprising a code file path, a code line number and a risk type of a second risk code; and the final risk information comprises at least one set of third risk data.

[0011] The deduplication and conflict detection processing of the first risk information and the second risk information obtains final risk information for recording potential risks of the to-be-tested version code, comprising:

[0012] According to the code file path and the code line number, a position coincidence degree between the first target code and any second risk code is calculated respectively; wherein the first target code is any first risk code.

[0013] Based on the position coincidence degree, the second risk code is identified as a same code segment, and it is determined whether there is a second target code; wherein the second target code is a second risk code belonging to the same code segment as the first target code.

[0014] If the second target code exists and the risk type of the first target code is different from the risk type of the second target code, a set of third risk data is generated according to the code file path of the first target code, the code line number of the first target code, the risk type of the first target code and the risk type of the second target code, and the second risk data corresponding to the second target code is marked as a recorded state.

[0015] In some embodiments, the first risk data further comprises a risk level of the first risk code, and the second risk data further comprises a risk level of the second risk code.

[0016] The deduplication and conflict detection processing of the first risk information and the second risk information obtains final risk information for recording potential risks of the to-be-tested version code, further comprising:

[0017] If the second target code exists and the risk level of the first target code is different from the risk level of the second target code, a higher level is determined from the risk level of the first target code and the risk level of the second target code, and the higher level is recorded in the third risk data, and the second risk data corresponding to the second target code is marked as a recorded state.

[0018] In some embodiments, the deduplication and conflict detection processing of the first risk information and the second risk information to obtain final risk information for recording potential risks of the to-be-tested version code further comprises:

[0019] If the second target code exists, the risk type of the first target code is the same as the risk type of the second target code, and the risk level of the first target code is the same as the risk level of the second target code, the first risk data or the second risk data is taken as a group of the third risk data, and the second risk data corresponding to the second target code is marked as a recorded state.

[0020] In some embodiments, the deduplication and conflict detection processing of the first risk information and the second risk information to obtain final risk information for recording potential risks of the to-be-tested version code further comprises:

[0021] If the second target code does not exist, the first risk data corresponding to the first target code is taken as a group of the third risk data.

[0022] After the deduplication and conflict detection processing of the first risk information is completed, if there is at least one group of unrecorded second risk data, the third risk data is generated one by one corresponding to the at least one group of unrecorded second risk data.

[0023] In some embodiments, the position coincidence degree of the second target code and the first target code is greater than a preset coincidence threshold.

[0024] In some embodiments, after the deduplication and conflict detection processing of the first risk information and the second risk information to obtain final risk information for recording potential risks of the to-be-tested version code, the method further comprises:

[0025] The final risk information is pushed to a preset electronic terminal.

[0026] In a second aspect, the embodiments of the present application provide a potential risk identification device of code, comprising:

[0027] A comparison module is configured to compare a to-be-tested version code with a reference version code to determine a difference code file.

[0028] A first risk identification module is configured to identify potential risks of the difference code file by a first code assistant tool based on an artificial intelligence large model to obtain first risk information.

[0029] A second risk identification module is configured to identify potential risks of the difference code file by a second code assistant tool based on an artificial intelligence large model to obtain second risk information.

[0030] The integration module is configured to perform deduplication and conflict detection processing on the first risk information and the second risk information, to obtain final risk information for recording potential risks of the to-be-tested version code.

[0031] In a third aspect, an embodiment of the present application provides a storage medium, which stores computer readable instructions. When the computer readable instructions are executed by one or more processors, the one or more processors perform the steps of the potential risk identification method of the code according to any of the above embodiments.

[0032] In a fourth aspect, an embodiment of the present application provides a computer device, which includes one or more processors and a memory.

[0033] The memory stores computer readable instructions. When the computer readable instructions are executed by the one or more processors, the one or more processors perform the steps of the potential risk identification method of the code according to any of the above embodiments.

[0034] In the potential risk identification method, device, storage medium and computer device of the code according to some embodiments of the present application, the to-be-tested version code and the benchmark version code are compared to determine difference code files in which the to-be-tested version code has code changes, and a plurality of AI (Artificial Intelligence) code assistant tools are used to identify potential risks of the difference code files to obtain a plurality of risk information. Then, the risk information identified by the plurality of AI code assistant tools is deduplicated and conflict detected to integrate the plurality of risk information into final risk information. In this way, the potential risks of the to-be-tested version code can be simply, efficiently, comprehensively and accurately identified to effectively reduce the probability of code failure in a production environment and improve the running stability and reliability of a software system. BRIEF DESCRIPTION OF DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor based on these drawings.

[0036] Figure 1 For some embodiments, a flowchart of a potential risk identification method of a code;

[0037] Figure 2 For some embodiments, a structure diagram of a potential risk identification device of a code;

[0038] Figure 3 For some embodiments, the internal structure diagram of the computer device. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0040] It should be noted that the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the present application comply with relevant laws and regulations, and are carried out without violating social morality and hindering public interests.

[0041] In some embodiments, the present application provides a potential risk identification method of code. The following embodiments are described by taking the application of the method to a computer device as an example. It can be understood that the computer device described in the present application can be a device with data processing function, which can be but is not limited to a tablet computer, a laptop computer, a notebook computer, a desktop computer, a single server or a server cluster.

[0042] As shown in Figure 1 The potential risk identification method of code provided by the present application can include the following steps:

[0043] S102: comparing the to-be-tested version code with the benchmark version code to determine the difference code file.

[0044] The to-be-tested version code can be a version that has been developed and is to be tested, and the benchmark version code can be a code that can stably run. In some examples, the to-be-tested version code can be a new version code, and the benchmark version code can be an old version code deployed to a production environment. In this example, since the benchmark version code has been verified by an actual running environment and can stably run, it can be used as a comparison benchmark.

[0045] In this step, the to-be-tested version code and the benchmark version code can be compared, and the code file in which the to-be-tested version code is changed compared with the benchmark version code is determined as the difference code file. In subsequent potential risk identification, the present application takes the difference code file as the identification basis and identifies the potential risk pertinently, so as to avoid unnecessary detection of unchanged code and improve the identification efficiency.

[0046] It should be noted that the code changes involved in the present application can include addition, deletion, modification, etc. of the code. For example, the to-be-tested version code includes code file 1 and code file 2, and the benchmark version code only includes code file 1, if the code of code file 1 has not been changed, code file 2 can be used as a difference code file; if the code in code file 1 has been changed, code file 1 and code file 2 can be used as difference code files.

[0047] It can be understood that the present application can be performed by at least one of a plurality of ways, and the present application does not make specific limitations thereon. In some examples, it can be implemented by bash command. In other examples, it can be implemented by version control tools such as jgit, SVN, etc.

[0048] S104: identifying potential risks in the difference code file through a first code assistant tool based on an artificial intelligence large model, to obtain first risk information.

[0049] The first code assistant tool refers to an intelligent coding auxiliary tool developed based on an artificial intelligence large model, which can be but is not limited to Tongyiling Code, codeBuddy, etc. The present application can analyze and identify risks in the difference code file through the first code assistant tool, so as to quickly, comprehensively and accurately identify potential risks in the difference code file by means of the powerful ability of the AI large model. These potential risks include but are not limited to logical errors, syntax errors, null pointer risks, unreasonable use of external dependencies, etc. After risk identification, the first code assistant tool can output first risk information to record the specific circumstances of these potential risks.

[0050] S106: identifying potential risks in the difference code file through a second code assistant tool based on an artificial intelligence large model, to obtain second risk information.

[0051] The second code assistant tool refers to an intelligent coding auxiliary tool developed based on an artificial intelligence large model, and the first code assistant tool and the second code assistant tool are different code assistant tools. For example, the first code assistant tool can be Tongyiling Code, and the second code assistant tool can be codeBuddy. For another example, the first code assistant tool can be codeBuddy, and the second code assistant tool can be Tongyiling Code.

[0052] Similar to S104, the present application can analyze and identify risks in the difference code file by means of the second code assistant tool different from the first code assistant tool, and obtain second risk information output by the second code assistant tool. It can be understood that the second risk information records the specific circumstances of potential risks in the difference code file identified by the second code assistant tool.

[0053] S108: De-duplicate and conflict detection processing is performed on the first risk information and the second risk information to obtain final risk information for recording potential risks of the to-be-tested version code.

[0054] Specifically, since different code assistant tools can be based on different algorithms, models and training data, different code assistant tools can have different advantages and focuses when identifying potential risks, which makes the risk information identified by different code assistant tools possibly coincide on some risk information (for example, different code assistant tools detect the same risk information) and have certain differences on other risk information.

[0055] Therefore, in the case of obtaining the first risk information and the second risk information, the application can perform de-duplication and conflict detection processing on the first risk information and the second risk information. By using multiple different code assistant tools to identify potential risks, the application can excavate potential risks in the difference code file from multiple angles. By integrating the risk information output by each tool, the application can fully exert the respective advantages of different code assistant tools, so as to efficiently and comprehensively cover various potential risks that can exist in the difference code file.

[0056] Among them, the de-duplication processing refers to removing the duplicated risk data in the first risk information and the second risk information, so as to avoid recording the same potential risk in the final risk information. The conflict detection processing refers to reprocessing the risk data with information conflict in the first risk information and the second risk information, so as to determine reasonable risk information.

[0057] Exemplarily, the information conflict described in the application includes but is not limited to existence conflict, risk level conflict, risk type conflict and the like. The existence conflict refers to that the same code snippet is marked as risky in one risk information, but is not marked as risky in another risk information. The risk level conflict refers to that the same code snippet is marked as different risk levels in different risk information. The risk type conflict refers to that the same code snippet is marked as different risk types in different risk information.

[0058] Further, in some examples, after generating the final risk information, the application can also push the final risk information to a preset electronic terminal. For example, the information can be pushed to an electronic terminal held by a developer, a test terminal held by a tester, and the like, so as to timely remind the relevant personnel to handle the potential risks in the to-be-tested version code. The preset electronic terminal in the example can be a mobile phone, a tablet computer, a desktop computer, or the like, which has the functions of information receiving and displaying. By pushing the final risk information to the relevant personnel, the timeliness of risk handling can be improved, and the possibility of code failure in the production environment can be reduced.

[0059] The application can compare the to-be-tested version code and the benchmark version code, determine the difference code files in which the to-be-tested version code has code changes, and use a plurality of AI (Artificial Intelligence) code assistant tools to identify potential risks in the difference code files, to obtain a plurality of risk information. Then, the risk information identified by the plurality of AI code assistant tools is processed for deduplication and conflict detection, so as to integrate the plurality of risk information into final risk information. In this way, the potential risks of the to-be-tested version code can be simply, efficiently, comprehensively and accurately identified, so as to effectively reduce the probability of code failure in the production environment and improve the running stability and reliability of the software system.

[0060] In some embodiments, the first risk information includes at least one set of first risk data, the first risk data including a code file path, a code line number and a risk type of a first risk code; the second risk information includes at least one set of second risk data, the second risk data including a code file path, a code line number and a risk type of a second risk code; and the final risk information includes at least one set of third risk data.

[0061] It can be understood that the first risk code refers to the code with potential risks identified by the first code assistant tool from the difference code files. The code file path and the code line number of the first risk code are used to describe the specific position of the first risk code in the code file, and the risk type can be used to describe the category of the potential risk of the first risk code. For example, the risk type can be a logic error, a syntax error, or the like.

[0062] If the first code assistant tool detects a plurality of first risk codes, the first risk information can include a plurality of sets of first risk data, each set of first risk data corresponding to each first risk code, and each set of first risk data being used to record the information of one first risk code. If the first code assistant tool detects only one first risk code, the first risk information can include one set of first risk data.

[0063] The second risk code refers to a code with potential risks identified by the second code assistant tool from the difference code file. The code file path and the code line number of the second risk code are used to describe the specific location of the second risk code in the code file, and the risk type can be used to describe the category of the potential risks existing in the second risk code.

[0064] If the second code assistant tool detects multiple second risk codes, the second risk information can include multiple sets of second risk data, each set of second risk data corresponding to each second risk code one by one, and each set of second risk data recording the information of one second risk code. If the second code assistant tool only detects one second risk code, the second risk information can include one set of second risk data.

[0065] The deduplication and conflict detection processing of the first risk information and the second risk information obtains the final risk information for recording the potential risks of the to-be-tested version code, and includes:

[0066] According to the code file path and the code line number, the position coincidence degree between the first target code and any second risk code is calculated respectively; wherein the first target code is any first risk code;

[0067] Based on the position coincidence degree, the same code fragment identification of the second risk code is performed, and it is judged whether there is a second target code; wherein the second target code is a second risk code belonging to the same code fragment as the first target code;

[0068] If the second target code exists, and the risk type of the first target code is different from the risk type of the second target code, a set of third risk data is generated according to the code file path of the first target code, the code line number of the first target code, the risk type of the first target code and the risk type of the second target code, and the second risk data corresponding to the second target code is marked as a recorded state.

[0069] Specifically, for any first risk code recorded in the first risk information, the first risk code can be taken as the first target code, and the position coincidence degree between the first target code and each second risk code is calculated according to the code file path of the first target code, the code line number of the first target code, the code file path of each second risk code and the code line number of each second risk code.

[0070] For example, if the first target code is code A, the second risk information includes three sets of second risk data, and the second risk codes corresponding to the three sets of data are code A, code B and code C respectively, the application can calculate the position coincidence degree between code A and code A, the position coincidence degree between code A and code B, and the position coincidence degree between code A and code C respectively, and obtain three position coincidence degrees.

[0071] It can be understood that the position coincidence degree is used to describe the proportion of the position overlap of the first target code and the second risk code in the code file, which can be calculated in any way, and the application does not make specific limitation thereto. For example, the code file paths of the two codes can be compared first. If they are not consistent, it can be determined that the position coincidence degree of the two codes is 0; if they are consistent, the code line numbers of the two codes can be further compared, the proportion of the overlapping lines of the two code line numbers to the total lines of the two codes is calculated, and thus the position coincidence degree is obtained.

[0072] After obtaining the position coincidence degree, the application can determine whether there is a second risk code belonging to the same code segment as the first target code based on the position coincidence degree, that is, whether there is a second target code. In some examples, if the position coincidence degree corresponding to the second risk code is greater than a preset coincidence degree threshold, it can be considered that the second risk code belongs to the same code segment as the first target code, and the second risk code can be taken as the second target code. It can be understood that the specific value of the preset coincidence degree threshold can be adjusted and set according to actual conditions, for example, it can be set to 0.8, 0.9, etc.

[0073] If there is a second target code in the second risk code, it indicates that the first risk information and the second risk information issue risk warnings for the same code segment. In this case, the information integration manner can be determined according to the risk identification results of the same code segment in the first risk information and the risk identification results in the second risk information, and a set of third risk data is generated by using the information integration manner, so as to record the potential risk information of the code segment through the set of third risk data.

[0074] Specifically, when the risk type of the first target code is different from the risk type of the second target code, it indicates that different code assistant tools identify different types of potential risks for the same code segment, and there is a risk type conflict. In this case, the application can record the risk types identified by the two code assistant tools in a set of third risk data, so as to avoid missing potential risk information and facilitate the code optimization and testing of technical personnel. In this way, the probability of code failure in the production environment can be further reduced, and the running stability and reliability of the software system can be improved.

[0075] For example, if the same code snippet is marked as a logical error in the first risk information and as a syntax error in the second risk information, then in a set of third risk data recording the potential risk information of the code snippet, the code file path and the code line number are consistent with the information of the first target code, and the risk type will include both logical error and syntax error, so as to comprehensively present the potential risks that may exist in the code snippet.

[0076] After generating the set of third risk data, the second target code corresponding second risk data is marked as a recorded state to avoid repeated use and processing of the data in subsequent processing.

[0077] In some embodiments, the first risk data further includes a risk level of the first risk code, and the second risk data further includes a risk level of the second risk code. The risk level is used to describe the severity of the potential risk, which can be divided into three levels, such as low, medium, and high.

[0078] The deduplication and conflict detection processing of the first risk information and the second risk information to obtain the final risk information for recording the potential risks of the to-be-tested version code further includes:

[0079] If the second target code exists and the risk level of the first target code is different from the risk level of the second target code, then the higher level is determined from the risk level of the first target code and the risk level of the second target code, and the higher level is recorded in the third risk data, and the second target code corresponding second risk data is marked as a recorded state.

[0080] Specifically, when the risk level of the first target code and the risk level of the second target code are different, it indicates that the potential risk severity evaluation of the same code snippet by different code assistant tools is different, i.e., a risk level conflict occurs. In this case, in order to ensure that the evaluation of the potential risk is more cautious and accurate, the present application selects to record the higher level in the third risk data.

[0081] For example, if the risk level of the first target code is "medium" and the risk level of the second target code is "high", then in a set of third risk data recording the potential risk information of the code snippet, the code file path, the code line number, and the risk type can refer to the description of the above embodiments, and the risk level is recorded as "high".

[0082] At the same time, in order to avoid repeated recording of risk information, after determining the higher level and recording it to the third risk data, the second target code corresponding second risk data is marked as a recorded state. In subsequent processing of risk information, these marked data can be ignored, thereby improving the efficiency of information processing.

[0083] In some embodiments, the deduplication and conflict detection processing of the first risk information and the second risk information to obtain the final risk information for recording the potential risks of the to-be-tested version code further includes:

[0084] If the second target code exists, the risk type of the first target code is the same as the risk type of the second target code, and the risk level of the first target code is the same as the risk level of the second target code, the first risk data or the second risk data is taken as a group of the third risk data, and the second risk data corresponding to the second target code is marked as a recorded state.

[0085] Specifically, when the risk type and the risk level of the first target code and the second target code are the same, it indicates that different code assistant tools have consistent risk identification results when identifying the potential risks of the code segment. In this case, one of the first risk data and the second risk data can be directly taken as a group of the third risk data, so as to reasonably and efficiently generate the final risk information.

[0086] For example, if the risk type of the first target code and the risk type of the second target code are both logical errors, and the risk level of the first target code and the risk level of the second target code are both “medium”, the first risk data corresponding to the first target code can be selected as a group of the third risk data. In this way, the accuracy of the final risk information is ensured, and data redundancy is avoided.

[0087] In addition, in order to avoid repeated recording of risk information, after generating the corresponding third risk data, the second risk data corresponding to the second target code can be marked as a recorded state. Subsequently, when processing the risk information, these marked data can be ignored, so as to improve the efficiency of information processing.

[0088] In some embodiments, the deduplication and conflict detection processing of the first risk information and the second risk information to obtain the final risk information for recording the potential risks of the to-be-tested version code further includes:

[0089] If the second target code does not exist, the first risk data corresponding to the first target code is taken as a group of the third risk data.

[0090] After completing the deduplication and conflict detection processing of the first risk information, if there is at least one group of unrecorded second risk data, the third risk data is generated one by one corresponding to the at least one group of unrecorded second risk data.

[0091] Specifically, when there is no second target code belonging to the same code segment as the first target code, it means that the potential risk information corresponding to the first target code does not appear repeatedly in the second risk information. That is, the second code assistant tool does not consider the first target code to have a potential risk, and there is an existence conflict between the first and second risk information. In this case, to ensure a more cautious and accurate assessment of potential risks, this application can directly include the first risk data corresponding to the first target code as a set of third risk data in the final risk information to ensure that the potential risk information of this code segment is not omitted.

[0092] Furthermore, after performing deduplication and conflict detection on each first risk code of the first risk information, this application can determine whether there is any second risk data that is not recorded in the final risk information based on the marking status of the second risk data. If so, the unrecorded second risk data is directly included as third risk data in the final risk information to ensure that no potential risk information of the code fragment is omitted.

[0093] For example, when there are two sets of unrecorded second risk data, namely data 1 and data 2, this application can add data 1 and data 2 as two sets of third risk data to the final risk information. The first set of third risk data is the same as the information of data 1, and the second set of third risk data is the same as the information of data 2.

[0094] Through the above embodiments, this application can more comprehensively and accurately integrate the first risk information and the second risk information to obtain the final risk information, providing a reliable basis for the potential risk assessment of the code.

[0095] The potential risk identification device for code provided in the embodiments of this application is described below. The potential risk identification device for code described below can be referred to in correspondence with the potential risk identification method for code described above.

[0096] In some embodiments, such as Figure 2 As shown, this application provides a potential risk identification device 200 for codes, comprising:

[0097] Comparison module 202 is used to compare the code of the version under test with the code of the baseline version to determine the difference code files;

[0098] The first risk identification module 204 is used to identify potential risks in the differential code file by using a first code assistant tool based on an artificial intelligence big model to obtain first risk information;

[0099] The second risk identification module 206 is used to identify potential risks in the differential code file using a second code assistant tool based on an artificial intelligence big data model, and obtain second risk information.

[0100] The integration module 208 is configured to perform deduplication and conflict detection on the first risk information and the second risk information to obtain final risk information for recording potential risks of the to-be-tested version code.

[0101] In some embodiments, the first risk information includes at least one set of first risk data, the first risk data including a code file path, a code line number, and a risk type of a first risk code; the second risk information includes at least one set of second risk data, the second risk data including a code file path, a code line number, and a risk type of a second risk code; and the final risk information includes at least one set of third risk data. The integration module 208 includes:

[0102] A coincidence degree calculation unit is configured to calculate a position coincidence degree between a first target code and any second risk code according to the code file path and the code line number, where the first target code is any first risk code.

[0103] A same code snippet identification unit is configured to identify the second risk code based on the position coincidence degree and determine whether there is a second target code, where the second target code is a second risk code belonging to a same code snippet as the first target code.

[0104] A first integration unit is configured to, if the second target code exists and the risk type of the first target code is different from the risk type of the second target code, generate a set of third risk data according to the code file path of the first target code, the code line number of the first target code, the risk type of the first target code, and the risk type of the second target code, and mark the second risk data corresponding to the second target code as a recorded state.

[0105] In some embodiments, the first risk data further includes a risk level of the first risk code, and the second risk data further includes a risk level of the second risk code. The integration module 208 further includes:

[0106] A second integration unit is configured to, if the second target code exists and the risk level of the first target code is different from the risk level of the second target code, determine a higher level from the risk level of the first target code and the risk level of the second target code, record the higher level in the third risk data, and mark the second risk data corresponding to the second target code as a recorded state.

[0107] In some embodiments, the integration module 208 further includes:

[0108] a third integration unit, configured to, if the second target code exists, the risk type of the first target code is the same as the risk type of the second target code, and the risk level of the first target code is the same as the risk level of the second target code, take the first risk data or the second risk data as a group of the third risk data, and mark the second risk data corresponding to the second target code as a recorded state.

[0109] In some embodiments, the integration module 208 of the present application further comprises:

[0110] a fourth integration unit, configured to, if the second target code does not exist, take the first risk data corresponding to the first target code as a group of the third risk data.

[0111] a fifth integration unit, configured to, after the deduplication and conflict detection processing of the first risk information is completed, if there is at least one group of unrecorded second risk data, generate the third risk data one by one corresponding to the at least one group of unrecorded second risk data.

[0112] In some embodiments, the position coincidence degree of the second target code and the first target code is greater than a preset coincidence degree threshold.

[0113] In some embodiments, the apparatus 200 provided by the present application further comprises:

[0114] an information pushing module, configured to, after the deduplication and conflict detection processing of the first risk information and the second risk information is completed, obtain the final risk information for recording the potential risk of the to-be-tested version code, and push the final risk information to a preset electronic terminal.

[0115] In one embodiment, the present application further provides a storage medium, wherein the storage medium stores computer readable instructions, and the computer readable instructions are executed by one or more processors to make the one or more processors execute the steps of the potential risk identification method of the code in any embodiment.

[0116] In one embodiment, the present application further provides a computer device, wherein the computer device stores computer readable instructions, and the computer readable instructions are executed by one or more processors to make the one or more processors execute the steps of the potential risk identification method of the code in any embodiment.

[0117] Schematically, Figure 3 FIG. 1 shows a schematic diagram of an internal structure of a computer device provided by an embodiment of the present application, which may, in one example, be a server. Referring to FIG. 1, Figure 3The computer device 900 includes a processing component 902, which is further composed of one or more processors, and a memory resource represented by the memory 901 for storing instructions executable by the processing component 902, such as an application program. The application program stored in the memory 901 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 902 is configured to execute the instructions to perform the steps of the potential risk identification method of the code described in any of the embodiments above.

[0118] The computer device 900 can further include a power supply component 903 configured to perform power management of the computer device 900, a wired or wireless network interface 904 configured to connect the computer device 900 to a network, and an input / output (I / O) interface 905. The computer device 900 can operate based on an operating system stored in the memory 901, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.

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

[0120] Finally, it should also be noted that, in this document, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitation, the element defined by the statement "including a" does not exclude the presence of additional identical elements in the process, method, article or device including the element. In this document, "a", "one", "said", "the" and "it" can also include plural forms, unless the context clearly indicates otherwise. A plurality means at least two, such as 2, 3, 5 or 8, etc. "And / or" includes any and all combinations of the related listed items.

[0121] The various embodiments described in this specification are intended to be combinable unless otherwise indicated herein. The various embodiments described in this specification are described in the progressions noted, with each embodiment emphasizing different aspects over others, and the various embodiments can be combined as desired, with reference to each other as appropriate.

[0122] The above description of disclosed embodiments is intended to be illustrative and not restrictive. Many modifications of these embodiments by one having ordinary skill in the art, using the principles and novel features disclosed herein, will be within the scope of the application. The scope of the application, therefore, is not to be limited to the above described embodiments but is to be accorded the widest scope consistent with the principles and novel features described herein.

Claims

1. A method of potential risk identification of a code, characterized by, The method comprises the following steps: comparing the to-be-tested version code with the benchmark version code to determine a difference code file; performing potential risk identification on the difference code file through a first code assistant tool based on an artificial intelligence large model to obtain first risk information; performing potential risk identification on the difference code file through a second code assistant tool based on an artificial intelligence large model to obtain second risk information; performing deduplication and conflict detection processing on the first risk information and the second risk information to obtain final risk information for recording potential risks of the to-be-tested version code.

2. The method of claim 1, wherein, The first risk information comprises at least one group of first risk data, and the first risk data comprises a code file path, a code line number and a risk type of a first risk code. The second risk information comprises at least one group of second risk data, and the second risk data comprises a code file path, a code line number and a risk type of a second risk code. The final risk information comprises at least one group of third risk data. The deduplication and conflict detection processing on the first risk information and the second risk information to obtain the final risk information for recording potential risks of the to-be-tested version code comprises: calculating a position coincidence degree between a first target code and any second risk code according to a code file path and a code line number, wherein the first target code is any first risk code; identifying the same code segment of the second risk code based on the position coincidence degree, and determining whether there is a second target code; wherein the second target code is a second risk code belonging to the same code segment as the first target code; if the second target code exists and the risk type of the first target code is different from the risk type of the second target code, generating a group of third risk data according to the code file path of the first target code, the code line number of the first target code, the risk type of the first target code and the risk type of the second target code, and marking the second risk data corresponding to the second target code as a recorded state.

3. The method of claim 2, wherein, The first risk data further comprises a risk level of the first risk code, and the second risk data further comprises a risk level of the second risk code. The deduplication and conflict detection processing on the first risk information and the second risk information to obtain the final risk information for recording potential risks of the to-be-tested version code further comprises: if the second target code exists and the risk level of the first target code is different from the risk level of the second target code, determining a higher level in the risk level of the first target code and the risk level of the second target code, recording the higher level in the third risk data, and marking the second risk data corresponding to the second target code as a recorded state.

4. The method of claim 3, wherein, The deduplication and conflict detection processing on the first risk information and the second risk information to obtain the final risk information for recording potential risks of the to-be-tested version code further comprises: If the second target code exists, the risk type of the first target code is the same as the risk type of the second target code, and the risk level of the first target code is the same as the risk level of the second target code, the first risk data or the second risk data is taken as a group of the third risk data, and the second risk data corresponding to the second target code is marked as a recorded state.

5. The method of claim 2, wherein, The deduplication and conflict detection processing of the first risk information and the second risk information obtains final risk information for recording potential risks of the to-be-tested version code, and further includes: If the second target code does not exist, the first risk data corresponding to the first target code is taken as a group of the third risk data. After the deduplication and conflict detection processing of the first risk information is completed, if there is at least one group of unrecorded second risk data, the third risk data is generated one by one corresponding to the at least one group of unrecorded second risk data.

6. The method of claim 2, wherein, The position coincidence degree of the second target code and the first target code is greater than a preset coincidence threshold.

7. The method according to any one of claims 1 to 6, characterized in that, After the deduplication and conflict detection processing of the first risk information and the second risk information obtains final risk information for recording potential risks of the to-be-tested version code, further includes: The final risk information is pushed to a preset electronic terminal.

8. An apparatus for potential risk identification of a code, characterized by, Comprises: A comparison module is configured to compare a to-be-tested version code with a benchmark version code to determine a difference code file. A first risk identification module is configured to identify potential risks of the difference code file by a first code assistant tool based on an artificial intelligence large model to obtain first risk information. A second risk identification module is configured to identify potential risks of the difference code file by a second code assistant tool based on an artificial intelligence large model to obtain second risk information. An integration module is configured to deduplicate and detect conflicts of the first risk information and the second risk information to obtain final risk information for recording potential risks of the to-be-tested version code.

9. A storage medium, characterized by The storage medium stores computer readable instructions, and the computer readable instructions are executed by one or more processors to cause the one or more processors to perform the steps of the potential risk identification method of the code according to any one of claims 1 to 7.

10. A computer device, comprising: Comprises: One or more processors and a memory; The memory stores computer readable instructions, and the computer readable instructions are executed by the one or more processors to perform the steps of the potential risk identification method of the code according to any one of claims 1 to 7.