diff --git a/syft/pkg/cataloger/internal/cpegenerate/generate.go b/syft/pkg/cataloger/internal/cpegenerate/generate.go index 8f500ba6e..ae03cabe7 100644 --- a/syft/pkg/cataloger/internal/cpegenerate/generate.go +++ b/syft/pkg/cataloger/internal/cpegenerate/generate.go @@ -141,9 +141,16 @@ func FromDictionaryFind(p pkg.Package) ([]cpe.CPE, bool) { // generate the minimal set of representative CPEs, which implies that optional fields should not be included // (such as target SW). func FromPackageAttributes(p pkg.Package) []cpe.CPE { - // ML models should not have CPEs as they are not traditional software packages - // and don't fit the vulnerability model used for software packages. - if p.Type == pkg.ModelPkg { + switch p.Type { + case pkg.KbPkg: + // Microsoft KB packages are patches, not products: the name is an MSRC product ID and the + // version a KB number, neither of which maps onto a CPE vendor, product or version. They are + // matched against MSRC data by name and version, so a generated CPE is only noise, and one + // that NVD-based matching could misread. + return nil + case pkg.ModelPkg: + // ML models should not have CPEs as they are not traditional software packages + // and don't fit the vulnerability model used for software packages. return nil } diff --git a/syft/pkg/cataloger/internal/cpegenerate/generate_test.go b/syft/pkg/cataloger/internal/cpegenerate/generate_test.go index ae03d205b..4b849a709 100644 --- a/syft/pkg/cataloger/internal/cpegenerate/generate_test.go +++ b/syft/pkg/cataloger/internal/cpegenerate/generate_test.go @@ -892,6 +892,16 @@ func TestGeneratePackageCPEs(t *testing.T) { }, expected: []string{}, }, + { + name: "Microsoft KB package should generate no CPEs", + p: pkg.Package{ + Name: "12437", + Version: "935509", + Type: pkg.KbPkg, + Metadata: pkg.MicrosoftKbPatch{ProductID: "12437", Kb: "935509"}, + }, + expected: []string{}, + }, { name: "rust package", p: pkg.Package{