binary

package
v0.100.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Overview

Package binary provides a concrete Cataloger implementations for surfacing possible packages based on signatures found within binary files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCataloger

func NewCataloger(cfg CatalogerConfig) pkg.Cataloger

Types

type Cataloger

type Cataloger struct {
	// contains filtered or unexported fields
}

Cataloger is the cataloger responsible for surfacing evidence of a very limited set of binary files, which have been identified by the classifiers. The Cataloger is _NOT_ a place to catalog any and every binary, but rather the specific set that has been curated to be important, predominantly related to toolchain- related runtimes like Python, Go, Java, or Node. Some exceptions can be made for widely-used binaries such as busybox.

func (Cataloger) Catalog

func (c Cataloger) Catalog(resolver file.Resolver) ([]pkg.Package, []artifact.Relationship, error)

Catalog is given an object to resolve file references and content, this function returns any discovered Packages after analyzing the catalog source.

func (Cataloger) Name

func (c Cataloger) Name() string

Name returns a string that uniquely describes the Cataloger

type CatalogerConfig added in v0.100.0

type CatalogerConfig struct {
	Classifiers []Classifier
}

func DefaultCatalogerConfig added in v0.100.0

func DefaultCatalogerConfig() CatalogerConfig

type Classifier added in v0.100.0

type Classifier struct {
	Class string

	// FileGlob is a selector to narrow down file inspection using the **/glob* syntax
	FileGlob string

	// 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

	// Package is the name to use for the package
	Package string

	// PURL is the Package URL to use when generating a package
	PURL packageurl.PackageURL

	// CPEs are the specific CPEs we want to include for this binary with updated version information
	CPEs []cpe.CPE
}

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 DefaultClassifiers added in v0.100.0

func DefaultClassifiers() []Classifier

type EvidenceMatcher added in v0.100.0

type EvidenceMatcher func(resolver file.Resolver, classifier Classifier, location file.Location) ([]pkg.Package, error)

EvidenceMatcher is a function called to catalog Packages that match some sort of evidence

func FileContentsVersionMatcher added in v0.100.0

func FileContentsVersionMatcher(pattern string) EvidenceMatcher

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL