Skip to content

Commit c632cbb

Browse files
authored
feat(vulnfeeds): create a CVE-CNA allowlist (#4340)
Move the default allowlist for the CNAs whose CVE's we're ingesting to a .txt file. This PR will also enable the ingestion of CVEs from the following CNAs: - GitLab - Centreon - @ huntrdev
1 parent da553d2 commit c632cbb

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Linux
2+
GitHub_M
3+
GitLab
4+
Centreon
5+
@huntrdev

vulnfeeds/cmd/cve-bulk-converter/main.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package main
33

44
import (
5+
_ "embed"
56
"encoding/json"
67
"flag"
78
"log/slog"
@@ -19,11 +20,14 @@ import (
1920
var (
2021
repoDir = flag.String("cve_repo", "cvelistV5", "CVEListV5 directory path")
2122
localOutputDir = flag.String("out_dir", "cvelist2osv", "Path to output results.")
22-
years = flag.String("years", "2022,2023,2024,2025", "A comma-separated list of years to process.")
23+
years = flag.String("years", "2021,2022,2023,2024,2025", "A comma-separated list of years to process.")
2324
workers = flag.Int("workers", 30, "The number of concurrent workers to use for processing CVEs.")
24-
cnas = flag.String("cnas", "Linux,GitHub_M", "A comma-separated list of CNAs to process.")
25+
cnas = flag.String("cnas", "", "A comma-separated list of CNAs to process. If not provided, defaults to cna_allowlist.txt.")
2526
)
2627

28+
//go:embed cna_allowlist.txt
29+
var cnaAllowlistData []byte
30+
2731
func main() {
2832
flag.Parse()
2933
logger.InitGlobalLogger()
@@ -35,8 +39,18 @@ func main() {
3539

3640
jobs := make(chan string)
3741
var wg sync.WaitGroup
42+
var cnaList []string
43+
if *cnas != "" {
44+
cnaList = strings.Split(*cnas, ",")
45+
} else {
46+
for _, cna := range strings.Split(string(cnaAllowlistData), "\n") {
47+
cna = strings.TrimSpace(cna)
48+
if cna != "" {
49+
cnaList = append(cnaList, cna)
50+
}
51+
}
52+
}
3853

39-
cnaList := strings.Split(*cnas, ",")
4054
// Start the worker pool.
4155
for range *workers {
4256
wg.Add(1)

0 commit comments

Comments
 (0)