scanner

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrImageNotFound indicates that the image provided was not found in the
	// registry.
	ErrImageNotFound = errors.New("image not found")

	// ErrSchemaV1NotSupported indicates that the image provided is using a v1
	// schema which is not supported.
	ErrSchemaV1NotSupported = errors.New("schema v1 manifest not supported by trivy")
)

Functions

func WithImageScanner added in v1.1.0

func WithImageScanner(is ImageScanner) func(s *Scanner)

WithImageScanner allows providing a specific ImageScanner implementation for a Scanner instance.

Types

type ImageScanner added in v1.1.0

type ImageScanner interface {
	// ScanImage scans the provided image for security vulnerabilities,
	// returning a report in json format.
	ScanImage(image string) ([]byte, error)
}

ImageScanner describes the methods an ImageScanner implementation must provide. An image scanner is responsible of scanning a container image for security vulnerabilities.

type ImageScannerMock added in v1.1.0

type ImageScannerMock struct {
	mock.Mock
}

ImageScannerMock is an ImageScanner mock implementation.

func (*ImageScannerMock) ScanImage added in v1.1.0

func (m *ImageScannerMock) ScanImage(image string) ([]byte, error)

ScanImage implements the ImageScanner interface.

type Scanner

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

Scanner is in charge of scanning packages' snapshots for security vulnerabilities. It relies on an image scanner to scan all the containers images listed on the snapshot.

func New added in v1.1.0

func New(
	ctx context.Context,
	cfg *viper.Viper,
	ec hub.ErrorsCollector,
	opts ...func(s *Scanner),
) *Scanner

New creates a new Scanner instance.

func (*Scanner) Scan

Scan scans the provided package's snapshot for security vulnerabilities returning a report with the results.

type TrivyScanner

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

TrivyScanner is an ImageScanner implementation that uses Trivy to scan containers images for security vulnerabilities.

func (*TrivyScanner) ScanImage added in v1.1.0

func (s *TrivyScanner) ScanImage(image string) ([]byte, error)

ScanImage implements the ImageScanner interface.

Jump to

Keyboard shortcuts

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