config

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: 12 Imported by: 0 modules, 0 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 config manages the configuration for osv-scanner.

Index

Constants

This section is empty.

Variables

View Source
var OSVScannerConfigName = "osv-scanner.toml"

Functions

This section is empty.

Types

type Config

type Config struct {
	IgnoredVulns      []*IgnoreEntry          `toml:"IgnoredVulns"`
	PackageOverrides  []*PackageOverrideEntry `toml:"PackageOverrides"`
	GoVersionOverride string                  `toml:"GoVersionOverride"`
	ScanGoModVersion  bool                    `toml:"ScanGoModVersion"`
	// The path to config file that this config was loaded from,
	// set by the scanner after having successfully parsed the file
	LoadPath string `toml:"-"`
}

func (*Config) FindIgnorePackageOverride added in v2.7.1

func (c *Config) FindIgnorePackageOverride(pkg *extractor.Package) *PackageOverrideEntry

FindIgnorePackageOverride returns the first override entry relating to ignoring the given package entirely

func (*Config) FindPackageLicenseOverride added in v2.7.1

func (c *Config) FindPackageLicenseOverride(pkg *extractor.Package) *PackageOverrideEntry

FindPackageLicenseOverride returns the first override entry relating to licenses for the given package

func (*Config) FindPackageVulnerabilitiesOverride added in v2.7.1

func (c *Config) FindPackageVulnerabilitiesOverride(pkg *extractor.Package) *PackageOverrideEntry

FindPackageVulnerabilitiesOverride returns the first override entry relating to vulnerabilities for the given package

func (*Config) FindVulnIgnore added in v2.7.1

func (c *Config) FindVulnIgnore(vulnID string) *IgnoreEntry

FindVulnIgnore returns the first ignore entry relating to the given vulnerability id

func (*Config) UnusedIgnoredVulns added in v2.2.4

func (c *Config) UnusedIgnoredVulns() []*IgnoreEntry

func (*Config) UnusedPackageOverrides added in v2.7.1

func (c *Config) UnusedPackageOverrides() []*PackageOverrideEntry

type IgnoreEntry

type IgnoreEntry struct {
	ID             string    `toml:"id"`
	EffectiveUntil time.Time `toml:"effectiveUntil"`
	Reason         string    `toml:"reason"`

	Used bool `toml:"-"`

	// Deprecated: use EffectiveUntil
	IgnoreUntil time.Time `toml:"ignoreUntil"`
}

func (*IgnoreEntry) MarkAsUsed added in v2.2.4

func (ie *IgnoreEntry) MarkAsUsed()

type License

type License struct {
	Override []string `toml:"override"`
	Ignore   bool     `toml:"ignore"`
}

type Manager

type Manager struct {
	// Override to replace all other configs
	OverrideConfig *Config
	// Config to use if no config file is found alongside manifests
	DefaultConfig Config
	// Cache to store loaded configs
	ConfigMap map[string]Config
}

func (*Manager) Get

func (m *Manager) Get(targetPath string) Config

Get returns the appropriate config to use based on the targetPath

func (*Manager) GetUnusedIgnoreEntries added in v2.2.4

func (m *Manager) GetUnusedIgnoreEntries() map[string][]*IgnoreEntry

func (*Manager) GetUnusedPackageOverrides added in v2.7.1

func (m *Manager) GetUnusedPackageOverrides() map[string][]*PackageOverrideEntry

func (*Manager) UseOverride

func (m *Manager) UseOverride(configPath string) error

UseOverride updates the Manager to use the config at the given path in place of any other config files that would be loaded when calling Get

type PackageOverrideEntry

type PackageOverrideEntry struct {
	Name string `toml:"name"`
	// If the version is empty, the entry applies to all versions.
	Version        string        `toml:"version"`
	Ecosystem      string        `toml:"ecosystem"`
	Group          string        `toml:"group"`
	NameIsRegex    bool          `toml:"nameIsRegex"`
	Ignore         bool          `toml:"ignore"`
	Vulnerability  Vulnerability `toml:"vulnerability"`
	License        License       `toml:"license"`
	EffectiveUntil time.Time     `toml:"effectiveUntil"`
	Reason         string        `toml:"reason"`

	Used bool `toml:"-"`
}

func OmitUnexpiredLicenseOverrides added in v2.7.1

func OmitUnexpiredLicenseOverrides(overrides []*PackageOverrideEntry) []*PackageOverrideEntry

OmitUnexpiredLicenseOverrides removes any overrides that relate only to licenses

func (*PackageOverrideEntry) Describe added in v2.7.1

func (e *PackageOverrideEntry) Describe() string

func (*PackageOverrideEntry) MarkAsUsed added in v2.7.1

func (e *PackageOverrideEntry) MarkAsUsed()

type Vulnerability

type Vulnerability struct {
	Ignore bool `toml:"ignore"`
}

Jump to

Keyboard shortcuts

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