Risk assessment method, device and equipment for dependency relationship of open source software
By building a project graph model and a risk prediction model, and using graph neural network to analyze the dependencies of open source software packages, it solves the problem that it is difficult to explore the risk of open source software dependencies in the existing technology, and accurately identify and personalize the response to potential risks, improving the stability and security of the software system.
Patent Information
- Application Number
- CN202510423595.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-18
AI Technical Summary
It is difficult for the existing technology to effectively explore and predict potential conflict patterns or security risks in open source software dependencies, especially in large-scale dependency networks.
Build a project graph model, use the risk prediction model to perform risk assessment, including feature extraction network, convolutional attention mechanism network and risk assessment network, analyze the dependencies between open source software packages through graph neural network, identify potential risks and formulate response plans.
It realizes an accurate risk assessment of open source software dependencies, can identify security vulnerabilities, version conflicts and redundant dependencies, provides personalized risk response strategies, and improves the stability and security of the software system.
Smart Images

Figure CN120335856A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and particularly to a method, apparatus, and device for risk assessment of open-source software dependency relationships. Background Art
[0002] Open-source software has become an indispensable part of the modern software development ecosystem. From small personal projects to large enterprise-level applications, all rely on the advantages of open-source software in terms of function realization and development efficiency. Today's projects are often not isolated single applications, but rely on dozens or even hundreds of open-source software libraries or components, forming a huge and complex dependency network. Therefore, having an overall grasp of the multi-level dependencies of a project helps to keep track of the risks of the project in real time.
[0003] Currently, traditional methods use graph databases to construct dependency graphs, and then use graph query languages for retrieval and visualization analysis. They have certain advantages in representing complex relationships and rapid querying, but most applications still stay at the storage and retrieval level, lacking higher-order graph analysis models, making it difficult to discover potential conflict patterns or security risks, and the ability to deeply predict and anticipate large-scale dependency networks is also relatively limited. Summary of the Invention
[0004] Based on this, it is necessary to provide a method, apparatus, and device for risk assessment of open-source software dependency relationships to fully predict and discover the risks of open-source software dependency relationships in a project for the above technical problems.
[0005] In a first aspect, the present application provides a method for risk assessment of open-source software dependency relationships, including:
[0006] Obtain the software package attribute information of each open-source software package and the dependency information between each open-source software package in the project to be evaluated;
[0007] Construct a project graph model for the project to be evaluated according to the software package attribute information of each open-source software package and the dependency information between each open-source software package; wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the software package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge;
[0008] Based on a risk prediction model, determine the risk assessment result of the project to be evaluated according to the project graph model.
[0009] In one of the embodiments, the risk prediction model includes a feature extraction network, a convolutional attention mechanism network, and a risk assessment network;
[0010] Based on the risk prediction model, according to the project graph model, to determine the risk assessment result of the project to be evaluated, including:
[0011] Input the project graph model into the feature extraction network to obtain the node features of each node and the edge features of each connection edge extracted by the feature extraction network from the project graph model;
[0012] Input each node feature and each edge feature into the convolutional attention mechanism network to obtain the node representation vectors output after the convolutional attention mechanism network processes each node feature and each edge feature;
[0013] Input the node representation vectors into the risk assessment network to obtain the risk assessment result of the project to be evaluated.
[0014] In one embodiment, the convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer.
[0015] In one embodiment, the obtaining of the software package attribute information of each open-source software package and the dependency information between each open-source software package in the project to be evaluated includes:
[0016] Obtain the project structure information of the project to be evaluated from the open-source code hosting platform of the project to be evaluated, and obtain the metadata information of each open-source software package from the package management platform of the project to be evaluated;
[0017] Obtain the reference relationship between each open-source software package from the project structure information;
[0018] Obtain the software package attribute information of each open-source software package and the initial dependency relationship between each open-source software package from the metadata information of each open-source software package;
[0019] Determine the dependency information between each open-source software package according to the reference relationship and the initial dependency relationship between each open-source software package.
[0020] In one embodiment, after determining the risk assessment result of the project to be evaluated based on the risk prediction model according to the project graph model, the method further includes:
[0021] Determine the project risk type of the project to be evaluated according to the risk assessment result;
[0022] Determine a risk response plan according to the project risk type and the risk assessment result;
[0023] Adjust the project to be evaluated according to the risk response plan.
[0024] In one embodiment, the project risk types include security vulnerabilities, version conflicts, or redundant dependencies;
[0025] Based on the project risk types and the risk assessment results, determine a risk response plan, including:
[0026] If the project risk type is a security vulnerability, determine the risk level according to the risk assessment results, and determine a risk response plan according to the risk level;
[0027] If the project risk type is a version conflict, determine the conflict path according to the risk assessment results, and determine a risk response plan according to the conflict path;
[0028] If the project risk type is a redundant dependency, determine the functional redundancy information according to the risk assessment results, and determine a risk response plan according to the functional redundancy information.
[0029] In one embodiment, determining a risk response plan according to the conflict path includes:
[0030] According to the conflict path, determine the conflicting open-source software packages with incompatible situations;
[0031] According to the dependency information between the conflicting open-source software packages and other open-source software packages and the package attribute information of the conflicting open-source software packages, determine the replacement open-source software packages for the conflicting open-source software packages;
[0032] According to the replacement open-source software packages, determine a risk response plan.
[0033] In a second aspect, the present application also provides a risk assessment device for open-source software dependency relationships, including:
[0034] An information acquisition module, configured to acquire the package attribute information of each open-source software package and the dependency information between each open-source software package in the project to be evaluated;
[0035] A model construction module, configured to construct a project graph model for the project to be evaluated according to the package attribute information of each open-source software package and the dependency information between each open-source software package; wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge;
[0036] A risk assessment module, configured to determine the risk assessment result of the project to be evaluated based on a risk prediction model according to the project graph model.
[0037] In a third aspect, the present application further provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0038] Obtain the software package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package;
[0039] According to the software package attribute information of each open-source software package and the dependency information between each open-source software package, construct a project graph model for the project to be evaluated; wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the software package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge;
[0040] Based on the risk prediction model, determine the risk assessment result of the project to be evaluated according to the project graph model.
[0041] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0042] Obtain the software package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package;
[0043] According to the software package attribute information of each open-source software package and the dependency information between each open-source software package, construct a project graph model for the project to be evaluated; wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the software package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge;
[0044] Based on the risk prediction model, determine the risk assessment result of the project to be evaluated according to the project graph model.
[0045] In a fifth aspect, the present application further provides a computer program product, including a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0046] Obtain the software package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package;
[0047] Construct a project graph model for the project to be evaluated according to the package attribute information of each open-source software package and the dependency information between each open-source software package; wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge;
[0048] Based on the risk prediction model, determine the risk assessment result of the project to be evaluated according to the project graph model.
[0049] The above risk assessment method, device and equipment for open-source software dependency relationships construct a project graph model for the project to be evaluated according to the obtained package attribute information of each open-source software package and the dependency information between each open-source software package; since the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge, therefore, the project graph model can fully reflect the complete information of direct dependencies, transitive dependencies and cross-ecosystem dependencies of each open-source software package in the project to be evaluated. Therefore, based on the risk prediction model and according to the project graph model, the risk assessment result of the project to be evaluated can be accurately determined. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0051] Figure 1 It is a schematic flowchart of a risk assessment method for open-source software dependency relationships in an embodiment;
[0052] Figure 2 It is a structural diagram of a risk prediction model in an embodiment;
[0053] Figure 3 It is a schematic flowchart of determining the risk assessment result of the project to be evaluated in an embodiment;
[0054] Figure 4 It is a schematic flowchart of obtaining package attribute information and dependency information in an embodiment;
[0055] Figure 5 Schematic diagram of the process for adjusting the project to be evaluated in an embodiment;
[0056] Figure 6 Schematic diagram of the process for determining a risk response plan in an embodiment;
[0057] Figure 7 Schematic diagram of the process for a risk assessment method of open-source software dependency relationships in another embodiment;
[0058] Figure 8 Block diagram of the structure of a risk assessment device for open-source software dependency relationships in an embodiment;
[0059] Figure 9 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0060] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] The risk assessment method for open-source software dependency relationships provided by the embodiments of the present application can be applied to an application environment for assessing the risks of open-source software used in a project. The risk assessment method for open-source software dependency relationships provided by the embodiments of the present application can be executed by a computer device, which can be a server or a terminal with powerful computing capabilities.
[0062] In an exemplary embodiment, as Figure 1 shown, a risk assessment method for open-source software dependency relationships is provided. Taking the application of this method to a server as an example, the specific steps are as follows:
[0063] S101, Obtain the software package attribute information of each open-source software package and the dependency information between each open-source software package in the project to be evaluated.
[0064] Among them, the project to be evaluated can be any project that uses open-source software. The package attribute information of each open-source software package in the open-source software supply chain of the project to be evaluated characterizes the basic information of the open-source software package. For example, the package attribute information includes but is not limited to attributes such as the version, release date, and maintenance status of the open-source software package, and to a certain extent, the package attribute information can reflect the role and status of the open-source software package in the entire dependency network. The dependency information between each open-source software package characterizes the dependency relationship between each open-source software package. For example, the dependency information between any two open-source software packages includes but is not limited to the dependency type (compile-time, run-time, etc.), version constraints, and dependency strength. Through the dependency information between each open-source software package, the mutual dependency degree and constraint relationship between each open-source software package can be accurately depicted.
[0065] Optionally, the package attribute information of each open-source software package and the dependency information between each open-source software package in the project to be evaluated can be obtained from the management system of the project to be evaluated.
[0066] S102, construct a project graph model for the project to be evaluated according to the package attribute information of each open-source software package and the dependency information between each open-source software package.
[0067] Among them, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge.
[0068] Optionally, after obtaining the package attribute information of each open-source software package and the dependency information between each open-source software package, in order to ensure the consistency and availability of the data, it is necessary to perform comprehensive cleaning, standardization, and structuring processing on the package attribute information and the dependency information between each open-source software package. This process involves operations such as data denoising, format unification, and data filling to eliminate data inconsistencies and uncertainties.
[0069] Furthermore, each open-source software package can be used as a node, and the node information of each node includes the attribute information of the open-source software package corresponding to the node. According to the dependency information between each open-source software package, the nodes of the open-source software packages with a dependency relationship are connected to form a connection edge, and edge information is added to each connection edge according to the dependency information.
[0070] It can be understood that the constructed project graph model can fully reflect the complete information of direct dependencies, transitive dependencies, and cross-ecosystem dependencies of each open-source software package in the project to be evaluated. Direct dependencies reflect the direct associations between open-source software packages, transitive dependencies reveal indirect dependency chains, and cross-ecosystem dependency information can help users understand the interactions and influences between different technology ecosystems.
[0071] S103. Based on the risk prediction model and according to the project graph model, determine the risk assessment result of the project to be evaluated.
[0072] Among them, the risk prediction model is used to predict the risks of the open-source software supply chain included in the project to be evaluated. In the embodiments of the present application, the risk prediction model can be constructed based on a graph neural network, including but not limited to a feature extraction network, a convolutional attention mechanism network, and a risk assessment network, and the convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer.
[0073] Optionally, the project graph model can be input into the risk prediction model, so that the risk prediction model analyzes the project graph model according to the model parameters, and takes the output of the risk prediction model as the risk assessment result of the project to be evaluated.
[0074] In the above risk assessment method for open-source software dependency relationships, according to the obtained software package attribute information of each open-source software package and the dependency information between each open-source software package, a project graph model for the project to be evaluated is constructed; since the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the software package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge. Therefore, through the project graph model, the complete information of direct dependencies, transitive dependencies, and cross-ecosystem dependencies of each open-source software package in the project to be evaluated can be fully reflected. Therefore, based on the risk prediction model and according to the project graph model, the risk assessment result of the project to be evaluated can be accurately determined.
[0075] Optionally, as Figure 2 shown, it is the structural diagram of the risk prediction model provided by the embodiments of the present application. Among them, the risk prediction model includes a feature extraction network, a convolutional attention mechanism network, and a risk assessment network. The convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer. In this case, in one embodiment, as Figure 3 shown, a method for determining the risk assessment result of a project to be evaluated is provided to refine the above S103, which specifically includes the following steps:
[0076] S301. Input the project graph model into the feature extraction network to obtain the node features of each node and the edge features of each connection edge extracted by the feature extraction network from the project graph model.
[0077] Among them, the feature extraction network is used to extract the features of each node and each connection edge in the project graph model.
[0078] Optionally, the project graph model can be input into the feature extraction network so that the feature extraction network extracts the node features of each node and the edge features of each connection edge according to the node information of each node and the edge information of each connection edge in the project graph model.
[0079] S302. Input the node features and edge features into the convolutional attention mechanism network to obtain the node representation vectors output after the convolutional attention mechanism network processes the node features and edge features.
[0080] Among them, the convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer to perform multiple convolutional and attention mechanism processes on the node features and edge features.
[0081] It should be noted that based on the directed graph convolutional layer and combined with the dynamic weighting mechanism of the graph attention layer, the convolutional attention mechanism network can more sensitively perceive the relationships and importance differences between nodes. The directed graph convolutional layer can perform convolutional operations on the project graph model data in the direction of the dependency relationship, so as to better capture the propagation and influence paths of the dependency relationship. The graph attention layer automatically adjusts the weight allocation by assigning dynamic weights to nodes and connection edges and according to the features of the nodes and the relationships with neighboring nodes, enabling the convolutional attention mechanism network to focus more on important nodes and connection edges and improving the efficiency and accuracy of information transmission.
[0082] At the same time, in order to improve the scalability of the convolutional attention mechanism network to the project graph model data, the neighbor sampling strategy of GraphSAGE is borrowed. In the project graph model data, traversing and calculating all neighboring nodes often leads to huge consumption of computing resources and excessive computing time. Through the neighbor sampling strategy, the model can select representative neighboring nodes for calculation on the premise of ensuring calculation accuracy, thereby greatly reducing the calculation amount and improving the training and inference speed of the model.
[0083] For example Figure 2In the message passing process, through multiple rounds of message passing and aggregation operations, each node can continuously fuse the information of its neighbors (dependencies or dependents). In this process, the node continuously updates its own representation, gradually fusing the information of dependencies from a wider range, and finally obtaining a high-dimensional embedding vector that can reflect its global position and influence. This embedding vector will serve as the feature representation of the node, that is, the node representation vector, providing strong support for subsequent dependent risk identification and prediction.
[0084] S303, input the node representation vector into the risk assessment network to obtain the risk assessment result of the project to be evaluated.
[0085] Optionally, the node representation vector can be input into the risk assessment network, so that the risk assessment network can comprehensively identify and accurately predict the potential risks in the open source software supply chain of the project to be evaluated according to the node representation vector, and output the risk assessment result of the project to be evaluated.
[0086] In this embodiment, by introducing the convolutional attention mechanism network, the relationship and importance difference between nodes can be more sensitively perceived, the efficiency and accuracy of information transmission can be improved, and then the risk assessment network is introduced to ensure the accuracy of the determined risk assessment result.
[0087] It should be noted that in the training process of the risk prediction model, in the training samples used to train the model, in addition to the project graph model of the project to be evaluated, it is also necessary to obtain risk intelligence from vulnerability databases (such as CVE, NVD, etc.). The vulnerability database is a valuable resource in the field of software security, which contains a large amount of security vulnerability information and risk assessment reports. By collecting and analyzing these data, the security risks of each software package can be understood in a timely manner, providing support for subsequent risk identification and prediction. And the risk intelligence obtained from the vulnerability database is added as a label to the node information of each node in the project graph model.
[0088] Therefore, the node information of each node in the project graph model, as the key information describing the open source software package, is not limited to basic information such as software package name and version, but also needs to deeply explore other high-value features from multiple dimensions to comprehensively describe the essential attributes of the software package and its status in the open source ecosystem. For example, the node information can also include information such as maintainer activity, release frequency, GitHub Star count, Issue response time, historical vulnerability records, repair efficiency, test coverage, and code complexity.
[0089] Among them, the maintainer is the main body responsible for the maintenance and update of the software package, and their activity level is directly related to the quality and development potential of the software package. An active maintainer can usually respond to community feedback in a timely manner, quickly fix vulnerabilities and update functions, thereby keeping the software package competitive and stable. The release frequency reflects the update rhythm and vitality of the open-source software package. A higher release frequency means that the open-source software package is constantly being updated and improved to adapt to the changing technical environment and user needs. The number of GitHub Stars, as an important indicator to measure the popularity of open-source software packages in the open-source community, usually indicates the advantages of open-source software packages in terms of functions, performance, or innovation, attracting the attention and recognition of many developers. The Issue response time reflects the degree of attention paid by the maintainer to user feedback and the efficiency of problem-solving. A fast Issue response time can enhance developers' confidence in the open-source software package and promote its use and promotion in the development process. The historical vulnerability record records the past security problems and vulnerability situations of the open-source software package. By analyzing the historical vulnerability record, we can understand the security performance of the software package, as well as the degree of attention and repair ability of the maintainer to vulnerability repair. The repair efficiency measures the speed and effectiveness of the maintainer in repairing vulnerabilities. A higher repair efficiency can eliminate potential security threats in a timely manner and ensure the security and reliability of the open-source software package. The test coverage rate refers to the proportion of code covered by test cases of the open-source software package and is one of the important indicators to measure software quality. A higher test coverage rate means that the software package performs well in functional testing, boundary condition testing, etc., reducing potential software defects. The code complexity reflects the complexity of the internal code of the software package. Appropriate code complexity helps to improve the maintainability and scalability of the software.
[0090] In order to make these features meet the training requirements of the risk prediction model, it is necessary to normalize or reduce the dimension of these high-value features. The normalization operation can unify feature values of various different magnitudes and ranges into a standard interval, avoiding the problem of unstable model learning caused by inconsistent feature scales; the dimension reduction operation can reduce the data dimension while retaining the main feature information, improving the training efficiency and generalization ability of the model.
[0091] The edge information of the connection edges is of great significance for deeply understanding the internal logic and mutual influence of the dependency relationships. In the project graph model, the following several types of edge information need to be focused on:
[0092] Dependency type: Clearly distinguish different types of dependency relationships such as compile-time dependencies and run-time dependencies. Compile-time dependencies mainly play a role in the code compilation stage, while run-time dependencies have an important impact during the software running process. By accurately identifying the dependency type, we can analyze and process the dependency relationships more targeted.
[0093] Version Constraints: Record the version requirements between dependencies, such as "^1.0.0", "~2.3.4", etc. Version constraints define the compatible version ranges between software packages and are key factors in ensuring the correctness and stability of dependency relationships. Through a detailed analysis of version constraints, the compatibility of different software package version combinations can be predicted, providing strong support for solving version conflict problems.
[0094] Dependency Citation Frequency: Represents how frequently a software package is cited by other software packages in the entire dependency network. Software packages with high citation frequencies usually play important roles in the open-source ecosystem and have high generality and importance. By analyzing the dependency citation frequency, core dependencies and key components can be identified, providing important bases for the maintenance and optimization of software systems.
[0095] The choice of the training strategy for the risk prediction model is directly related to the learning ability and generalization ability of the risk prediction model for the project graph model. In the embodiments of this application, various advanced technologies and strategies can be adopted to construct an efficient, accurate, and scalable graph neural network model. The risk prediction model uses a Directed Graph Convolutional Network (DiGCN) to specifically handle the directedness of the dependency network. DiGCN can make full use of the direction information of edges, capture the propagation paths and influence scopes of dependency relationships, enabling the model to deeply understand the dependency logic between software packages and providing a more accurate basis for subsequent analysis and prediction. At the same time, the attention mechanism of the Graph Attention Network (GAT) is introduced to adaptively highlight key neighbor information. In actual dependency relationships, the influence degrees of different neighbor nodes on the target node are different. The attention mechanism can dynamically assign different weights to each neighbor node according to the context information, enabling the model to pay more attention to the key information that has an important impact on the target node, thereby improving the model's understanding and processing ability of complex dependency relationships. In addition, the neighbor sampling strategy of GraphSAGE is integrated to further improve the efficiency of large-scale graph training. When dealing with large-scale graph data, the computational cost of traversing all neighbor nodes is too high, easily leading to too long training time and excessive resource consumption. The neighbor sampling strategy of GraphSAGE randomly selects a part from the numerous neighbors of the target node for calculation, effectively reducing the computational complexity and improving the training speed and scalability of the model while ensuring the training effect of the model.
[0096] In the open-source software supply chain, there are software packages of different languages or types, and their attributes and interaction patterns are significantly different. To accurately handle this heterogeneity, a type-aware message passing mechanism is also introduced. This mechanism can differentially handle the information transmission between different software packages according to the types and attributes of nodes, distinguishing the heterogeneous attributes and interaction patterns between nodes.
[0097] For software packages of different languages or types, there are often significant differences in aspects such as coding styles, interface specifications, and operating environments. The type-aware message passing mechanism can fully consider these differences, enabling the model to more accurately capture the interrelationships and impacts between different types of nodes when processing heterogeneous nodes, and improving the generalization ability and accuracy of the model. In the selection of the training method, a strategy combining semi-supervised and multi-task learning is adopted to make full use of the limited labeled data and rich unlabeled data, improving the generalization ability and learning efficiency of the model.
[0098] For labeled data, such as known software package vulnerability information, conflict records between dependencies, etc., supervised training is carried out. Through explicit label information and target outputs, supervised training enables the model to learn specific task rules and feature mapping relationships, thereby improving the prediction accuracy for specific tasks (such as security risk prediction, version conflict detection, etc.). At the same time, for unlabeled data, self-supervised tasks are carried out, such as edge prediction, attribute completion, etc. Self-supervised tasks can learn from the large amount of implicit information contained in the graph structure, enabling the model to automatically learn the internal structure and feature representations of the data without manual annotation. This combination method can make full use of the rich information resources in the open-source software supply chain data, providing more comprehensive and in-depth learning for the model, and thus improving the generalization ability and performance of the model in various tasks.
[0099] Optionally, in an exemplary embodiment, as Figure 4 shown, a method for obtaining software package attribute information and dependency information is provided to refine the above S101, which specifically includes the following steps:
[0100] S401, obtain the project structure information of the project to be evaluated from the open-source code hosting platform of the project to be evaluated, and obtain the metadata information of each open-source software package from the package management platform of the project to be evaluated.
[0101] Among them, the open-source code hosting platform of the project to be evaluated refers to an online platform that provides services such as code hosting, version control, collaborative development, and code management for the project to be evaluated. The package management platform of the project to be evaluated is a tool for managing software packages, which helps developers install, update, uninstall, and manage the dependent packages required for the project during the software development process. The project structure information of the project to be evaluated characterizes the components of the project to be evaluated and the relationships between them. In the embodiments of the present application, the project structure information includes, but is not limited to, key information such as the reference relationships between software packages and the file directory structure.
[0102] S402, obtain the reference relationships between each open-source software package from the project structure information.
[0103] Among them, the reference relationships between open-source software packages are the connections established between different open-source software packages, enabling one package to use functions, classes, or other components in another package, etc.
[0104] Optionally, the reference relationships between open-source software packages can be extracted from the project structure information.
[0105] S403. Obtain the package attribute information of each open-source software package and the initial dependency relationships between open-source software packages from the metadata information of each open-source software package.
[0106] Optionally, as a centralized management and distribution center for software packages, the management platform records a large amount of detailed descriptions, dependency relationships, etc. of software packages. This metadata information can help us understand the basic attributes, version information, and their mutual dependencies of software packages. Therefore, the package attribute information of each open-source software package and the initial dependency relationships between open-source software packages can be obtained from the metadata information of each open-source software package.
[0107] S404. Determine the dependency information between open-source software packages based on the reference relationships and initial dependency relationships between open-source software packages.
[0108] Optionally, the reference relationships and initial dependency relationships between open-source software packages can be merged to obtain the dependency information between open-source software packages.
[0109] In this embodiment, by obtaining different data from different sources, the accuracy and comprehensiveness of the package attribute information of each open-source software package and the dependency information between open-source software packages are ensured.
[0110] Optionally, in one embodiment, after the risk assessment result of the project to be evaluated, it is also necessary to handle the discovered risks in a timely manner to improve the stability and security of the project to be evaluated. Therefore, as Figure 5 shown, a method for adjusting the project to be evaluated is provided to cope with risks, specifically including the following steps:
[0111] S501. Determine the project risk type of the project to be evaluated according to the risk assessment result.
[0112] Among them, the project risk type includes but is not limited to security vulnerabilities, version conflicts, or redundant dependencies, etc.
[0113] Optionally, in the risk assessment result, the project risk type and the corresponding risk level obtained after risk prediction of the project to be evaluated are included. Therefore, the project risk type of the project to be evaluated can be directly obtained from the risk assessment result.
[0114] S502. Determine the risk response plan based on the project risk type and risk assessment results.
[0115] Optionally, different risk response plans need to be formulated according to different project risk types. The targeted risk response plan can be formulated by combining the risk levels in the risk assessment results.
[0116] Optionally, if the project risk type is a security vulnerability, determine the risk level based on the risk assessment results and determine the risk response plan according to the risk level. Meanwhile, the detailed annotation of the risk source further explains the specific reasons for the risk, such as insufficient maintenance of software packages leading to the accumulation of potential vulnerabilities; or a large number of historical vulnerabilities indicating certain legacy issues in terms of security; or low community support, making the software package lack timely and effective response measures in the face of newly emerging security threats. Through these detailed risk information, developers can deeply analyze the security status of the software package and formulate personalized security strategies.
[0117] Specifically, if the project risk type is a security vulnerability, conduct a risk rating on the security vulnerability based on the risk assessment results to determine the risk level. The risk level can intuitively reflect the performance of the open-source software package in terms of security, helping developers quickly identify high-risk software packages and thus take corresponding measures for handling, such as upgrading the software package, finding alternative components, etc. Further, if the risk level is low risk, implement an observation strategy, that is, continuously monitor the operation of the project to be evaluated; if the risk level is medium risk, implement a planned repair strategy; if the risk level is high risk, implement an immediate repair strategy. The specific repair strategy can be to replace or upgrade the open-source components with security vulnerabilities.
[0118] If the project risk type is a version conflict, determine the conflict path based on the risk assessment results and determine the risk response plan according to the conflict path. Specifically, if the project risk type is a version conflict, use a project graph model to simulate the impact of different version combinations on the whole. In this way, various possible version adjustment plans and their chain reactions can be comprehensively and systematically analyzed, so as to select the path with the least changes and the highest compatibility. This strategy minimizes the damage and impact on the existing software system during the adjustment process while ensuring the resolution of the version conflict problem, reduces the maintenance cost and risk of developers, and improves the stability and maintainability of the software system.
[0119] If the project risk type is redundant dependency, determine the functional redundancy information according to the risk assessment result, and determine the risk response plan according to the functional redundancy information. Specifically, if the project risk type is redundant dependency, on the premise of meeting the business requirements, select the replacement or upgrade plan with the lowest security risk or the highest repair efficiency. When performing the replacement or upgrade operation, not only pay attention to solving the current high-risk problems, but also fully consider the impact on the entire software system to ensure that no new risks and problems are introduced during the replacement or upgrade process. Through this strategy, while ensuring the security of the software system, the normal operation of the system and the integrity of the business functions can be maintained, meeting the requirements of developers and enterprises for high-quality and high-reliable software systems. That is, deeply analyze the dependency relationship according to the risk assessment result to discover the redundant dependent items of functions or versions, and propose corresponding cleaning and merging plans. Removing redundant dependencies can not only reduce the complexity and maintenance cost of the project, but also improve the performance and stability of the system, avoiding potential risks introduced by redundant code and dependencies.
[0120] S503. Adjust the project to be evaluated according to the risk response plan.
[0121] Optionally, the risk response plan can be executed to adjust the project to be evaluated to eliminate the project risks.
[0122] Specifically, through deep integration with package management tools or automation scripts, semi-automatic or even fully automatic management of dependencies can be achieved. Developers do not need to manually handle complex dependency relationships and risk issues. They only need to use relevant tools and scripts to quickly complete operations such as dependency update, replacement, and conflict resolution, significantly improving the efficiency of conflict and risk handling, and bringing great convenience to software development and maintenance work.
[0123] In this embodiment, by determining the project risk type according to the risk assessment result and formulating different risk response plans according to the project risk type, the accuracy and pertinence of the formulated risk response plan can be guaranteed, and thus the stability and security of the project to be evaluated are ensured.
[0124] Optionally, if the project risk type is version conflict, in one embodiment, as Figure 6 shown, a method for determining a risk response plan is provided to refine the above S502, which specifically includes the following steps:
[0125] S601. Determine the conflicting open-source software packages with incompatible situations according to the conflict path.
[0126] Optionally, according to the conflict path, the open-source software packages on the conflict path can be used as the conflicting open-source software packages with incompatible situations.
[0127] S602. Determine a replacement open-source software package for the conflicting open-source software package based on the dependency information between the conflicting open-source software package and other open-source software packages and the software package attribute information of the conflicting open-source software package.
[0128] Optionally, based on the dependency information between the conflicting open-source software package and other open-source software packages and the software package attribute information of the conflicting open-source software package, simulate the combination of different versions of open-source software with the same function, and determine a replacement open-source software package for the conflicting open-source software package according to the simulation result.
[0129] S603. Determine a risk response plan based on the replacement open-source software package.
[0130] In this embodiment, by providing a feasible version combination and replacement path, that is, the replacement open-source software package, and then quickly selecting a suitable solution according to the replacement open-source software package, the upgrade and replacement of the version are realized, effectively solving the version conflict problem and reducing the negative impact on the existing system.
[0131] Figure 7 FIG. is a schematic flowchart of a risk assessment method for open-source software dependencies in another embodiment. On the basis of the above embodiment, this embodiment provides an optional example of a risk assessment method for open-source software dependencies. Combining Figure 7 , the specific implementation process is as follows:
[0132] S701. Obtain the software package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package.
[0133] Optionally, obtain the project structure information of the project to be evaluated from the open-source code hosting platform of the project to be evaluated, and obtain the metadata information of each open-source software package from the package management platform of the project to be evaluated; obtain the reference relationship between each open-source software package from the project structure information; obtain the software package attribute information of each open-source software package and the initial dependency relationship between each open-source software package from the metadata information of each open-source software package; determine the dependency information between each open-source software package according to the reference relationship and the initial dependency relationship between each open-source software package.
[0134] S702. Construct a project graph model for the project to be evaluated according to the software package attribute information of each open-source software package and the dependency information between each open-source software package.
[0135] Wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the software package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge.
[0136] S703. Input the project diagram model into the feature extraction network of the risk prediction model to obtain the node features of each node and the edge features of each connection edge extracted by the feature extraction network from the project diagram model.
[0137] S704. Input the node features and edge features into the convolutional attention mechanism network of the risk prediction model to obtain the node representation vectors output after the convolutional attention mechanism network processes the node features and edge features.
[0138] Among them, the convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer.
[0139] S705. Input the node representation vectors into the risk assessment network of the risk prediction model to obtain the risk assessment result of the project to be evaluated.
[0140] S706. Determine the project risk type of the project to be evaluated according to the risk assessment result.
[0141] S707. Determine the risk response plan according to the project risk type and the risk assessment result.
[0142] Optionally, if the project risk type is a security vulnerability, determine the risk level according to the risk assessment result, and determine the risk response plan according to the risk level; if the project risk type is a version conflict, determine the conflict path according to the risk assessment result, and determine the risk response plan according to the conflict path; if the project risk type is a redundant dependency, determine the functional redundancy information according to the risk assessment result, and determine the risk response plan according to the functional redundancy information.
[0143] Optionally, if the project risk type is a version conflict, determine the conflicting open source software packages with incompatible situations according to the conflict path; determine the replacement open source software packages of the conflicting open source software packages according to the dependency information between the conflicting open source software packages and other open source software packages and the software package attribute information of the conflicting open source software packages; determine the risk response plan according to the replacement open source software packages.
[0144] S708. Adjust the project to be evaluated according to the risk response plan.
[0145] For the specific processes of the above S701 - S708, reference can be made to the description of the above method embodiments. Their implementation principles and technical effects are similar, and will not be elaborated here.
[0146] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear statement in this article, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turns with at least a part of other steps or steps or stages in other steps.
[0147] Based on the same inventive concept, an embodiment of the present application also provides a risk assessment device for open source software dependencies for implementing the risk assessment method for open source software dependencies described above. The solution provided by this device for solving problems is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the risk assessment device for open source software dependencies provided below can refer to the limitations on the risk assessment method for open source software dependencies in the above text, and will not be repeated here.
[0148] In an exemplary embodiment, as Figure 8 shown, a risk assessment device 800 for open source software dependencies is provided, including: an information acquisition module 810, a model construction module 820, and a risk assessment module 830, where:
[0149] The information acquisition module 810 is configured to acquire the software package attribute information of each open source software package in the project to be evaluated and the dependency information between each open source software package.
[0150] The model construction module 820 is configured to construct a project graph model for the project to be evaluated according to the software package attribute information of each open source software package and the dependency information between each open source software package. Among them, the nodes in the project graph model represent open source software packages, the connection edges between different nodes represent the dependency relationships between different open source software packages, and the node information of each node includes the software package attribute information of the open source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open source software packages corresponding to the nodes connected by the connection edge.
[0151] The risk assessment module 830 is configured to determine the risk assessment result of the project to be evaluated based on the risk prediction model and according to the project graph model.
[0152] The above-mentioned risk assessment device for open-source software dependencies constructs a project graph model for the project to be evaluated based on the software package attribute information of each open-source software package and the dependency information between each open-source software package obtained; since the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the software package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge. Therefore, through the project graph model, the complete information of the direct dependencies, transitive dependencies, and cross-ecosystem dependencies of each open-source software package in the project to be evaluated can be fully reflected. Therefore, based on the risk prediction model and according to the project graph model, the risk assessment result of the project to be evaluated can be accurately determined.
[0153] In one embodiment, the risk prediction model includes a feature extraction network, a convolutional attention mechanism network, and a risk assessment network; the risk assessment module 830 is specifically configured to:
[0154] Input the project graph model into the feature extraction network to obtain the node features of each node and the edge features of each connection edge extracted by the feature extraction network from the project graph model; input the node features and edge features into the convolutional attention mechanism network to obtain the node representation vectors output by the convolutional attention mechanism network after processing the node features and edge features; input the node representation vectors into the risk assessment network to obtain the risk assessment result of the project to be evaluated.
[0155] In one embodiment, the convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer.
[0156] In one embodiment, the information acquisition module 810 is specifically configured to:
[0157] Obtain the project structure information of the project to be evaluated from the open-source code hosting platform of the project to be evaluated, and obtain the metadata information of each open-source software package from the package management platform of the project to be evaluated; obtain the reference relationships between each open-source software package from the project structure information; obtain the software package attribute information of each open-source software package and the initial dependency relationships between each open-source software package from the metadata information of each open-source software package; determine the dependency information between each open-source software package according to the reference relationships and initial dependency relationships between each open-source software package.
[0158] In one embodiment, the risk assessment device 800 for open-source software dependencies further includes:
[0159] A risk determination unit, configured to determine the project risk type of the project to be evaluated according to the risk assessment result.
[0160] A solution determination unit, configured to determine a risk response solution according to the project risk type and the risk assessment result.
[0161] A project adjustment unit, configured to adjust the project to be evaluated according to the risk response solution.
[0162] In one embodiment, the solution determination unit includes:
[0163] A first determination subunit, configured to, if the project risk type is a security vulnerability, determine the risk level according to the risk assessment result, and determine the risk response solution according to the risk level.
[0164] A second determination subunit, configured to, if the project risk type is a version conflict, determine the conflict path according to the risk assessment result, and determine the risk response solution according to the conflict path.
[0165] A third determination subunit, configured to, if the project risk type is a redundant dependency, determine the function redundancy information according to the risk assessment result, and determine the risk response solution according to the function redundancy information.
[0166] In one embodiment, the second determination subunit is specifically configured to:
[0167] According to the conflict path, determine the conflicting open-source software packages with incompatible situations; according to the dependency information between the conflicting open-source software packages and other open-source software packages and the software package attribute information of the conflicting open-source software packages, determine the replacement open-source software packages of the conflicting open-source software packages; and determine the risk response solution according to the replacement open-source software packages.
[0168] Each module in the above risk assessment device for open-source software dependency relationships can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
[0169] In an exemplary embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 9As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it realizes a risk assessment method for open-source software dependencies.
[0170] Those skilled in the art can understand that Figure 9 The structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0171] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:
[0172] Obtain the software package attribute information of each open-source software package and the dependency information between each open-source software package in the project to be evaluated;
[0173] According to the software package attribute information of each open-source software package and the dependency information between each open-source software package, construct a project graph model for the project to be evaluated; wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the software package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge;
[0174] Based on the risk prediction model, determine the risk assessment result of the project to be evaluated according to the project graph model.
[0175] In one embodiment, the risk prediction model includes a feature extraction network, a convolutional attention mechanism network, and a risk assessment network; when the processor executes the computer program to determine the risk assessment result of the project to be evaluated based on the risk prediction model according to the project graph model, the following steps are also implemented:
[0176] Input the project graph model into the feature extraction network to obtain the node features of each node and the edge features of each connection edge extracted by the feature extraction network from the project graph model; input the node features and edge features into the convolutional attention mechanism network to obtain the node representation vectors output after the convolutional attention mechanism network processes the node features and edge features; input the node representation vectors into the risk assessment network to obtain the risk assessment result of the project to be evaluated.
[0177] In one embodiment, the convolutional attention mechanism network includes at least two processing blocks connected in cascade; each processing block includes a directed graph convolutional layer and a graph attention layer.
[0178] In one embodiment, when the processor executes the computer program to obtain the software package attribute information of each open source software package and the dependency information between each open source software package in the project to be evaluated, the following steps are also implemented:
[0179] Obtain the project structure information of the project to be evaluated from the open source code hosting platform of the project to be evaluated, and obtain the metadata information of each open source software package from the package management platform of the project to be evaluated; obtain the reference relationship between each open source software package from the project structure information; obtain the software package attribute information of each open source software package and the initial dependency relationship between each open source software package from the metadata information of each open source software package; determine the dependency information between each open source software package according to the reference relationship and the initial dependency relationship between each open source software package.
[0180] In one embodiment, after the processor executes the computer program to determine the risk assessment result of the project to be evaluated based on the risk prediction model according to the project graph model, the following steps are also implemented:
[0181] Determine the project risk type of the project to be evaluated according to the risk assessment result; determine the risk response plan according to the project risk type and the risk assessment result; adjust the project to be evaluated according to the risk response plan.
[0182] In one embodiment, the project risk type includes security vulnerabilities, version conflicts or redundant dependencies; when the processor executes the computer program to determine the risk response plan according to the project risk type and the risk assessment result, the following steps are also implemented:
[0183] If the project risk type is security vulnerabilities, determine the risk level according to the risk assessment result, and determine the risk response plan according to the risk level; if the project risk type is version conflicts, determine the conflict path according to the risk assessment result, and determine the risk response plan according to the conflict path; if the project risk type is redundant dependencies, determine the functional redundancy information according to the risk assessment result, and determine the risk response plan according to the functional redundancy information.
[0184] In one embodiment, when the processor executes the computer program conflict path determination risk response solution, the following steps are also implemented:
[0185] According to the conflict path, determine the conflicting open-source software packages with incompatibility; according to the dependency information between the conflicting open-source software packages and other open-source software packages and the software package attribute information of the conflicting open-source software packages, determine the replacement open-source software packages for the conflicting open-source software packages; according to the replacement open-source software packages, determine the risk response solution.
[0186] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0187] Obtain the software package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package;
[0188] According to the software package attribute information of each open-source software package and the dependency information between each open-source software package, construct a project graph model for the project to be evaluated; wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the software package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge;
[0189] Based on the risk prediction model, according to the project graph model, determine the risk assessment result of the project to be evaluated.
[0190] In one embodiment, the risk prediction model includes a feature extraction network, a convolutional attention mechanism network, and a risk assessment network; when the processor executes the computer program to determine the risk assessment result of the project to be evaluated based on the risk prediction model and according to the project graph model, the following steps are also implemented:
[0191] Input the project graph model into the feature extraction network to obtain the node features of each node and the edge features of each connection edge extracted by the feature extraction network from the project graph model; input the node features and the edge features into the convolutional attention mechanism network to obtain the node representation vectors output by the convolutional attention mechanism network after processing the node features and the edge features; input the node representation vectors into the risk assessment network to obtain the risk assessment result of the project to be evaluated.
[0192] In one embodiment, the convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer.
[0193] In one embodiment, when the processor executes a computer program to obtain the package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package, the following steps are further implemented:
[0194] Obtain the project structure information of the project to be evaluated from the open-source code hosting platform of the project to be evaluated, and obtain the metadata information of each open-source software package from the package management platform of the project to be evaluated; obtain the reference relationship between each open-source software package from the project structure information; obtain the package attribute information of each open-source software package and the initial dependency relationship between each open-source software package from the metadata information of each open-source software package; determine the dependency information between each open-source software package according to the reference relationship and the initial dependency relationship between each open-source software package.
[0195] In one embodiment, after the processor executes a computer program to determine the risk assessment result of the project to be evaluated based on the risk prediction model according to the project graph model, the following steps are further implemented:
[0196] Determine the project risk type of the project to be evaluated according to the risk assessment result; determine the risk response plan according to the project risk type and the risk assessment result; adjust the project to be evaluated according to the risk response plan.
[0197] In one embodiment, the project risk type includes security vulnerabilities, version conflicts or redundant dependencies; when the processor executes a computer program to determine the risk response plan according to the project risk type and the risk assessment result, the following steps are further implemented:
[0198] If the project risk type is security vulnerabilities, determine the risk level according to the risk assessment result, and determine the risk response plan according to the risk level; if the project risk type is version conflicts, determine the conflict path according to the risk assessment result, and determine the risk response plan according to the conflict path; if the project risk type is redundant dependencies, determine the functional redundancy information according to the risk assessment result, and determine the risk response plan according to the functional redundancy information.
[0199] In one embodiment, when the processor executes a computer program to determine the risk response plan according to the conflict path, the following steps are further implemented:
[0200] Determine the conflicting open-source software packages with incompatible situations according to the conflict path; determine the replacement open-source software packages of the conflicting open-source software packages according to the dependency information between the conflicting open-source software packages and other open-source software packages and the package attribute information of the conflicting open-source software packages; determine the risk response plan according to the replacement open-source software packages.
[0201] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0202] Obtain the package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package.
[0203] Construct a project graph model for the project to be evaluated based on the package attribute information of each open-source software package and the dependency information between each open-source software package; wherein, the nodes in the project graph model represent open-source software packages, the connecting edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the package attribute information of the open-source software package corresponding to the node, and the edge information of each connecting edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connecting edge.
[0204] Based on the risk prediction model, determine the risk assessment result of the project to be evaluated according to the project graph model.
[0205] In one embodiment, the risk prediction model includes a feature extraction network, a convolutional attention mechanism network, and a risk assessment network; when the processor executes the computer program to determine the risk assessment result of the project to be evaluated based on the risk prediction model and according to the project graph model, the following steps are further implemented:
[0206] Input the project graph model into the feature extraction network to obtain the node features of each node and the edge features of each connecting edge extracted by the feature extraction network from the project graph model; input the node features and the edge features into the convolutional attention mechanism network to obtain the node representation vectors output after the convolutional attention mechanism network processes the node features and the edge features; input the node representation vectors into the risk assessment network to obtain the risk assessment result of the project to be evaluated.
[0207] In one embodiment, the convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer.
[0208] In one embodiment, when the processor executes the computer program to obtain the package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package, the following steps are further implemented:
[0209] Obtain the project structure information of the project to be evaluated from the open-source code hosting platform of the project to be evaluated, and obtain the metadata information of each open-source software package from the package management platform of the project to be evaluated; obtain the reference relationships between each open-source software package from the project structure information; obtain the package attribute information of each open-source software package and the initial dependency relationships between each open-source software package from the metadata information of each open-source software package; determine the dependency information between each open-source software package according to the reference relationships and the initial dependency relationships between each open-source software package.
[0210] In one embodiment, after the processor executes a computer program to determine the risk assessment result of a project to be evaluated based on a risk prediction model and according to a project graph model, the following steps are further implemented:
[0211] According to the risk assessment result, determine the project risk type of the project to be evaluated; according to the project risk type and the risk assessment result, determine a risk response plan; according to the risk response plan, adjust the project to be evaluated.
[0212] In one embodiment, the project risk type includes security vulnerabilities, version conflicts, or redundant dependencies; when the processor executes a computer program to determine a risk response plan according to the project risk type and the risk assessment result, the following steps are further implemented:
[0213] If the project risk type is a security vulnerability, determine the risk level according to the risk assessment result, and determine a risk response plan according to the risk level; if the project risk type is a version conflict, determine the conflict path according to the risk assessment result, and determine a risk response plan according to the conflict path; if the project risk type is a redundant dependency, determine the functional redundancy information according to the risk assessment result, and determine a risk response plan according to the functional redundancy information.
[0214] In one embodiment, when the processor executes a computer program to determine a risk response plan based on the conflict path, the following steps are further implemented:
[0215] According to the conflict path, determine the conflicting open-source software packages with incompatible situations; according to the dependency information between the conflicting open-source software packages and other open-source software packages and the software package attribute information of the conflicting open-source software packages, determine the replacement open-source software packages of the conflicting open-source software packages; according to the replacement open-source software packages, determine a risk response plan.
[0216] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data that have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0217] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., and are not limited thereto.
[0218] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0219] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A risk assessment method for open-source software dependencies, characterized in that, The method includes: Obtaining the package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package; Constructing a project graph model for the project to be evaluated according to the package attribute information of each open-source software package and the dependency information between each open-source software package; wherein, the nodes in the project graph model represent open-source software packages, the connection edges between different nodes represent the dependency relationships between different open-source software packages, and the node information of each node includes the package attribute information of the open-source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open-source software packages corresponding to the nodes connected by the connection edge; Based on the risk prediction model, determining the risk assessment result of the open-source software dependency relationship in the project to be evaluated according to the project graph model.
2. The method according to claim 1, wherein The risk prediction model includes a feature extraction network, a convolutional attention mechanism network, and a risk assessment network; The determining the risk assessment result of the project to be evaluated according to the project graph model based on the risk prediction model includes: Inputting the project graph model into the feature extraction network to obtain the node features of each node and the edge features of each connection edge extracted by the feature extraction network from the project graph model; Inputting the node features and the edge features into the convolutional attention mechanism network to obtain the node representation vectors output by the convolutional attention mechanism network after processing the node features and the edge features; Inputting the node representation vectors into the risk assessment network to obtain the risk assessment result of the project to be evaluated.
3. The method according to claim 2, wherein The convolutional attention mechanism network includes at least two cascaded processing blocks; each processing block includes a directed graph convolutional layer and a graph attention layer.
4. The method according to claim 1, wherein The obtaining the package attribute information of each open-source software package in the project to be evaluated and the dependency information between each open-source software package includes: Obtaining the project structure information of the project to be evaluated from the open-source code hosting platform of the project to be evaluated, and obtaining the metadata information of each open-source software package from the package management platform of the project to be evaluated; Obtaining the reference relationships between each open-source software package from the project structure information; Obtaining the package attribute information of each open-source software package and the initial dependency relationships between each open-source software package from the metadata information of each open-source software package; Determining the dependency information between each open-source software package according to the reference relationships and the initial dependency relationships between each open-source software package.
5. The method according to any one of claims 1-4, characterized in that, After determining the risk assessment result of the project to be evaluated according to the project graph model based on the risk prediction model, the method further includes: Determining the project risk type of the project to be evaluated according to the risk assessment result; Determining a risk response plan according to the project risk type and the risk assessment result; Adjusting the project to be evaluated according to the risk response plan.
6. The method according to claim 5, wherein The project risk type includes security vulnerabilities, version conflicts, or redundant dependencies; The determining a risk response plan according to the project risk type and the risk assessment result includes: If the project risk type is a security vulnerability, determine the risk level according to the risk assessment result, and determine the risk response plan according to the risk level; If the project risk type is a version conflict, determine the conflict path according to the risk assessment result, and determine the risk response plan according to the conflict path; If the project risk type is a redundant dependency, determine the functional redundancy information according to the risk assessment result, and determine the risk response plan according to the functional redundancy information.
7. The method according to claim 6, characterized in that, Determining the risk response plan according to the conflict path includes: Determine the conflicting open source software packages with incompatible situations according to the conflict path; Determine the replacement open source software packages of the conflicting open source software packages according to the dependency information between the conflicting open source software packages and other open source software packages and the package attribute information of the conflicting open source software packages; Determine the risk response plan according to the replacement open source software packages.
8. A risk assessment device for open-source software dependencies, characterized in that The device includes: An information acquisition module, configured to acquire the package attribute information of each open source software package and the dependency information between each open source software package in the project to be evaluated; A model construction module, configured to construct a project graph model for the project to be evaluated according to the package attribute information of each open source software package and the dependency information between each open source software package; wherein, the nodes in the project graph model represent open source software packages, the connection edges between different nodes represent the dependency relationships between different open source software packages, and the node information of each node includes the package attribute information of the open source software package corresponding to the node, and the edge information of each connection edge includes the dependency information between the open source software packages corresponding to the nodes connected by the connection edge; A risk assessment module, configured to determine the risk assessment result of the project to be evaluated according to the project graph model based on a risk prediction model.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Automatic construction and risk analysis method and device for knowledge graph of remote sensing open source software
CN121390252A
Automatic Construction and Risk Analysis Method and Device for Knowledge Graph of Remote Sensing Open Source Software
CN121390252B
