osvmatcher

package
v2.3.6 Latest Latest
Warning

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

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

Documentation

Overview

Package osvmatcher implements two vulnerability matcher using osv.dev's API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedOSVMatcher

type CachedOSVMatcher struct {
	Client osvdev.OSVClient
	// InitialQueryTimeout allows you to set a timeout specifically for the initial paging query
	// If timeout runs out, whatever pages that has been successfully queried within the timeout will
	// still return fully hydrated.
	InitialQueryTimeout time.Duration
	// contains filtered or unexported fields
}

CachedOSVMatcher implements the VulnerabilityMatcher interface with a osv.dev client. It sends out requests for every vulnerability of each package, which get cached. Checking if a specific version matches an OSV record is done locally. This should be used when we know the same packages are going to be repeatedly queried multiple times, as in guided remediation. TODO: This does not support commit-based queries.

func (*CachedOSVMatcher) MatchVulnerabilities

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

type OSVMatcher

type OSVMatcher struct {
	Client osvdev.OSVClient
	// InitialQueryTimeout allows you to set a timeout specifically for the initial paging query
	// If timeout runs out, whatever pages that has been successfully queried within the timeout will
	// still return fully hydrated.
	InitialQueryTimeout time.Duration
}

OSVMatcher implements the VulnerabilityMatcher interface with an osv.dev client. It sends out requests for every package version and does not perform caching.

func New added in v2.1.0

func New(initialQueryTimeout time.Duration, userAgent string, httpClient *http.Client) *OSVMatcher

func (*OSVMatcher) MatchVulnerabilities

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

MatchVulnerabilities matches vulnerabilities for a list of packages.

Jump to

Keyboard shortcuts

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