rm(list = ls()) seed <- 1 set.seed(seed)
require(kaiaulu) require(visNetwork) require(reactable) require(data.table) require(igraph) require(yaml)
Load config file.
tool <- parse_config("../tools.yml") conf <- parse_config("../conf/chromium.yml") perceval_path <- get_tool_project("perceval", tool) git_repo_path <- get_git_repo_path(conf) nvdfeed_folder_path <- get_nvdfeed_folder_path(conf) cveid_regex <- get_cveid_regex(conf) # Filters file_extensions <- get_file_extensions(conf) substring_filepath <- get_substring_filepath(conf)
project_git <- parse_gitlog(perceval_path,git_repo_path,perl_regex = cveid_regex) #project_git <- parse_gitlog(perceval_path,git_repo_path,save_path) #project_git <- readRDS(save_path)
project_git <- project_git %>% filter_by_file_extension(file_extensions,"file_pathname") %>% filter_by_filepath_substring(substring_filepath,"file_pathname")
project_git_slice <- project_git
First, we can check the coverage of commits which contain cve-id labels
coverage <- commit_message_id_coverage(project_git,cveid_regex)/length(unique(project_git$data.commit)) coverage
project_commit_message_id_edgelist <- transform_commit_message_id_to_network(project_git,commit_message_id_regex = cveid_regex) project_commit_message_id_network <- igraph::graph_from_data_frame(d=project_commit_message_id_edgelist[["edgelist"]], directed = TRUE, vertices = project_commit_message_id_edgelist[["nodes"]]) visIgraph(project_commit_message_id_network,randomSeed = 1)
If the chosen commit message label is associated to CVEs, one additional metadata of interest to CVEs are their weaknesses. Weaknesses groups related CVE ids. We can obtain the mapping from CVE to CWEs from NVD Feeds
# This can take a few minutes! cve_cwe_mapping <- parse_nvdfeed(nvdfeed_folder_path)
cve_cwe_file_network <- transform_cve_cwe_file_to_network(project_commit_message_id_edgelist,cve_cwe_mapping)
project_commit_message_id_network <- igraph::graph_from_data_frame(d=cve_cwe_file_network[["edgelist"]], directed = TRUE, vertices = cve_cwe_file_network[["nodes"]]) visIgraph(project_commit_message_id_network,randomSeed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.