osvscanner

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 59 Imported by: 12 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package osvscanner provides the main logic for the OSV-Scanner.

Index

Constants

This section is empty.

Variables

View Source
var ErrAPIFailed = errors.New("API query failed")

ErrAPIFailed describes errors related to querying API endpoints. TODO(v2): Actually use this error

View Source
var ErrExtractorNotFound = errors.New("could not determine extractor suitable to this file")
View Source
var ErrNoPackagesFound = errors.New("no packages found in scan")

ErrNoPackagesFound for when no packages are found during a scan.

View Source
var ErrVulnerabilitiesFound = errors.New("vulnerabilities found")

ErrVulnerabilitiesFound includes vulnerabilities, license violations, and package deprecation, however, will not be raised if only uncalled vulnerabilities are found.

Functions

func DoContainerScan

func DoContainerScan(actions ScannerActions) (models.VulnerabilityResults, error)

func DoScan

DoScan performs the osv scanner action, with optional reporter to output information

func SetLogger added in v2.2.0

func SetLogger(handler slog.Handler)

SetLogger sets the global slog handler for the cmdlogger.

func SetupClientFactories added in v2.5.0

func SetupClientFactories(clientFactories scalibrconfig.ClientFactories, httpClient *http.Client, userAgent string) (scalibrconfig.ClientFactories, func())

SetupClientFactories returns the client factories to use, and a cleanup function that the caller must defer. If clientFactories is not nil, it is returned as is and the cleanup is a no-op.

Types

type ExperimentalScannerActions

type ExperimentalScannerActions struct {
	ExcludePatterns    []string
	TransitiveScanning TransitiveScanningActions

	PluginsEnabled    []string
	PluginsDisabled   []string
	PluginsNoDefaults bool

	StatsCollector stats.Collector

	HTTPClient *http.Client

	// Custom ScalibrConfig to use instead of constructing default ones
	ScalibrConfig *scalibrconfig.PluginConfig

	// Report deprecated packages as findings
	FlagDeprecatedPackages bool

	// Allows specifying user agent
	RequestUserAgent string
}

type ExternalAccessors

type ExternalAccessors struct {
	// Required for vendored Extractor
	OSVDevClient *osvdev.OSVClient
}

type ScannerActions

type ScannerActions struct {
	ExperimentalScannerActions

	LockfilePaths      []string
	DirectoryPaths     []string
	GitCommits         []string
	Recursive          bool
	IncludeGitRoot     bool
	NoIgnore           bool
	Image              string
	IsImageArchive     bool
	ConfigOverridePath string
	CallAnalysisStates map[string]bool
	ShowAllPackages    bool
	ShowAllVulns       bool

	// local databases
	CompareOffline    bool
	DownloadDatabases bool
	LocalDBPath       string

	// network-backed plugins
	PluginNetworkDisabled bool

	// license scanning
	ScanLicensesSummary   bool
	ScanLicensesAllowlist []string

	// Deprecated: in favor of LockfilePaths
	SBOMPaths []string
}

type TransitiveScanningActions

type TransitiveScanningActions struct {
	Disabled         bool
	NativeDataSource bool
	MavenRegistry    string
}

Directories

Path Synopsis
internal
imagehelpers
Package imagehelpers provides helper functions for working with container images.
Package imagehelpers provides helper functions for working with container images.
scanners
Package scanners provides functionality for scanning lockfiles.
Package scanners provides functionality for scanning lockfiles.

Jump to

Keyboard shortcuts

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