Documentation
¶
Index ¶
- func NewClassifierPackage(classifier Classifier, location file.Location, matchMetadata map[string]string, ...) *pkg.Package
- type Classifier
- type ContextualEvidenceMatchers
- type EvidenceMatcher
- func BranchingEvidenceMatcher(classifiers ...Classifier) EvidenceMatcher
- func FileContentsVersionMatcher(catalogerName string, patterns ...string) EvidenceMatcher
- func FileNameTemplateVersionMatcher(fileNamePattern, contentTemplate, catalogerName string) EvidenceMatcher
- func MatchAll(matchers ...EvidenceMatcher) EvidenceMatcher
- func MatchAny(matchers ...EvidenceMatcher) EvidenceMatcher
- func MatchNone(matcher EvidenceMatcher) EvidenceMatcher
- func MatchPath(path string) EvidenceMatcher
- func SharedLibraryLookup(sharedLibraryPattern string, sharedLibraryMatcher EvidenceMatcher) EvidenceMatcher
- func SupportingEvidenceMatcher(relativePathGlob string, evidenceMatcher EvidenceMatcher) EvidenceMatcher
- type MatcherContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClassifierPackage ¶
Types ¶
type Classifier ¶
type Classifier struct {
Class string `json:"class"`
// FileGlob is a selector to narrow down file inspection using the **/glob* syntax
FileGlob string `json:"fileGlob"`
// EvidenceMatcher is what will be used to match against the file in the source
// location. If the matcher returns a package, the file will be considered a candidate.
EvidenceMatcher EvidenceMatcher `json:"-"`
// Package is the name to use for the package
Package string `json:"package"`
// PURL is the Package URL to use when generating a package
PURL packageurl.PackageURL `json:"purl"`
// CPEs are the specific CPEs we want to include for this binary with updated version information
CPEs []cpe.CPE `json:"cpes"`
}
Classifier is a generic package classifier that can be used to match a package definition to a file that meets the given content criteria of the EvidenceMatcher.
func (Classifier) MarshalJSON ¶
func (cfg Classifier) MarshalJSON() ([]byte, error)
type ContextualEvidenceMatchers ¶
type ContextualEvidenceMatchers struct {
CatalogerName string
}
func (ContextualEvidenceMatchers) FileContentsVersionMatcher ¶
func (c ContextualEvidenceMatchers) FileContentsVersionMatcher(patterns ...string) EvidenceMatcher
func (ContextualEvidenceMatchers) FileNameTemplateVersionMatcher ¶
func (c ContextualEvidenceMatchers) FileNameTemplateVersionMatcher(fileNamePattern string, contentTemplate string) EvidenceMatcher
type EvidenceMatcher ¶
type EvidenceMatcher func(classifier Classifier, context MatcherContext) ([]pkg.Package, error)
EvidenceMatcher is a function called to identify based on some sort of evidence in the filesystem contents. A non-nil return value indicates a successful match, regardless of packages being returned.
func BranchingEvidenceMatcher ¶ added in v1.29.1
func BranchingEvidenceMatcher(classifiers ...Classifier) EvidenceMatcher
BranchingEvidenceMatcher loads the contents of the reader into memory, assuming that all classifier matchers are going to be reading the same file, e.g. a "java" binary, continuing to try classifier EvidenceMatcher until the first set of packages is found
func FileContentsVersionMatcher ¶
func FileContentsVersionMatcher(catalogerName string, patterns ...string) EvidenceMatcher
FileContentsVersionMatcher will match all provided patterns, extracting named capture groups from each pattern, overwriting earlier results
func FileNameTemplateVersionMatcher ¶
func FileNameTemplateVersionMatcher(fileNamePattern, contentTemplate, catalogerName string) EvidenceMatcher
func MatchAll ¶ added in v1.29.1
func MatchAll(matchers ...EvidenceMatcher) EvidenceMatcher
MatchAll executes all matchers until one returns nil results, only returning the final results
func MatchAny ¶ added in v1.29.1
func MatchAny(matchers ...EvidenceMatcher) EvidenceMatcher
MatchAny returns a combined evidence matcher that returns results from the first matcher that returns results
func MatchNone ¶ added in v1.45.0
func MatchNone(matcher EvidenceMatcher) EvidenceMatcher
MatchNone succeeds only if the matcher returns no results.
func MatchPath ¶ added in v1.29.1
func MatchPath(path string) EvidenceMatcher
func SharedLibraryLookup ¶
func SharedLibraryLookup(sharedLibraryPattern string, sharedLibraryMatcher EvidenceMatcher) EvidenceMatcher
func SupportingEvidenceMatcher ¶ added in v1.41.0
func SupportingEvidenceMatcher(relativePathGlob string, evidenceMatcher EvidenceMatcher) EvidenceMatcher
SupportingEvidenceMatcher defines an evidence matcher that searches for secondary evidence with path globs relative to a primary file, for example: a VERSION file in the same or a parent directory to another binary
type MatcherContext ¶
type MatcherContext struct {
Resolver file.Resolver
Location file.Location
GetReader func(resolver MatcherContext) (unionreader.UnionReader, error)
}