better .NET cpe generation (#3764)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2025-03-28 10:58:59 -04:00
committed by GitHub
parent ad9928cb2a
commit 40dd5d0bbd
6 changed files with 272 additions and 247 deletions
+15 -10
View File
@@ -3,18 +3,23 @@ package cpegenerate
import "github.com/anchore/syft/syft/pkg"
func candidateVendorsForRPM(p pkg.Package) fieldCandidateSet {
metadata, ok := p.Metadata.(pkg.RpmDBEntry)
if !ok {
return nil
}
vendors := newFieldCandidateSet()
if metadata.Vendor != "" {
vendors.add(fieldCandidate{
value: normalizeName(metadata.Vendor),
disallowSubSelections: true,
})
switch m := p.Metadata.(type) {
case pkg.RpmDBEntry:
if m.Vendor != "" {
vendors.add(fieldCandidate{
value: normalizeName(m.Vendor),
disallowSubSelections: true,
})
}
case pkg.RpmArchive:
if m.Vendor != "" {
vendors.add(fieldCandidate{
value: normalizeName(m.Vendor),
disallowSubSelections: true,
})
}
}
return vendors