Add cpe translation for macos vbox (#22082)

This commit is contained in:
Tim Lee 2024-09-13 10:57:50 -06:00 committed by GitHub
parent ab996dc57d
commit 1deccdb68d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 1 deletions

View file

@ -1654,6 +1654,15 @@ func TestCPEFromSoftwareIntegration(t *testing.T) {
},
cpe: "cpe:2.3:o:linux:linux_kernel:5.4.0-105.118:*:*:*:*:*:*:*",
},
{
software: fleet.Software{
Name: "VirtualBox.app",
Source: "apps",
Version: "7.0.12",
BundleIdentifier: "org.virtualbox.app.VirtualBox",
},
cpe: "cpe:2.3:a:oracle:virtualbox:7.0.12:*:*:*:*:macos:*:*",
},
}
// NVD_TEST_CPEDB_PATH can be used to speed up development (sync cpe.sqlite only once).

View file

@ -417,5 +417,14 @@
"product": ["git"],
"vendor": ["git"]
}
},
{
"software": {
"bundle_identifier": ["org.virtualbox.app.VirtualBox"]
},
"filter": {
"product": ["virtualbox"],
"vendor": ["oracle"]
}
}
]
]

View file

@ -69,6 +69,12 @@ func main() {
}
}
// All macOS apps are expected to have a bundle identifier, which influences CPE generation.
if softwareSource != nil && *softwareSource == "apps" && softwareBundleIdentifier != nil && *softwareBundleIdentifier == "" {
printf("Must set --software_bundle_identifier for macOS apps when specifying -software_source apps\n")
return
}
if err := os.MkdirAll(*dbDir, os.ModePerm); err != nil {
panic(err)
}