localmatcher

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOfflineDatabaseNotFound = errors.New("no offline version of the OSV database is available")

Functions

func VulnerabilitiesAffectingPackage

func VulnerabilitiesAffectingPackage(allVulns []osvschema.Vulnerability, pkg imodels.PackageInfo) []*osvschema.Vulnerability

TODO: Move this to another file.

Types

type LocalMatcher

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

LocalMatcher implements the VulnerabilityMatcher interface by downloading the osv export zip files, and performing the matching locally.

func NewLocalMatcher

func NewLocalMatcher(localDBPath string, userAgent string, downloadDB bool) (*LocalMatcher, error)

func (*LocalMatcher) LoadEcosystem

func (matcher *LocalMatcher) LoadEcosystem(ctx context.Context, ecosystem ecosystem.Parsed) error

LoadEcosystem tries to preload the ecosystem into the cache, and returns an error if the ecosystem cannot be loaded.

func (*LocalMatcher) MatchVulnerabilities

func (matcher *LocalMatcher) MatchVulnerabilities(ctx context.Context, invs []*extractor.Package) ([][]*osvschema.Vulnerability, error)

type ZipDB

type ZipDB struct {
	// the name of the database
	Name string
	// the url that the zip archive was downloaded from
	ArchiveURL string
	// whether this database should make any network requests
	Offline bool
	// the path to the zip archive on disk
	StoredAt string

	// User agent to query with
	UserAgent string
	// contains filtered or unexported fields
}

func NewZippedDB

func NewZippedDB(ctx context.Context, dbBasePath, name, url, userAgent string, offline bool) (*ZipDB, error)

func (*ZipDB) Check

func (db *ZipDB) Check(pkgs []imodels.PackageInfo) ([]*osvschema.Vulnerability, error)

func (*ZipDB) Vulnerabilities

func (db *ZipDB) Vulnerabilities(includeWithdrawn bool) []osvschema.Vulnerability

Jump to

Keyboard shortcuts

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