Documentation
¶
Overview ¶
Package config manages the configuration for osv-scanner.
Index ¶
- Variables
- type Config
- func (c *Config) FindIgnorePackageOverride(pkg *extractor.Package) *PackageOverrideEntry
- func (c *Config) FindPackageLicenseOverride(pkg *extractor.Package) *PackageOverrideEntry
- func (c *Config) FindPackageVulnerabilitiesOverride(pkg *extractor.Package) *PackageOverrideEntry
- func (c *Config) FindVulnIgnore(vulnID string) *IgnoreEntry
- func (c *Config) UnusedIgnoredVulns() []*IgnoreEntry
- func (c *Config) UnusedPackageOverrides() []*PackageOverrideEntry
- type IgnoreEntry
- type License
- type Manager
- type PackageOverrideEntry
- type Vulnerability
Constants ¶
This section is empty.
Variables ¶
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 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) 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 ¶
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"`
}