vulnstore

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package vulnstore is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetOpts

type GetOpts struct {
	// Matchers tells the Get() method to limit the returned vulnerabilities by the provided MatchConstraint
	// see MatchConstraint type def for more info.
	Matchers []driver.MatchConstraint
	// Debug asks the database layer to log exta information
	Debug bool
	// VersionFiltering enables filtering based on the normalized versions in
	// the database.
	VersionFiltering bool
}

GetOpts provides instructions on how to match your packages to vulnerabilities.

type MockUpdater

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

MockUpdater is a mock of Updater interface

func NewMockUpdater

func NewMockUpdater(ctrl *gomock.Controller) *MockUpdater

NewMockUpdater creates a new mock instance

func (*MockUpdater) DeleteUpdateOperations

func (m *MockUpdater) DeleteUpdateOperations(arg0 context.Context, arg1 ...uuid.UUID) (int64, error)

DeleteUpdateOperations mocks base method

func (*MockUpdater) EXPECT

func (m *MockUpdater) EXPECT() *MockUpdaterMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUpdater) GC

func (m *MockUpdater) GC(arg0 context.Context, arg1 int) (int64, error)

GC mocks base method

func (*MockUpdater) GetLatestUpdateRef

func (m *MockUpdater) GetLatestUpdateRef(arg0 context.Context) (uuid.UUID, error)

GetLatestUpdateRef mocks base method

func (*MockUpdater) GetLatestUpdateRefs

func (m *MockUpdater) GetLatestUpdateRefs(arg0 context.Context) (map[string][]driver.UpdateOperation, error)

GetLatestUpdateRefs mocks base method

func (*MockUpdater) GetUpdateDiff

func (m *MockUpdater) GetUpdateDiff(arg0 context.Context, arg1, arg2 uuid.UUID) (*driver.UpdateDiff, error)

GetUpdateDiff mocks base method

func (*MockUpdater) GetUpdateOperations

func (m *MockUpdater) GetUpdateOperations(arg0 context.Context, arg1 ...string) (map[string][]driver.UpdateOperation, error)

GetUpdateOperations mocks base method

func (*MockUpdater) Initialized

func (m *MockUpdater) Initialized(arg0 context.Context) (bool, error)

Initialized mocks base method

func (*MockUpdater) UpdateVulnerabilities

func (m *MockUpdater) UpdateVulnerabilities(arg0 context.Context, arg1 string, arg2 driver.Fingerprint, arg3 []*claircore.Vulnerability) (uuid.UUID, error)

UpdateVulnerabilities mocks base method

type MockUpdaterMockRecorder

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

MockUpdaterMockRecorder is the mock recorder for MockUpdater

func (*MockUpdaterMockRecorder) DeleteUpdateOperations

func (mr *MockUpdaterMockRecorder) DeleteUpdateOperations(arg0 interface{}, arg1 ...interface{}) *gomock.Call

DeleteUpdateOperations indicates an expected call of DeleteUpdateOperations

func (*MockUpdaterMockRecorder) GC

func (mr *MockUpdaterMockRecorder) GC(arg0, arg1 interface{}) *gomock.Call

GC indicates an expected call of GC

func (*MockUpdaterMockRecorder) GetLatestUpdateRef

func (mr *MockUpdaterMockRecorder) GetLatestUpdateRef(arg0 interface{}) *gomock.Call

GetLatestUpdateRef indicates an expected call of GetLatestUpdateRef

func (*MockUpdaterMockRecorder) GetLatestUpdateRefs

func (mr *MockUpdaterMockRecorder) GetLatestUpdateRefs(arg0 interface{}) *gomock.Call

GetLatestUpdateRefs indicates an expected call of GetLatestUpdateRefs

func (*MockUpdaterMockRecorder) GetUpdateDiff

func (mr *MockUpdaterMockRecorder) GetUpdateDiff(arg0, arg1, arg2 interface{}) *gomock.Call

GetUpdateDiff indicates an expected call of GetUpdateDiff

func (*MockUpdaterMockRecorder) GetUpdateOperations

func (mr *MockUpdaterMockRecorder) GetUpdateOperations(arg0 interface{}, arg1 ...interface{}) *gomock.Call

GetUpdateOperations indicates an expected call of GetUpdateOperations

func (*MockUpdaterMockRecorder) Initialized

func (mr *MockUpdaterMockRecorder) Initialized(arg0 interface{}) *gomock.Call

Initialized indicates an expected call of Initialized

func (*MockUpdaterMockRecorder) UpdateVulnerabilities

func (mr *MockUpdaterMockRecorder) UpdateVulnerabilities(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

UpdateVulnerabilities indicates an expected call of UpdateVulnerabilities

type Store

type Store interface {
	Updater
	Vulnerability
}

Store aggregates all interface types

type Updater

type Updater interface {
	// UpdateVulnerabilities creates a new UpdateOperation, inserts the provided
	// vulnerabilities, and ensures vulnerabilities from previous updates are
	// not queried by clients.
	UpdateVulnerabilities(ctx context.Context, updater string, fingerprint driver.Fingerprint, vulns []*claircore.Vulnerability) (uuid.UUID, error)
	// GetUpdateOperations returns a list of UpdateOperations in date descending
	// order for the given updaters.
	//
	// The returned map is keyed by Updater implementation's unique names.
	//
	// If no updaters are specified, all UpdateOperations are returned.
	GetUpdateOperations(context.Context, driver.UpdateKind, ...string) (map[string][]driver.UpdateOperation, error)
	// GetLatestUpdateRefs reports the latest update reference for every known
	// updater.
	GetLatestUpdateRefs(context.Context, driver.UpdateKind) (map[string][]driver.UpdateOperation, error)
	// GetLatestUpdateRef reports the latest update reference of any known
	// updater.
	GetLatestUpdateRef(context.Context, driver.UpdateKind) (uuid.UUID, error)
	// DeleteUpdateOperations removes an UpdateOperation.
	// A call to GC must be run after this to garbage collect vulnerabilities associated
	// with the UpdateOperation.
	//
	// The number of UpdateOperations deleted is returned.
	DeleteUpdateOperations(context.Context, ...uuid.UUID) (int64, error)
	// GetUpdateOperationDiff reports the UpdateDiff of the two referenced
	// Operations.
	//
	// In diff(1) terms, this is like
	//
	//	diff prev cur
	//
	GetUpdateDiff(ctx context.Context, prev, cur uuid.UUID) (*driver.UpdateDiff, error)
	// GC will delete any update operations for an updater which exceeds the provided keep
	// value.
	//
	// Implementations may throttle the GC process for datastore efficiency reasons.
	//
	// The returned int64 value indicates the remaining number of update operations needing GC.
	// Running this method till the returned value is 0 accomplishes a full GC of the vulnstore.
	GC(ctx context.Context, keep int) (int64, error)
	// Initialized reports whether the vulnstore contains vulnerabilities.
	Initialized(context.Context) (bool, error)
}

Updater is an interface exporting the necessary methods for updating a vulnerability database.

type Vulnerability

type Vulnerability interface {
	// get finds the vulnerabilities which match each package provided in the packages array
	// this maybe a one to many relationship. each package is assumed to have an ID.
	// a map of Package.ID => Vulnerabilities is returned.
	Get(ctx context.Context, records []*claircore.IndexRecord, opts GetOpts) (map[string][]*claircore.Vulnerability, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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