analyzer

package
v1.8.9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ET_FilterExpressionMatched = AnalyzerEventType("ev_pkg_filter_match")
	ET_AnalyzerFailOnError     = AnalyzerEventType("ev_fail_on_error")

	// Following event types must set the Threat field
	ET_LockfilePoisoningSignal = AnalyzerEventType("ev_lockfile_poisoning")
)

Variables

This section is empty.

Functions

Types

type Analyzer

type Analyzer interface {
	Name() string

	Analyze(manifest *models.PackageManifest,
		handler AnalyzerEventHandler) error

	Finish() error
}

Contract for an analyzer

func NewCelFilterAnalyzer

func NewCelFilterAnalyzer(fl string, failOnMatch bool) (Analyzer, error)

func NewCelFilterSuiteAnalyzer

func NewCelFilterSuiteAnalyzer(path string, failOnMatch bool) (Analyzer, error)

func NewExceptionsGenerator

func NewExceptionsGenerator(config ExceptionsGeneratorConfig) (Analyzer, error)

func NewJsonDumperAnalyzer

func NewJsonDumperAnalyzer(dir string) (Analyzer, error)

func NewLockfilePoisoningAnalyzer added in v1.5.0

func NewLockfilePoisoningAnalyzer(config LockfilePoisoningAnalyzerConfig) (Analyzer, error)

type AnalyzerEvent

type AnalyzerEvent struct {
	// Analyzer generating this event
	Source string

	// Type of the event
	Type AnalyzerEventType

	// Message / Error / Filter
	Message interface{}
	Filter  *filtersuite.Filter
	Threat  *jsonreportspec.ReportThreat
	Err     error

	// Entities on which event was generated
	Manifest *models.PackageManifest
	Package  *models.Package
}

func (*AnalyzerEvent) IsFailOnError

func (ev *AnalyzerEvent) IsFailOnError() bool

func (*AnalyzerEvent) IsFilterMatch

func (ev *AnalyzerEvent) IsFilterMatch() bool

func (*AnalyzerEvent) IsLockfilePoisoningSignal added in v1.5.0

func (ev *AnalyzerEvent) IsLockfilePoisoningSignal() bool

type AnalyzerEventHandler

type AnalyzerEventHandler func(event *AnalyzerEvent) error

Callback to receive events from analyzer

type AnalyzerEventType

type AnalyzerEventType string

type ExceptionsGeneratorConfig

type ExceptionsGeneratorConfig struct {
	Path      string
	Filter    string
	ExpiresOn string
}

type LockfilePoisoningAnalyzerConfig added in v1.5.0

type LockfilePoisoningAnalyzerConfig struct {
	FailFast            bool
	TrustedRegistryUrls []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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