mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
* improved parsing of vendor from github url Signed-off-by: Weston Steimel <weston.steimel@anchore.com> * stop generating wildcard vendors Add logic for parsing javascript and ruby package vendor candidates from url and author fields and stop generating wildcard vendor candidates Signed-off-by: Weston Steimel <weston.steimel@anchore.com> --------- Signed-off-by: Weston Steimel <weston.steimel@anchore.com>
33 lines
694 B
Go
33 lines
694 B
Go
package cpe
|
|
|
|
import "github.com/anchore/syft/syft/pkg"
|
|
|
|
func candidateVendorsForJavascript(p pkg.Package) fieldCandidateSet {
|
|
if p.MetadataType != pkg.NpmPackageJSONMetadataType {
|
|
return nil
|
|
}
|
|
|
|
vendors := newFieldCandidateSet()
|
|
metadata, ok := p.Metadata.(pkg.NpmPackageJSONMetadata)
|
|
if !ok {
|
|
return nil
|
|
}
|
|
|
|
if metadata.Author != "" {
|
|
vendors.add(fieldCandidate{
|
|
value: normalizePersonName(stripEmailSuffix(metadata.Author)),
|
|
disallowSubSelections: true,
|
|
})
|
|
}
|
|
|
|
if metadata.URL != "" {
|
|
vendors.union(candidateVendorsFromURL(metadata.URL))
|
|
}
|
|
|
|
if metadata.Homepage != "" {
|
|
vendors.union(candidateVendorsFromURL(metadata.Homepage))
|
|
}
|
|
|
|
return vendors
|
|
}
|