Application code auditing method and system, electronic equipment and storage medium
By dividing the application code into functional sub-codes and conducting security detection and compliance detection, the problem in the existing technology that the security detection and market review need to be separated before the application is put on the market is solved, a fast and accurate review process is achieved, and the cost is reduced Online risk.
Patent Information
- Application Number
- CN202410680617.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-13
AI Technical Summary
In the existing technology, applications need to be divided into two steps: security testing and market review before being put on the market. As a result, security testing cannot consider the needs of market review, cannot quickly detect whether it meets market requirements, and there is a risk of going online.
By dividing the initial audit code of the application into multiple functional sub-codes, each functional sub-code is subject to security detection and compliance detection, the code is updated based on the detection results, and the audit is conducted according to the preset audit rules to improve the accuracy of the audit. degree and efficiency, directly testing whether it meets market requirements.
It improves the accuracy and efficiency of code review, can quickly detect whether security and market requirements are met without waiting for market review, and reduces online risks.
Smart Images

Figure CN118642946A
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security technology, and in particular to a code review method, system, electronic device and storage medium for an application program. Background Art
[0002] Before an application is launched on the market, it needs to be submitted to the security inspection team for a security check, including inspection of the scope of information collection, inspection of application permissions, inspection of account services, and inspection of user infringements. After the security inspection is completed, the code corresponding to the security behavior will be modified. Once the code that meets the security inspection requirements is obtained, the code will be submitted to the market for review, and the results will be obtained based on the market review.
[0003] Then, the traditional audit method is divided into two steps: safety testing and market audit to obtain the testing method. There is no connection between safety testing and market audit, which leads to the inability of safety testing to take into account the needs of market audit.
[0004] Therefore, there is an urgent need to develop an application code review method, system, electronic device and storage medium to solve one or more of the above-mentioned problems. Summary of the invention
[0005] In view of this, in order to solve the above technical problems or part of the technical problems, an embodiment of the present invention provides a detection method for a matrix switch.
[0006] In a first aspect, the present application provides a method for code review of an application program, the method comprising:
[0007] Obtaining an initial audit code of the application, and dividing the initial audit code into a plurality of functional sub-codes based on the task function corresponding to the initial audit code;
[0008] Performing a security check on the initial audit code to obtain a security check result of the initial audit code, wherein the security check result includes a security check result of each functional subcode;
[0009] Based on the security detection result, the corresponding functional sub-codes in the initial audit code are updated, and a new audit code is synthesized according to the updated functional sub-codes as the code to be audited;
[0010] The audit rules preset by the application are obtained, and the audit code is audited according to the audit rules to obtain the audit result, and the update process of the function sub-code is re-executed according to the audit result.
[0011] In a possible implementation manner, performing a security check on the initial audit code to obtain a security check result of the initial audit code includes:
[0012] Obtaining preset functional requirements of the application;
[0013] Performing a functional integrity test on the initial audit code according to the functional requirements to obtain a completeness test result of the initial audit code;
[0014] Compliance detection is performed on multiple functional sub-codes of the initial audit code according to the functional requirements to obtain security detection results of the functional sub-codes.
[0015] In a possible implementation manner, before performing compliance detection on multiple functional subcodes of the initial review code according to the functional requirements, the method further includes:
[0016] When the integrity test result of the initial audit code is unqualified, the functional requirements are used to obtain the missing task functions of the initial audit code, and corresponding integrity modification suggestions are generated based on the missing task functions.
[0017] In a possible implementation manner, before updating the corresponding functional sub-codes in the initial audit code based on the security detection result, the method further includes:
[0018] Obtain the function subcodes with safety specification issues in historical experience and the modification methods of the function subcodes;
[0019] A function tag corresponding to the function sub-code is established, and the function sub-code with security specification problems and the modification method of the function sub-code are stored in a code modification library using the function tag as an index.
[0020] In a possible implementation, updating the corresponding functional subcodes in the initial audit code based on the security detection result includes:
[0021] Based on the safety test results of each functional sub-code in the safety test results, the functional sub-codes with safety specification problems are screened out;
[0022] Obtaining a function label of each function subcode of the function subcode having a safety specification problem;
[0023] Use the function tag to determine whether the same function subcode exists in the code modification library;
[0024] In the case where the same function subcode exists, calling the modification method of the function subcode in the code modification library, and completing the update of the function subcode based on the modification method;
[0025] In the case that the same function sub-code does not exist, the function label of the function sub-code is recorded, and a corresponding code security modification suggestion is generated based on the function label.
[0026] In a possible implementation manner, updating the corresponding functional sub-codes in the initial audit code based on the security detection result further includes:
[0027] Determine the number of subcodes with the same function label in the function subcodes with safety specification issues;
[0028] In the case where the number of the sub-codes exceeds the safety specification threshold, the function labels of the function sub-codes are recorded, and corresponding functional safety modification suggestions are generated based on the function labels.
[0029] In a possible implementation manner, re-executing the updating process of the function subcode according to the audit result includes:
[0030] If the audit result is unqualified, obtain the unqualified function subcode;
[0031] Determine whether the functional subcode has been updated before the review;
[0032] In the case where the function subcode is updated, the modification method of the function subcode in the code modification library is updated according to the audit rule, and the modification method is used to return to the step of completing the update of the function subcode based on the modification method, and the update process of the function subcode is re-executed;
[0033] In the case that there is no update to the function subcode, the modification method of the function subcode in the code modification library is obtained according to the audit rules, and the function subcode and the modification method of the function subcode are stored in the code modification library, and the modification method is used to return to the step of completing the update of the function subcode based on the modification method, and the update processing of the function subcode is re-executed.
[0034] In a second aspect, the present application provides a code review system for an application program, the system comprising:
[0035] A division module, used for obtaining an initial audit code of an application program, and dividing the initial audit code into a plurality of functional sub-codes based on the task function corresponding to the initial audit code;
[0036] A security detection module, used to perform a security detection on the initial audit code to obtain a security detection result of the initial audit code, wherein the security detection result includes a security detection result of each functional subcode;
[0037] An updating module, used for updating the corresponding functional sub-codes in the initial audit code based on the security detection result, and synthesizing a new initial audit code as the code to be audited according to the updated functional sub-codes;
[0038] The audit module is used to obtain the audit rules preset by the application, and audit the audit code according to the audit rules to obtain the audit result, and re-execute the update process of the function sub-code according to the audit result.
[0039] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the code review method for the application program described in any one of the embodiments of the first aspect are implemented.
[0040] In a fourth aspect, the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the code review method for an application program described in any one of the embodiments of the first aspect.
[0041] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages over the prior art: the code review method of the application provided by the embodiment of the present application, by dividing the review code into different task function pending function sub-codes, performs security checks on the security of the function sub-codes according to the requirements of each function, thereby improving the accuracy of the security check of the review code, and updates and processes each function sub-code that fails the security check according to the functional requirements, and merges them to obtain the pending code that meets the security check, and further reviews the pending code according to the review rules, thereby improving the accuracy of the review; in addition, after obtaining the review results, the present application will adjust the detection standards of the code security detection according to the review results, so that the APP does not need to wait for market review before going on the market, and can directly detect the results, quickly detect whether it meets market requirements, and eliminate the risk of going online. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0045] Figure 1A flowchart of a code review method for an application provided in an embodiment of the present application;
[0046] Figure 2 A flowchart of another method for code review of an application program provided in an embodiment of the present application;
[0047] Figure 3 A schematic diagram of the structure of a code review system for an application provided in an embodiment of the present application;
[0048] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0050] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0051] In order to solve the problem in the prior art that before an application is launched on the market, it is necessary to submit it to the security inspection team for security inspection, to conduct inspections on the scope of information collection, application permissions, account services, and user infringements; after the security inspection is completed, the corresponding code to the security behavior is modified, and after the code that meets the security inspection is obtained, the code will be submitted to the market for review, and the results are obtained according to the market review, which is divided into two steps, security inspection and market review, to obtain the inspection method. The security inspection has no connection with the market review before, resulting in the inability of the security inspection to take into account the needs of the market review. The present application provides a code review method for an application, which performs security inspection on the security of the function sub-code according to the requirements of each function, improves the accuracy of the security inspection of the audited code, and updates each function sub-code that fails the security inspection according to the functional requirements, and merges them to obtain the code to be reviewed that meets the security inspection, and further reviews the code to be reviewed according to the audit rules to improve the accuracy of the audit.
[0052] Figure 1 A flowchart of a code review method for an application provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method specifically includes:
[0053] S101, obtaining an initial audit code of an application, and dividing the initial audit code into a plurality of functional sub-codes based on a task function corresponding to the initial audit code;
[0054] In this embodiment, the source code of the APP includes codes for different functions, and all problem items need to be checked according to the specifications before the APP is put into use; first, the initial review source code of the APP is obtained, and then the source code is divided into multiple functional sub-codes of different functions according to the task functions corresponding to the source code (initial review code).
[0055] Generally, when the initial review code is divided into multiple functional sub-codes, corresponding functional labels are established in the functional sub-codes according to the task functions to distinguish different functional sub-codes.
[0056] For example, to get the function subcode corresponding to the system version number:
[0057] PackageInfo info=this.getPackageManager().getPackageInfo(this.getPackageName(),0);
[0058] int versionCode=nfo.versionCode
[0059] string versionName=info.versionNam
[0060] For example, to obtain the installation path and the list of installed programs in Android, the function subcode corresponding to the current program path is:
[0061] getApplicationContext().getFilesDir().getAbsolutePath()
[0062] (2) Android gets the list of installed programs
[0063] List <packageinfo>packageInfoList=getPackageManager().getInstalledPackages(0);
[0064] For example, get the function subcode corresponding to the screen width and height:
[0065] DisplayMetrics displayMetrics=new DisplayMetrics();
[0066] this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
[0067] int height=displayMetrics.heightPixels;
[0068] int width=displayMetrics.widthPixels;
[0069] At the code positions corresponding to the above codes, corresponding function tags for obtaining the system version number, obtaining the installation path and the list of installed programs, and obtaining the screen width and height are established. On this basis, a standard check of the application code can be carried out to conduct targeted checks according to the task functions, thereby providing accuracy of the standard check.
[0070] S102, performing a security check on the initial audit code to obtain a security check result of the initial audit code, wherein the security check result includes a security check result of each functional subcode;
[0071] In this embodiment, after the initial audit code is divided, security checks are performed on multiple functional sub-codes included in the initial audit code in sequence to obtain security check results of each functional sub-code and the security check result of the entire initial audit code.
[0072] S103, updating the corresponding functional sub-codes in the initial audit code based on the security detection result, and synthesizing a new audit code as the code to be audited according to the updated functional sub-codes;
[0073] In this embodiment, the initial audit code is updated according to the security detection result obtained by the detection to obtain the audit code that meets the detection specification as the code to be audited, and the subsequent audit process is continued.
[0074] Specifically, each functional subcode is updated according to the detection result of each functional subcode in the initial audit code to obtain each functional subcode that meets the specification requirements, and the functional subcodes that meet the specification requirements are further merged to obtain a new audit code as the code to be audited.
[0075] Compared with the conventional method of directly performing the entire code detection, the present application decomposes the initial code into functional sub-codes corresponding to each function, so that the review of the functional sub-codes is more accurate, thereby improving the accuracy of source code detection.
[0076] S104, obtaining the audit rules preset by the application, and auditing the code to be audited according to the audit rules to obtain the audit result, and re-execute the update process of the function sub-code according to the audit result.
[0077] In this embodiment, the standardized code to be reviewed is submitted to the market for review. The market reviews the code to be reviewed according to the review rules. After the review, the update processing of the functional sub-code corresponding to the code to be reviewed is re-executed according to the review results, so that the final code meets the specification requirements and the market review requirements. After the review results are obtained, the code security detection detection standards will be adjusted according to the review results, so that the application program does not respond to waiting for market review before it is launched on the market. Security risks can be eliminated only through security detection and code standardization can be carried out.
[0078] The code review method for the application provided in this embodiment divides the review code into sub-codes to be reviewed for different task functions, performs security checks on the security of the function sub-codes according to the requirements of each function, thereby improving the accuracy of the security check of the review code, and updates each function sub-code that has not passed the security check according to the functional requirements, and merges them to obtain the code to be reviewed that meets the security check, and further reviews the code to be reviewed according to the review rules to improve the accuracy of the review; and after obtaining the review results, the detection standards for the code security detection will be adjusted according to the review results, so that the APP does not need to wait for market review before going on the market, and the results can be directly detected, so as to quickly detect whether it meets market requirements and eliminate the risks of going online.
[0079] In an optional solution of the embodiment of the present invention, performing security detection on the initial audit code to obtain the security detection result of the initial audit code includes:
[0080] Obtaining preset functional requirements of the application;
[0081] Performing a functional integrity test on the initial audit code according to the functional requirements to obtain a completeness test result of the initial audit code;
[0082] Compliance detection is performed on multiple functional sub-codes of the initial audit code according to the functional requirements to obtain security detection results of the functional sub-codes.
[0083] In this embodiment, the detection of the application source code includes the detection of code functional integrity and functional specification.
[0084] Specifically, first obtain the pre-set functional requirements of the application to understand the functional sub-codes that the application should include, determine whether the initial review code includes all functional codes, perform code integrity detection, and obtain the source code integrity detection result; then perform compliance detection on each functional sub-code according to the specifications of each functional code to obtain the security detection result of the functional sub-code.
[0085] In an optional solution of the embodiment of the present invention, before performing compliance detection on multiple functional subcodes of the initial review code according to the functional requirements, the method further includes:
[0086] When the integrity test result of the initial audit code is unqualified, the functional requirements are used to obtain the missing task functions of the initial audit code, and corresponding integrity modification suggestions are generated based on the missing task functions.
[0087] In this embodiment, the review of the initial review code includes two parts: completeness review and functional code specification review. Before the functional sub-code is subject to compliance testing, if the completeness test result of the initial review code is unqualified, the functional requirements are used to obtain the task functions that are missing from the initial review code, and based on the missing functions, the completeness modification opinions of the initial suitable code are generated and fed back to the testing unit. The security testing unit can add and process the functional code that is missing from the source code based on the completeness modification opinions to ensure the integrity of the review code functions.
[0088] In an optional solution of the embodiment of the present invention, before updating the corresponding functional sub-codes in the initial audit code based on the security detection result, the method further includes:
[0089] Obtain the function subcodes with safety specification issues in historical experience and the modification methods of the function subcodes;
[0090] A function tag corresponding to the function sub-code is established, and the function sub-code with security specification problems and the modification method of the function sub-code are stored in a code modification library using the function tag as an index.
[0091] In this embodiment, before performing standard detection of functional sub-codes, a modification library of functional sub-codes based on security specification issues and corresponding modification methods of functional sub-codes will be established based on historical detection and modification experience, providing a modification basis for subsequent detection and update of public functional sub-codes.
[0092] Specifically, the function subcodes of the historical experience photos that have safety specification issues are obtained, and corresponding function labels are established for these function subcodes. The function subcodes that have safety specification issues and the modification methods are stored in the modification library with the function labels as indexes.
[0093] In an optional solution of the embodiment of the present invention, the updating of each corresponding functional sub-code in the initial audit code based on the security detection result includes:
[0094] Based on the safety test results of each functional sub-code in the safety test results, the functional sub-codes with safety specification problems are screened out;
[0095] In this embodiment, the code security specification is used to determine whether each functional sub-code has a security risk, and the functional sub-codes that do not comply with the code specification are screened out.
[0096] Obtaining a function label of each function subcode of the function subcode having a safety specification problem;
[0097] Use the function tag to determine whether the same function subcode exists in the code modification library;
[0098] In this embodiment, the function tag is used to determine whether there is a function subcode in the code modification library that is the same as the function subcode that does not comply with the code specification, thereby improving the modification efficiency of the function subcode.
[0099] In the case where the same function subcode exists, calling the modification method of the function subcode in the code modification library, and completing the update of the function subcode based on the modification method;
[0100] In the case that the same function sub-code does not exist, the function label of the function sub-code is recorded, and a corresponding code security modification suggestion is generated based on the function label.
[0101] In this embodiment, if the same function sub-code exists in the code modification library, the modification method of the same function sub-code in the code modification library is directly called, and the function sub-code is modified using the modification method; if the same function sub-code does not exist, the function label of the function sub-code is recorded, and the corresponding code security modification opinion is generated according to the label, and the modification opinion is fed back to the security detection center. The security detection center modifies the corresponding function sub-code in the initial review code according to the feedback modification opinion; the above function sub-code modification process realizes semi-automation of code modification by adding the code modification library, thereby improving the update efficiency of code security detection.
[0102] In an optional solution of the embodiment of the present invention, the updating of the corresponding functional sub-codes in the initial audit code based on the security detection result further includes:
[0103] Determine the number of subcodes with the same function label in the function subcodes with safety specification issues;
[0104] In the case where the number of the sub-codes exceeds the safety specification threshold, the function labels of the function sub-codes are recorded, and corresponding functional safety modification suggestions are generated based on the function labels.
[0105] In this embodiment, the code modification library records that each function sub-code has multiple different security specification issues. In the process of updating the corresponding function sub-codes in the audit code based on the security detection results, the number of sub-codes with the same function label in the function sub-code with the security specification issue is determined. If the data is greater than a preset security specification threshold, it means that the function code has too many security specification issues. At this time, the function label of the function sub-code should be recorded. Furthermore, the corresponding function safety modification opinion is generated according to the function label and fed back to the safety detection center. The safety detection center replaces the function according to the function safety modification opinion.
[0106] The code review method provided in this embodiment not only records the code review process on the basis of code review updates, but also performs further special processing on functional codes with multiple security specification issues to prevent the function from having security risks during the startup process of the application, thereby ensuring the security of subsequent code execution and improving the accuracy of code security detection.
[0107] Figure 2 A flowchart of another method for code review of an application program provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the method specifically includes:
[0108] S201. If the audit result is unqualified, obtain the unqualified function subcode;
[0109] In this embodiment, after the application is security-checked, the codes to be reviewed that meet the security specifications are further processed for market review to obtain the functional sub-codes that fail the review.
[0110] S202, determining whether the function subcode has been updated before the review;
[0111] S203, when the function subcode is updated, updating the modification mode of the function subcode in the code modification library according to the audit rule, and using the modification mode to return to the step of completing the update of the function subcode based on the modification mode, and re-execute the update process of the function subcode;
[0112] S204. When there is no update to the function subcode, obtain the modification method of the function subcode in the code modification library according to the audit rules, store the function subcode and the modification method of the function subcode in the code modification library, and use the modification method to return to the step of completing the update of the function subcode based on the modification method, and re-execute the update process of the function subcode.
[0113] In this embodiment, it is determined whether the function sub-code that fails the audit has been updated before the audit. If an update has been made, the audit rules are used to update the modification method of the function code in the code modification library. If no update has been made, the modification method of the function sub-code in the code modification library can be obtained according to the audit rules, and the function sub-code and the modification method of the function sub-code can be stored in the code modification library. The code modification library can also store modification methods that comply with market audit rules, so that the application does not need to wait for market audit before being put on the market, and the results can be obtained directly through testing, so as to quickly detect whether it meets market requirements.
[0114] Furthermore, after the modification method that complies with the market review rules is stored in the code modification library, the functional sub-code is re-executed to perform the update step to obtain the application code that complies with both security testing and market review requirements.
[0115] The code review method for the application provided in this embodiment performs a security check on the source code and then continues to perform a market review. The modification method of the code in the security check is updated according to the result of the market review, so that subsequent applications can complete the market review at the same time as the security check. There is no need to wait for the market review before listing, and the application code that meets both the security check and the market review requirements can be obtained, so as to quickly detect whether it meets the market requirements.
[0116] Figure 3 A schematic diagram of the structure of a code review system for an application provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the system specifically includes:
[0117] A division module 301 is used to obtain an initial audit code of an application program, and divide the initial audit code into a plurality of functional sub-codes based on the task function corresponding to the initial audit code;
[0118] A security detection module 302 is used to perform a security detection on the initial audit code to obtain a security detection result of the initial audit code, wherein the security detection result includes a security detection result of each functional sub-code;
[0119] An updating module 303 is used to update the corresponding functional sub-codes in the initial audit code based on the security detection result, and synthesize a new initial audit code as the code to be audited according to the updated functional sub-codes;
[0120] The audit module 304 is used to obtain the audit rules preset by the application, and perform audit processing on the audit code according to the audit rules to obtain the audit result, and re-execute the update processing of the function sub-code according to the audit result.
[0121] In one possible implementation, the security detection module 302 is also used to obtain the preset functional requirements of the application; perform a functional integrity test on the initial review code according to the functional requirements to obtain the integrity test results of the initial review code; perform a compliance test on multiple functional sub-codes of the initial review code according to the functional requirements to obtain the security test results of the functional sub-codes.
[0122] In a possible implementation, the security check module 302 is also used to obtain the missing task functions of the initial review code using functional requirements when the integrity check result of the initial review code is unqualified, and generate corresponding integrity modification suggestions based on the missing task functions.
[0123] In one possible implementation, the update module 303 is also used to obtain function sub-codes that have security specification issues in historical experience and methods for modifying the function sub-codes; establish function tags corresponding to the function sub-codes, and store the function sub-codes that have security specification issues and methods for modifying the function sub-codes in a code modification library using the function tags as indexes.
[0124] In one possible implementation, the update module 303 is also used to screen out functional sub-codes with security specification issues based on the security detection results of each functional sub-code in the security detection results; obtain the functional label of each functional sub-code of the functional sub-code with security specification issues; use the functional label to determine whether the same functional sub-code exists in the code modification library; if the same functional sub-code exists, call the modification method of the functional sub-code in the code modification library, and complete the update of the functional sub-code based on the modification method; if the same functional sub-code does not exist, record the functional label of the functional sub-code, and generate a corresponding code security modification opinion based on the functional label.
[0125] In one possible implementation, the update module 303 is also used to determine the number of sub-codes with the same function label in the function sub-code with security specification issues; when the number of the sub-codes exceeds the security specification threshold, the function label of the function sub-code is recorded, and corresponding functional safety modification suggestions are generated based on the function label.
[0126] In one possible implementation, the audit module 304 is also used to, if the audit result is unqualified, obtain an unqualified function sub-code; determine whether the function sub-code has been updated before the audit; if the function sub-code has been updated, update the modification method of the function sub-code in the code modification library according to the audit rules, and use the modification method to return to the step of completing the update of the function sub-code based on the modification method, and re-execute the update process of the function sub-code; if the function sub-code has not been updated, obtain the modification method of the function sub-code in the code modification library according to the audit rules, store the function sub-code and the modification method of the function sub-code in the code modification library, and use the modification method to return to the step of completing the update of the function sub-code based on the modification method, and re-execute the update process of the function sub-code.
[0127] The code review system for the application provided in this embodiment can be as follows Figure 3 The code review system for the application shown in , can be performed as follows Figure 1-2 All steps of code review of the application in Figure 1-2 For details, please refer to the technical effects of code review of the application shown. Figure 1-2 For the sake of brevity, the relevant description is not repeated here.
[0128] The system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0129] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, an embodiment of the present application provides an electronic device, including a processor 401, a communication interface 402, a memory 403 and a communication bus 404, wherein the processor 401, the communication interface 402, and the memory 403 communicate with each other through the communication bus 404; the memory 403 is used to store computer programs; the processor 401 is used to execute the program stored in the memory 403, and implement the steps of the code review method of the application provided by any of the above method embodiments:
[0130] Obtain an initial audit code of an application, and divide the initial audit code into multiple functional sub-codes based on the task function corresponding to the initial audit code; perform a security check on the initial audit code to obtain a security check result of the initial audit code, wherein the security check result includes a security check result of each functional sub-code; update each corresponding functional sub-code in the initial audit code based on the security check result, and synthesize a new audit code as a code to be audited based on the updated functional sub-code; obtain the audit rules preset by the application, and perform an audit on the code to be audited based on the audit rules to obtain an audit result, and re-execute the update process of the functional sub-code based on the audit result.
[0131] In one possible implementation, the preset functional requirements of the application are obtained; the functional integrity test is performed on the initial audit code according to the functional requirements to obtain the integrity test result of the initial audit code; and the compliance test is performed on multiple functional sub-codes of the initial audit code according to the functional requirements to obtain the security test result of the functional sub-codes.
[0132] In a possible implementation, when the integrity test result of the initial audit code is unqualified, the task functions missing from the initial audit code are obtained using functional requirements, and corresponding integrity modification suggestions are generated based on the missing task functions.
[0133] In one possible implementation, function subcodes with security specification issues and methods for modifying the function subcodes from historical experience are obtained; function tags corresponding to the function subcodes are established, and the function subcodes with security specification issues and methods for modifying the function subcodes are stored in a code modification library using the function tags as indexes.
[0134] In one possible implementation, based on the security detection results of each functional sub-code in the security detection results, the functional sub-codes with security specification issues are screened out; the functional tags of each functional sub-code of the functional sub-code with security specification issues are obtained; the functional tags are used to determine whether the same functional sub-code exists in the code modification library; if the same functional sub-code exists, the modification method of the functional sub-code in the code modification library is called, and the update of the functional sub-code is completed based on the modification method; if the same functional sub-code does not exist, the functional tag of the functional sub-code is recorded, and a corresponding code security modification opinion is generated based on the functional tag.
[0135] In one possible implementation, the number of sub-codes with the same function label in a function sub-code with a safety specification issue is determined; if the number of sub-codes exceeds a safety specification threshold, the function label of the function sub-code is recorded, and a corresponding functional safety modification suggestion is generated based on the function label.
[0136] In one possible implementation, when the audit result is unqualified, an unqualified function sub-code is obtained; it is determined whether the function sub-code has been updated before the audit; when the function sub-code has been updated, the modification method of the function sub-code in the code modification library is updated according to the audit rules, and the modification method is used to return to the step of completing the update of the function sub-code based on the modification method, and the update processing of the function sub-code is re-executed; when the function sub-code has not been updated, the modification method of the function sub-code in the code modification library is obtained according to the audit rules, and the function sub-code and the modification method of the function sub-code are stored in the code modification library, and the modification method is used to return to the step of completing the update of the function sub-code based on the modification method, and the update processing of the function sub-code is re-executed.
[0137] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0138] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0139] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.< / packageinfo>
Claims
1. A code review method for an application, characterized in that: The method comprises: Obtaining an initial audit code of the application, and dividing the initial audit code into a plurality of functional sub-codes based on the task function corresponding to the initial audit code; Performing a security check on the initial audit code to obtain a security check result of the initial audit code, wherein the security check result includes a security check result of each functional subcode; Based on the security detection result, the corresponding functional sub-codes in the initial audit code are updated, and a new audit code is synthesized according to the updated functional sub-codes as the code to be audited; The audit rules preset by the application are obtained, and the audit code is audited according to the audit rules to obtain the audit result, and the update process of the function sub-code is re-executed according to the audit result.
2. The method according to claim 1, characterized in that The performing of security testing on the initial audit code to obtain a security testing result of the initial audit code includes: Obtaining preset functional requirements of the application; Performing a functional integrity test on the initial audit code according to the functional requirements to obtain a completeness test result of the initial audit code; Compliance detection is performed on multiple functional sub-codes of the initial audit code according to the functional requirements to obtain security detection results of the functional sub-codes.
3. The method according to claim 2, characterized in that Before performing compliance detection on the multiple functional subcodes of the initial review code according to the functional requirements, the method further includes: When the integrity test result of the initial audit code is unqualified, the functional requirements are used to obtain the missing task functions of the initial audit code, and corresponding integrity modification suggestions are generated based on the missing task functions.
4. The method according to claim 1, characterized in that: Before updating the corresponding functional subcodes in the initial audit code based on the security detection result, the method further includes: Obtain the function subcodes with safety specification issues in historical experience and the modification methods of the function subcodes; A function tag corresponding to the function sub-code is established, and the function sub-code with security specification problems and the modification method of the function sub-code are stored in a code modification library using the function tag as an index.
5. The method according to claim 4, characterized in that The updating of each corresponding functional sub-code in the initial audit code based on the security detection result includes: Based on the safety test results of each functional sub-code in the safety test results, the functional sub-codes with safety specification problems are screened out; Obtaining a function label of each function subcode of the function subcode having a safety specification problem; Use the function tag to determine whether the same function subcode exists in the code modification library; In the case where the same function subcode exists, calling the modification method of the function subcode in the code modification library, and completing the update of the function subcode based on the modification method; In the case that the same function sub-code does not exist, the function label of the function sub-code is recorded, and a corresponding code security modification suggestion is generated based on the function label.
6. The method according to claim 5, characterized in that The updating of each corresponding functional sub-code in the initial audit code based on the security detection result also includes: Determine the number of subcodes with the same function label in the function subcodes with safety specification issues; In the case where the number of the sub-codes exceeds the safety specification threshold, the function labels of the function sub-codes are recorded, and corresponding functional safety modification suggestions are generated based on the function labels.
7. The method according to claim 5, characterized in that The re-execution of the updating process of the function subcode according to the audit result includes: If the audit result is unqualified, obtain the unqualified function subcode; Determine whether the functional subcode has been updated before the review; In the case where the function subcode is updated, the modification method of the function subcode in the code modification library is updated according to the audit rule, and the modification method is used to return to the step of completing the update of the function subcode based on the modification method, and the update process of the function subcode is re-executed; In the case that there is no update to the function subcode, the modification method of the function subcode in the code modification library is obtained according to the audit rules, and the function subcode and the modification method of the function subcode are stored in the code modification library, and the modification method is used to return to the step of completing the update of the function subcode based on the modification method, and the update processing of the function subcode is re-executed.
8. A code review system for an application, characterized in that: The system comprises: A division module, used for obtaining an initial audit code of an application program, and dividing the initial audit code into a plurality of functional sub-codes based on the task function corresponding to the initial audit code; A security detection module, used to perform a security detection on the initial audit code to obtain a security detection result of the initial audit code, wherein the security detection result includes a security detection result of each functional subcode; An updating module, used for updating the corresponding functional sub-codes in the initial audit code based on the security detection result, and synthesizing a new initial audit code as the code to be audited according to the updated functional sub-codes; The audit module is used to obtain the audit rules preset by the application, and audit the audit code according to the audit rules to obtain the audit result, and re-execute the update process of the function sub-code according to the audit result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the code review method of the application program according to any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the code review method for an application program according to any one of claims 1 to 7 are implemented.
