config

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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"`
	// 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) ShouldIgnore

func (c *Config) ShouldIgnore(vulnID string) (bool, *IgnoreEntry)

func (*Config) ShouldIgnorePackage

func (c *Config) ShouldIgnorePackage(pkg imodels.PackageInfo) (bool, PackageOverrideEntry)

ShouldIgnorePackage determines if the given package should be ignored based on override entries in the config

func (*Config) ShouldIgnorePackageVulnerabilities

func (c *Config) ShouldIgnorePackageVulnerabilities(pkg imodels.PackageInfo) bool

ShouldIgnorePackageVulnerabilities determines if the given package should have its vulnerabilities ignored based on override entries in the config

func (*Config) ShouldOverridePackageLicense

func (c *Config) ShouldOverridePackageLicense(pkg imodels.PackageInfo) (bool, PackageOverrideEntry)

ShouldOverridePackageLicense determines if the given package should have its license ignored or changed based on override entries in the config

func (*Config) UnusedIgnoredVulns added in v2.2.4

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

type IgnoreEntry

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

	Used bool `toml:"-"`
}

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 (c *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 (c *Manager) GetUnusedIgnoreEntries() map[string][]*IgnoreEntry

func (*Manager) UseOverride

func (c *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"`
	Ignore         bool          `toml:"ignore"`
	Vulnerability  Vulnerability `toml:"vulnerability"`
	License        License       `toml:"license"`
	EffectiveUntil time.Time     `toml:"effectiveUntil"`
	Reason         string        `toml:"reason"`
}

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