config

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 10 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

Index

Constants

This section is empty.

Variables

This section is empty.

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 models.PackageVulns) (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 models.PackageVulns) 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 models.PackageVulns) (bool, PackageOverrideEntry)

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

type IgnoreEntry

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

type License

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

type Manager added in v1.9.2

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 added in v1.9.2

func (c *Manager) Get(r reporter.Reporter, targetPath string) Config

Attempts to get the config

func (*Manager) UseOverride added in v1.9.2

func (c *Manager) UseOverride(r reporter.Reporter, configPath string) error

Sets the override config by reading the config file at configPath. Will return an error if loading the config file fails

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