Documentation
¶
Overview ¶
Package filter provides CVSS score-based filtering for vulnerabilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatScore ¶
FormatScore formats a CVSS score for display.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter applies CVSS score filtering to vulnerabilities.
func NewFilter ¶
func NewFilter(nvdClient *nvd.Client, opts ...FilterOption) *Filter
NewFilter creates a new Filter with the given options.
func (*Filter) Apply ¶
func (f *Filter) Apply(ctx context.Context, result *govulncheck.Result) (*FilterResult, error)
Apply filters vulnerabilities based on CVSS scores.
type FilterOption ¶
type FilterOption func(*Filter)
FilterOption configures the Filter.
func WithCVSSVersion ¶
func WithCVSSVersion(version nvd.CVSSVersion) FilterOption
WithCVSSVersion sets the preferred CVSS version.
func WithCalledOnly ¶
func WithCalledOnly(called bool) FilterOption
WithCalledOnly filters to only include vulnerabilities that are actually called.
func WithFailOnNoCVSS ¶
func WithFailOnNoCVSS(fail bool) FilterOption
WithFailOnNoCVSS configures whether to fail when CVSS score is unavailable.
func WithMaxAgeYears ¶
func WithMaxAgeYears(years int) FilterOption
WithMaxAgeYears sets the maximum age filter in years (0 = no limit).
func WithThreshold ¶
func WithThreshold(threshold float64) FilterOption
WithThreshold sets the CVSS score threshold.
type FilterResult ¶
type FilterResult struct {
Threshold float64
CVSSVersion nvd.CVSSVersion
MaxAgeYears int
TotalVulns int
FilteredVulns int
HighestScore float64
Vulnerabilities []*VulnerabilityInfo
NoCVSSVulns []*VulnerabilityInfo
SkippedVulns []*VulnerabilityInfo
TooOldVulns []*VulnerabilityInfo
FailOnNoCVSS bool
ShouldFail bool
}
FilterResult contains the results of vulnerability filtering.
type Severity ¶
type Severity string
Severity represents CVSS severity levels.
func GetSeverity ¶
GetSeverity returns the severity level for a CVSS score.
type VulnerabilityInfo ¶
type VulnerabilityInfo struct {
OSVID string
CVEIDs []string
Summary string
Details string
CVSSScore *nvd.CVSSScore
Modules []string
FixedVersion string
Finding *govulncheck.Finding
OSV *govulncheck.OSV
Published time.Time
}
VulnerabilityInfo aggregates vulnerability data from multiple sources.