Source code integrity detection system based on distributed account book technology
By adopting distributed ledger technology in the source code management system, the problems of multi-user concurrent modification, data tampering and transmission security are solved, and the source code is efficient, automated and traceability management is achieved, and the software quality and stability are improved.
Patent Information
- Application Number
- CN202411555182.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-25
AI Technical Summary
The existing source code management system has shortcomings in the face of concurrent modifications of multiple users, data tampering and transmission security, and it is difficult to effectively ensure the integrity and security of the source code.
A source code integrity detection system based on distributed ledger technology is adopted. The system includes at least two distributed ledger nodes. The source code is compiled, integrity detection and broadcast transmission through the ledger receiving module, code detection module and ledger sending module. The system ensures the integrity and traceability of the source code by inserting test probes, static and dynamic code detection, troubleshooting and early warning.
Through distributed ledger technology, the risk of fraud and error is significantly reduced, the automation and efficiency of source code management is improved, the development cycle is shortened, the development cost is reduced, and the quality and stability of the software is improved.
Smart Images

Figure CN119513835A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a source code integrity detection system based on distributed ledger technology. The system ensures the integrity and traceability of source code during storage, transmission and modification through distributed ledger technology. Background Art
[0002] With the complexity of software development and the popularity of distributed collaboration, the integrity and security of source code have become urgent issues to be resolved. Traditional source code management systems have shortcomings in terms of multi-user concurrent modification, data tampering, and transmission security. Distributed ledger technology, with its decentralized, tamper-proof, and traceable characteristics, provides a new solution for source code integrity detection. Summary of the invention
[0003] The present invention provides a source code integrity detection system based on distributed ledger technology, which is used to solve the defects of existing source code management systems in the face of multi-user concurrent modification, data tampering and transmission security.
[0004] According to a first aspect of the present invention, a source code integrity detection system based on distributed ledger technology is provided, comprising:
[0005] At least two distributed ledger nodes, used to compile source code in the node, wherein the compilation at least includes writing, modifying and testing the source code;
[0006] Each of the distributed ledger nodes comprises:
[0007] The ledger receiving module is used to receive the distributed source code ledger published in the network;
[0008] A code detection module, used to compile the source code in the distributed source code account book;
[0009] The ledger sending module is used to send the compiled source code to the network in the form of broadcast.
[0010] According to an embodiment of the present invention, compiling the source code in the distributed source code ledger specifically includes:
[0011] Based on the distributed source code ledger, extract the source code, and insert a test probe based on the source code;
[0012] Based on the test probe, determine the test items of the source code, the test items at least including the number of code calls, running time, data flow information, code coverage and abnormal code;
[0013] Based on the test items, integrity detection is performed on the source code.
[0014] Specifically, this embodiment provides an implementation method for compiling the source code in the distributed source code ledger.
[0015] According to an implementation manner of the present invention, the integrity detection of the source code specifically includes:
[0016] Based on the test probe, obtaining a first coding feature of the source code, the first coding feature including a coding type, complexity, and loop structure of the source code;
[0017] Based on the first coding feature, static code detection is performed on the source code to obtain a static code analysis result;
[0018] In the case where the static code analysis result satisfies the static code integrity check, the static code check of the source code is marked as passed.
[0019] Specifically, this embodiment provides an implementation method for performing integrity detection on the source code.
[0020] According to an implementation manner of the present invention, the integrity detection of the source code specifically includes:
[0021] When the test program is run according to the source code, a second coding feature of the source code is obtained, and a code running test result is generated according to the second coding feature, wherein the second coding feature includes abnormal code, coverage, and security vulnerabilities of the source code during the code running test process;
[0022] If the code running test result satisfies the dynamic code integrity detection, marking the dynamic code detection of the source code as passed;
[0023] In the case that the code running test result does not satisfy the dynamic code integrity detection, the source code is troubleshooted and warned, and the code field with the fault is identified.
[0024] Specifically, this embodiment provides an implementation method for performing integrity detection on the source code.
[0025] According to an embodiment of the present invention, when the code running test result does not meet the dynamic code integrity detection, troubleshooting and warning the source code specifically include:
[0026] When the coverage rate of the code running test result is less than the coverage threshold, the run code field of the source code is marked for testing, and the test mark includes a timestamp, a tester, a test content, and a modified content.
[0027] Specifically, this embodiment provides an implementation method for troubleshooting and warning the source code.
[0028] According to an embodiment of the present invention, the receiving of a distributed source code ledger published in a network specifically includes:
[0029] Obtaining a first hash pointer of the distributed source code ledger, where the first hash pointer points to an access address of the distributed source code ledger;
[0030] Based on the access address, a second hash pointer of the distributed source code ledger is determined, wherein the second hash pointer points to a compilation address of the source code compiled by the previous distributed source code ledger, and the compilation address at least includes an undetected code field of the source code in the previous distributed source code ledger.
[0031] Specifically, this embodiment provides an implementation method for receiving a distributed source code ledger published in a network.
[0032] According to an embodiment of the present invention, the receiving of a distributed source code ledger published in a network specifically includes:
[0033] Based on the third hash pointer containing a probe address pointing to the test probe in the distributed source code ledger, the probe address at least includes a position of the test probe in the source code, a type of the test probe, and dependencies of the test probe;
[0034] Based on the third hash pointer, the source code is compiled in the current node, and the compilation of the source code in the current node at least includes an integrity test of the source code based on the test probe, an integrity test of the source code based on the updated test probe, and any one or a combination of the integrity test of the source code without the test probe.
[0035] Specifically, this embodiment provides an implementation method for receiving a distributed source code ledger published in a network.
[0036] According to an embodiment of the present invention, sending the compiled source code to the network in a broadcast form specifically includes:
[0037] Based on the compiled distributed source code ledger, generating a fourth hash pointer, wherein the fourth hash pointer points to the distributed source code ledger access address;
[0038] Based on the integrity detection result of the source code, a fifth hash pointer is generated, where the fifth hash pointer points to a compilation address of the distributed source code ledger, where the compilation address at least includes a code field of the source code that has not been detected.
[0039] Specifically, this embodiment provides an implementation method of sending the compiled source code to the network in a broadcast form.
[0040] According to an embodiment of the present invention, sending the compiled source code to the network in a broadcast form specifically includes:
[0041] Based on the test probe in the source code, a sixth hash pointer is generated, the sixth hash pointer points to a probe address of the test probe, the probe address includes at least a position of the test probe in the source code, a type of the test probe, and dependencies of the test probe.
[0042] Specifically, this embodiment provides an implementation method of sending the compiled source code to the network in a broadcast form.
[0043] According to a second aspect of the present invention, a computer program product is provided, which includes a non-transitory machine-readable medium storing a computer program, wherein the computer program is stored in the above-mentioned source code integrity detection system based on distributed ledger technology.
[0044] The above one or more technical solutions in the present invention have at least one of the following technical effects: a source code integrity detection system based on distributed ledger technology provided by the present invention performs integrity detection on the source code based on the distributed ledger. With the help of the feature that the source code data in the distributed ledger cannot be tampered with, the risk of fraud and error can be greatly reduced. At the same time, the automated and efficient source code management process can shorten the development cycle, reduce development costs, and improve the quality and stability of the software. It also promotes cooperation and collaboration among different development teams. By sharing and verifying source code data, team members can work more closely together to jointly promote the progress of the project. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 It is a structural schematic diagram of a source code integrity detection system based on distributed ledger technology provided by the present invention;
[0047] Figure 2 It is a structural schematic diagram of the electronic device provided by the present invention.
[0048] Reference numerals:
[0049] 10. Account book receiving module; 20. Code detection module; 30. Account book sending module;
[0050] 810, processor; 820, communication interface; 830, memory; 840, communication bus. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] The present invention is described in detail below in conjunction with the accompanying drawings of the specification. The specific operating method in the method embodiment can also be applied to the device embodiment or the system embodiment. In the description of the present invention, unless otherwise specified, "at least one" includes one or more. "Multiple" refers to two or more. For example, at least one of A, B and C includes: A exists alone, B exists alone, A and B exist at the same time, A and C exist at the same time, B and C exist at the same time, and A, B and C exist at the same time. In the present invention, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a kind of association relationship that describes the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0053] The present invention will be described in detail below in conjunction with specific implementation modes.
[0054] In some specific embodiments of the present invention, Figure 1 As shown, this solution provides a source code integrity detection system based on distributed ledger technology, including:
[0055] At least two distributed ledger nodes, used to compile source code in the node, where compilation includes at least writing, modifying and testing the source code;
[0056] Each distributed ledger node consists of:
[0057] The ledger receiving module 10 is used to receive the distributed source code ledger published in the network;
[0058] A code detection module 20, used to compile source code in a distributed source code account book;
[0059] The ledger sending module 30 is used to send the compiled source code to the network in a broadcast form.
[0060] In some possible implementations of the present invention, compiling the source code in the distributed source code ledger specifically includes:
[0061] Based on the distributed source code ledger, extract the source code and insert test probes based on the source code;
[0062] Based on the test probe, determine the test items of the source code, the test items at least include the number of code calls, running time, data flow information, code coverage and abnormal code;
[0063] Based on the test items, the source code is checked for integrity.
[0064] Specifically, this embodiment provides an implementation method for compiling source code in a distributed source code ledger. The technology of source code extraction, test probe insertion and integrity detection based on the distributed source code ledger can bring about automation, high efficiency, comprehensive coverage, precise positioning, real-time traceability, security improvement, continuous improvement and optimization and other technical effects, which is of great significance for improving the quality and efficiency of software development.
[0065] It should be noted that through the distributed source code ledger, source code can be efficiently and automatically extracted, reducing manual operations and improving work efficiency; inserting test probes based on the source code can monitor code behavior imperceptibly, realize non-code intrusive testing, and reduce the impact on the original system.
[0066] Furthermore, the present invention performs source code integrity detection including the number of code calls, running time, data flow information, code coverage, and abnormal code, etc. These dimensions comprehensively cover aspects such as code performance, functionality, and security.
[0067] Furthermore, by monitoring abnormal codes, potential security vulnerabilities can be discovered and repaired in a timely manner, improving the security of the system. Enhanced defense capabilities: Comprehensive test items and real-time monitoring enable the system to better resist external attacks and internal errors, improving overall defense capabilities.
[0068] In some possible implementations of the present invention, the integrity check of the source code specifically includes:
[0069] Based on the test probe, obtaining a first coding feature of the source code, the first coding feature including a coding type, complexity, and loop structure of the source code;
[0070] Based on the first coding feature, static code detection is performed on the source code, and a static code analysis result is obtained;
[0071] When the static code analysis result satisfies the static code integrity check, the static code check of the source code is marked as passed.
[0072] Specifically, this embodiment provides an implementation method for integrity detection of source code, which can preliminarily evaluate the basic quality of the code by obtaining the coding type, complexity and loop structure of the source code and performing static code detection based on the obtained information. These features are directly related to the readability, maintainability and potential performance issues of the code.
[0073] It should be noted that static code detection can further discover errors, potential vulnerabilities, unused variables or functions, redundant code and other problems in the code, thereby helping developers fix these problems before the code runs and improve the overall quality of the software.
[0074] Furthermore, static code analysis is performed before code compilation, so errors or exceptions that only appear at runtime can be discovered in advance. This greatly reduces the maintenance cost and time cost caused by hidden defects in the late stage of software development or after release.
[0075] In some possible implementations of the present invention, the integrity check of the source code specifically includes:
[0076] When the test program is run according to the source code, a second coding feature of the source code is obtained, and a code running test result is generated according to the second coding feature, where the second coding feature includes abnormal code, coverage, and security vulnerabilities of the source code during the code running test process;
[0077] If the code running test results meet the dynamic code integrity test, mark the dynamic code test of the source code as passed;
[0078] If the code running test results do not meet the dynamic code integrity detection, the source code is troubleshooted and warned, and the code fields with faults are identified.
[0079] Specifically, this embodiment provides an implementation method for integrity detection of source code. Dynamic code testing is an important part of the continuous integration and continuous deployment (CI / CD) process. Through automated testing, it can be ensured that each code submission or merge is fully verified, thereby maintaining the high quality and stability of the software. This helps to speed up software delivery and improve market competitiveness.
[0080] It should be noted that by testing during the source code running process, it is possible to capture abnormal code in the actual execution of the source code, such as runtime errors, resource leaks, deadlocks, etc. Timely discovery and repair of these anomalies can significantly improve the stability and reliability of the software and reduce crashes or unpredictable behaviors of the software after deployment.
[0081] Furthermore, by running tests on the source code, i.e., code dynamic testing, it is possible to evaluate which parts of the source code are covered by the test and which are not covered. This helps to discover those untested code paths, thereby increasing the comprehensiveness of the test and improving the reliability of the software.
[0082] Furthermore, dynamic code testing can identify security vulnerabilities in source code, such as input validation errors, buffer overflows, unauthorized access, etc. If these vulnerabilities are not discovered and fixed, they may be exploited by malicious users to cause damage to the system. Therefore, dynamic testing is crucial to improving software security.
[0083] In some possible implementations of the present invention, when the code running test result does not meet the dynamic code integrity detection, the source code is troubleshooted and warned, specifically including:
[0084] When the coverage rate of the code running test result is less than the coverage threshold, the run code field of the source code is marked for testing, and the test mark includes a timestamp, a tester, a test content, and a modified content.
[0085] Specifically, this embodiment provides an implementation method for troubleshooting and warning source code. In the continuous integration and continuous deployment (CI / CD) process, test tags can be used as part of automated testing. When the test coverage is lower than the threshold, an alarm can be automatically triggered or code merging can be blocked to ensure that only fully tested code can be deployed to the production environment. This helps maintain the high quality and stability of the software.
[0086] Furthermore, by adding test tags to the run code fields, including timestamp, tester, test content, and modified content, the process and results of each test can be clearly recorded. This increases the transparency of code testing and makes it easier for team members to understand the status and progress of testing.
[0087] Furthermore, when code coverage is found to be below a threshold, the corresponding code fields are immediately marked, which can prompt developers to pay attention to these areas and consider adding new test cases or modifying existing tests to improve coverage. This immediate feedback mechanism helps to continuously improve code quality.
[0088] In some possible implementations of the present invention, receiving a distributed source code ledger published in a network specifically includes:
[0089] Obtaining a first hash pointer of the distributed source code ledger, where the first hash pointer points to an access address of the distributed source code ledger;
[0090] Based on the access address, a second hash pointer of the distributed source code ledger is determined, the second hash pointer points to a compilation address of the source code compiled by the previous distributed source code ledger, and the compilation address at least includes an undetected code field of the source code in the previous distributed source code ledger.
[0091] Specifically, this embodiment provides an implementation method for receiving a distributed source code ledger published in a network. Through distributed storage and a chain structure of hash pointers, the source code ledger can resist a certain degree of data tampering and loss risk. Even if part of the ledger data is damaged, the complete information chain can be restored through data from other nodes.
[0092] Furthermore, the first hash pointer serves as a reference to the access address of the distributed source code ledger, ensuring the accessibility and uniqueness of the ledger. This allows any modification or compilation operation of the source code to be accurately tracked to the corresponding ledger record.
[0093] In addition, the second hash pointer further points to the compilation address of the source code in the previous distributed source code ledger, especially those code fields that have not been tested. This chain structure not only retains the compilation history of the code, but also highlights the key areas of detection, which helps to achieve more refined version control. By directly locating the undetected code fields in the previous ledger through the second hash pointer, the workload of repeated detection can be significantly reduced. Developers or testers can focus on these key areas to quickly identify and fix potential problems.
[0094] It can be understood that the present invention avoids quality problems caused by omissions or negligence through the continuity and comprehensiveness of code detection based on distributed ledger technology.
[0095] In some possible implementations of the present invention, receiving a distributed source code ledger published in a network specifically includes:
[0096] Based on the third hash pointer in the previous distributed source code ledger containing a probe address pointing to the test probe, the probe address at least includes a location of the test probe in the source code, a type of the test probe, and dependencies of the test probe;
[0097] Based on the third hash pointer, the source code is compiled in the current node. The source code compilation in the current node includes at least one or a combination of integrity testing of the source code based on a test probe, integrity testing of the source code based on an updated test probe, and integrity testing of the source code without the test probe.
[0098] Specifically, this embodiment provides an implementation method for receiving a distributed source code ledger published in a network. By storing the information of the test probe in the distributed source code ledger in the form of a hash pointer and allowing compilation and testing on a local node, this technical architecture enhances the maintainability and scalability of the system. When the system needs to be expanded or upgraded, only the corresponding test probes and compilation scripts need to be updated, without making large-scale changes to the overall architecture. This modular and loosely coupled design makes the system more flexible and easy to manage.
[0099] Furthermore, the third hash pointer provides a detailed reference to the test probe, including its location, type, and dependencies in the source code. This enables developers to accurately select and configure test probes during the compilation process to meet different testing requirements. By flexibly adjusting the test probes, different aspects and levels of the source code can be tested, thereby improving the accuracy and coverage of the test.
[0100] In a possible embodiment, based on the third hash pointer, the source code can be compiled and tested for integrity directly in the local node without transferring the code to other test environments. This not only reduces the data transmission and waiting time during the test, but also reduces the test errors caused by environmental differences. In addition, by combining different types of test probes (such as static analysis probes, dynamic execution probes, etc.), the source code can be tested comprehensively and in depth to ensure the integrity and quality of the code.
[0101] In addition, testing is an indispensable part of the continuous integration and continuous deployment (CI / CD) process. By introducing the third hash pointer and local compilation test mechanism, the testing process can be automated and integrated into the development process. Whenever the source code changes, the system automatically obtains the latest test probe information and compiles and tests it on the local node. This instant feedback mechanism helps to quickly discover and fix problems and maintain the high quality and stability of the software.
[0102] In some possible implementations of the present invention, the compiled source code is sent to the network in a broadcast form, specifically including:
[0103] Based on the compiled distributed source code ledger, a fourth hash pointer is generated, where the fourth hash pointer points to the distributed source code ledger access address;
[0104] Based on the integrity detection result of the source code, a fifth hash pointer is generated, and the fifth hash pointer points to the compilation address of the distributed source code ledger, and the compilation address at least includes the code field that has not been detected in the source code.
[0105] Specifically, this embodiment provides an implementation method for sending the compiled source code to the network in a broadcast form. In the continuous integration and continuous deployment (CI / CD) process, the generation of the fourth and fifth hash pointers can be used as part of the automated test. Whenever the source code changes, the system automatically compiles, tests, and generates hash pointers. These hash pointers can be recorded and stored as part of the build results for use in subsequent deployment and verification processes. This automated process helps improve development efficiency, reduce human errors, and ensure high quality and stability of the software.
[0106] Furthermore, the generation of the fourth hash pointer is a verification mechanism for the compiled distributed source code ledger. This ensures the integrity and consistency of the ledger content and prevents data corruption or tampering during compilation or transmission. This verification mechanism improves the reliability and stability of the system.
[0107] In a possible embodiment, the fourth hash pointer is used as the access address reference of the compiled ledger, so that each version of the ledger can be uniquely identified and tracked. This helps to quickly locate specific ledger records in version management, facilitating subsequent analysis, auditing, and repair work. At the same time, it also provides a clear version history for team collaboration and promotes the orderly development of the code base.
[0108] In addition, the generation of the fifth hash pointer is based on the integrity test results of the source code. It directly points to the code fields that have not been tested, providing developers with clear test feedback. This instant feedback mechanism helps developers quickly understand potential problems in the code and take corresponding repair measures. At the same time, because the feedback is based on actual test results, it has high accuracy and credibility.
[0109] Understandably, by analyzing the untested code field pointed to by the fifth hash pointer, the developer can evaluate whether the current test strategy is comprehensive and effective. If it is found that some important areas or key paths are omitted or insufficiently tested, the developer can adjust the test strategy in time, add corresponding test cases or improve the test method to improve the coverage and effectiveness of the test.
[0110] In some possible implementations of the present invention, the compiled source code is sent to the network in a broadcast form, specifically including:
[0111] Based on the test probe in the source code, a sixth hash pointer is generated, the sixth hash pointer points to the probe address of the test probe, and the probe address includes at least the position of the test probe in the source code, the type of the test probe, and the dependencies of the test probe.
[0112] Specifically, this embodiment provides an implementation method for sending the compiled source code to the network in a broadcast form. The test probe is usually used to detect potential problems in the software, including security vulnerabilities and performance bottlenecks. Through the sixth hash pointer, the developer can ensure the correctness and integrity of the test probe, thereby enhancing the security and reliability of the test. If the test probe is tampered with or damaged, the hash pointer will not match, thereby triggering a warning or error handling mechanism to prevent potential problems from being ignored or misreported.
[0113] It should be noted that the sixth hash pointer provides a unique identifier for the test probe, so that each step of the test process can be accurately tracked and audited. Through the hash pointer, you can easily find the specific location of the test probe in the source code, understand its type and other components or resources it depends on. This traceability is crucial for problem diagnosis, performance analysis and compliance auditing.
[0114] In a possible embodiment, when the source code is refactored or maintained, the location and dependencies of the test probes may change. Through the sixth hash pointer, developers can easily track these changes and update the test strategy accordingly. This helps ensure that during code refactoring or maintenance, the test probes can still accurately cover the critical code paths, thereby ensuring the quality and stability of the software.
[0115] Figure 2 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 2 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other via the communication bus 840. The processor 810 may call the logic instructions in the memory 830.
[0116] It should be noted that the electronic device in this embodiment can be a server, a PC, or other devices in specific implementation, as long as its structure includes the following: Figure 2The processor 810, communication interface 820, memory 830 and communication bus 840 shown in the figure, wherein the processor 810, communication interface 820, memory 830 communicate with each other through the communication bus 840, and the processor 810 can call the logic instructions in the memory 830 to execute the above method. This embodiment does not limit the specific implementation form of the electronic device.
[0117] The server may be a single server or a server group. The server group may be centralized or distributed (for example, the server may be a distributed system).
[0118] In a possible embodiment, the server can be local or remote relative to the terminal. For example, the server can access information stored in the user terminal, database or any combination thereof via a network.
[0119] As another example, the server may be directly connected to at least one of the user terminal and the database to access information and / or data stored therein.
[0120] In a possible embodiment, the server may be implemented on a cloud platform; by way of example only, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an inter-cloud, a multi-cloud, etc., or any combination thereof.
[0121] In a possible embodiment, the server and the user terminal may be implemented on an electronic device having one or more components in the embodiments of the present invention.
[0122] Furthermore, the network may be used for the exchange of information and / or data.
[0123] In a possible embodiment, one or more components in the interactive scenario (eg, a server, a user terminal, and a database) may send information and / or data to other components.
[0124] In possible embodiments, the network may be any type of wired or wireless network, or a combination thereof. As examples only, the network may include a wired network, a wireless network, a fiber optic network, a telecommunications network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a wide area network (WAN), a public switched telephone network (PSTN), a Bluetooth network, a ZigBee network, or a near field communication (NFC) network, or any combination thereof.
[0125] In a possible embodiment, the network may include one or more network access points. For example, the network may include a wired or wireless network access point, such as a base station and / or a network switching node, through which one or more components of the interactive scene may connect to the network to exchange data and / or information.
[0126] In addition, the logic instructions in the memory 830 described above may be implemented in the form of software functional units and when sold or used as independent products, may be stored in a computer-readable storage medium.
[0127] Based on such understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., various media that can store program codes.
[0128] The device embodiments described above are 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, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0129] 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 necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art 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 of each embodiment or some parts of the embodiment.
[0130] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A source code integrity detection system based on distributed ledger technology, characterized in that: include: At least two distributed ledger nodes, used to compile source code in the node, wherein the compilation at least includes writing, modifying and testing the source code; Each of the distributed ledger nodes comprises: A ledger receiving module (10), used for receiving a distributed source code ledger published in the network; A code detection module (20), used for compiling the source code in the distributed source code account book; The ledger sending module (30) is used to send the compiled source code to the network in a broadcast form.
2. A source code integrity detection system based on distributed ledger technology according to claim 1, characterized in that: The compiling the source code in the distributed source code ledger specifically includes: Based on the distributed source code ledger, extract the source code, and insert a test probe based on the source code; Based on the test probe, determine the test items of the source code, the test items at least including the number of code calls, running time, data flow information, code coverage and abnormal code; Based on the test items, integrity detection is performed on the source code.
3. A source code integrity detection system based on distributed ledger technology according to claim 2, characterized in that: The integrity check of the source code specifically includes: Based on the test probe, obtaining a first coding feature of the source code, the first coding feature including a coding type, complexity, and loop structure of the source code; Based on the first coding feature, static code detection is performed on the source code to obtain a static code analysis result; In the case where the static code analysis result satisfies the static code integrity check, the static code check of the source code is marked as passed.
4. A source code integrity detection system based on distributed ledger technology according to claim 2, characterized in that: The integrity check of the source code specifically includes: When the test program is run according to the source code, a second coding feature of the source code is obtained, and a code running test result is generated according to the second coding feature, wherein the second coding feature includes abnormal code, coverage, and security vulnerabilities of the source code during the code running test process; If the code running test result satisfies the dynamic code integrity detection, marking the dynamic code detection of the source code as passed; In the case that the code running test result does not satisfy the dynamic code integrity detection, the source code is troubleshooted and warned, and the code field with the fault is identified.
5. A source code integrity detection system based on distributed ledger technology according to claim 4, characterized in that: When the code running test result does not meet the dynamic code integrity detection, troubleshooting and warning the source code specifically include: When the coverage rate of the code running test result is less than the coverage threshold, the run code field of the source code is marked for testing, and the test mark includes a timestamp, a tester, a test content, and a modified content.
6. A source code integrity detection system based on distributed ledger technology according to any one of claims 2 to 5, characterized in that: The distributed source code ledger published in the receiving network specifically includes: Obtaining a first hash pointer of the distributed source code ledger, where the first hash pointer points to an access address of the distributed source code ledger; Based on the access address, a second hash pointer of the distributed source code ledger is determined, wherein the second hash pointer points to a compilation address of the source code compiled by the previous distributed source code ledger, and the compilation address at least includes an undetected code field of the source code in the previous distributed source code ledger.
7. A source code integrity detection system based on distributed ledger technology according to claim 6, characterized in that: The distributed source code ledger published in the receiving network specifically includes: Based on the third hash pointer containing a probe address pointing to the test probe in the distributed source code ledger, the probe address at least includes a position of the test probe in the source code, a type of the test probe, and dependencies of the test probe; Based on the third hash pointer, the source code is compiled in the current node, and the compilation of the source code in the current node at least includes an integrity test of the source code based on the test probe, an integrity test of the source code based on the updated test probe, and any one or a combination of the integrity test of the source code without the test probe.
8. A source code integrity detection system based on distributed ledger technology according to any one of claims 2 to 5, characterized in that: The step of sending the compiled source code to the network in a broadcasting form specifically includes: Based on the compiled distributed source code ledger, generating a fourth hash pointer, wherein the fourth hash pointer points to the distributed source code ledger access address; Based on the integrity detection result of the source code, a fifth hash pointer is generated, where the fifth hash pointer points to a compilation address of the distributed source code ledger, where the compilation address at least includes a code field of the source code that has not been detected.
9. A source code integrity detection system based on distributed ledger technology according to claim 8, characterized in that: The step of sending the compiled source code to the network in a broadcasting form specifically includes: Based on the test probe in the source code, a sixth hash pointer is generated, the sixth hash pointer points to a probe address of the test probe, the probe address includes at least a position of the test probe in the source code, a type of the test probe, and dependencies of the test probe.
10. A computer program product comprising a non-transitory machine-readable medium storing a computer program, characterized in that: The computer program is stored in a source code integrity detection system based on distributed ledger technology as described in any one of claims 1 to 9 above.