mirror of
https://github.com/anchore/syft.git
synced 2025-11-22 02:43:19 +01:00
* fix: improved CPE-generation logic for alpine packages Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * fix: improved alpine upstream name generation Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * fix: improve CPE vendor for alpine Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * fix: python vendor CPE gen Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * fix: alpine cpe gen logic Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * fix: apk CPE update for nodejs-current Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * fix: CPE update for python pip Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * fix: CPE update for some ruby packages Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * fix linting Signed-off-by: Weston Steimel <weston.steimel@anchore.com> --------- Signed-off-by: Weston Steimel <weston.steimel@anchore.com>
61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
package cpe
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/anchore/syft/syft/pkg"
|
|
)
|
|
|
|
func additionalVendorsForPython(v string) (vendors []string) {
|
|
if !strings.HasSuffix(v, "project") {
|
|
vendors = append(vendors, fmt.Sprintf("%sproject", v), fmt.Sprintf("%s_project", v))
|
|
}
|
|
|
|
return vendors
|
|
}
|
|
|
|
func candidateVendorsForPython(p pkg.Package) fieldCandidateSet {
|
|
metadata, ok := p.Metadata.(pkg.PythonPackageMetadata)
|
|
if !ok {
|
|
return nil
|
|
}
|
|
|
|
vendors := newFieldCandidateSet()
|
|
|
|
if metadata.Author != "" {
|
|
name := normalizePersonName(metadata.Author)
|
|
vendors.add(fieldCandidate{
|
|
value: name,
|
|
disallowSubSelections: true,
|
|
disallowDelimiterVariations: true,
|
|
})
|
|
|
|
for _, v := range additionalVendorsForPython(name) {
|
|
vendors.add(fieldCandidate{
|
|
value: v,
|
|
disallowSubSelections: true,
|
|
disallowDelimiterVariations: true,
|
|
})
|
|
}
|
|
}
|
|
|
|
if metadata.AuthorEmail != "" {
|
|
name := normalizePersonName(stripEmailSuffix(metadata.AuthorEmail))
|
|
vendors.add(fieldCandidate{
|
|
value: name,
|
|
disallowSubSelections: true,
|
|
})
|
|
|
|
for _, v := range additionalVendorsForPython(name) {
|
|
vendors.add(fieldCandidate{
|
|
value: v,
|
|
disallowSubSelections: true,
|
|
disallowDelimiterVariations: true,
|
|
})
|
|
}
|
|
}
|
|
|
|
return vendors
|
|
}
|