-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: disable cpe vendor wildcards to reduce false positives (#1647)
* 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>
- Loading branch information
1 parent
01230aa
commit c4cbe21
Showing
6 changed files
with
68 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters