enrich

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 36 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 enrich adds end-of-life dates from endoflife.date and known vulnerabilities from OSV to a tool's versions, and reads the Go build info of installed binaries.

Index

Constants

View Source
const (
	ReasonNoSource   = "no-advisory-source" // no curated osv list and no backend or repository OSV knows
	ReasonPrivate    = "private-source"     // a host or registry relgap never sends to OSV
	ReasonNotExact   = "not-exact"          // a constraint, range, branch, channel or bare SHA
	ReasonUnresolved = "unresolved"         // the pin resolves to no tool
	ReasonOffline    = "offline"            // --offline and no cached answer
	ReasonFailed     = "failed"             // OSV failed for this pin
)

Reasons a pin is unchecked: relgap didn't ask OSV about it, so it is never reported as clean.

View Source
const (
	SourceEOL  = "endoflife.date"
	SourceOSV  = "osv"
	SourceKEV  = "kev"
	SourceEPSS = "epss"
)

Sources an Problem can name.

View Source
const (
	KEVHost  = "www.cisa.gov"
	EPSSHost = "api.first.org"
	KEVURL   = "https://" + KEVHost + "/sites/default/files/feeds/known_exploited_vulnerabilities.json"
	EPSSURL  = "https://" + EPSSHost + "/data/v1/epss"
)

Prioritization feeds: the CISA Known Exploited Vulnerabilities catalog and FIRST EPSS.

View Source
const (
	SentQueryBatch = "POST /v1/querybatch"
	SentVuln       = "GET /v1/vulns/{id}"
)

The requests of SentField.

View Source
const (
	SuppressedByIgnore = "ignore" // a vulns.ignore entry
	SuppressedByVEX    = "vex"    // an OpenVEX statement
)

Suppression kinds.

View Source
const (
	EcosystemGo  = "Go"
	EcosystemGit = "GIT"
	// EcosystemActions holds GitHub Actions advisories. OSV doesn't evaluate their ECOSYSTEM
	// ranges for a version, so relgap asks without one and matches the ranges itself.
	EcosystemActions = "GitHub Actions"
)

OSV ecosystems and range types relgap handles specially.

View Source
const EndOfLifeURL = "https://endoflife.date/api/v1"

EndOfLifeURL is the endoflife.date API v1 base URL.

View Source
const OSVURL = "https://api.osv.dev"

OSVURL is the OSV API base URL.

View Source
const RatingUnknown = "unknown"

RatingUnknown is the rating of an advisory that neither it nor a GHSA alias rates.

View Source
const ReachabilityNote = "matched by Go version and module version only: relgap doesn't check " +
	"whether the binary calls the vulnerable code"

ReachabilityNote says what binary mode can't tell, unlike govulncheck's symbol analysis.

Variables

View Source
var ErrNoProduct = errors.New("not an endoflife.date product")

ErrNoProduct is returned when endoflife.date has no such product.

View Source
var ErrNotPublic = errors.New("the repository isn't public")

ErrNotPublic means a forge answered that a repository is private, internal or not visible.

Functions

func Affects

func Affects(r *Record, pkg Package, v string) (bool, bool)

Affects reports whether the record lists version v of pkg as affected, following the OSV schema: v is in versions, or inside a range's introduced..fixed (or ..last_affected). The second result is false when a range that could hold v can't be compared and no versions list covers it.

func CycleName

func CycleName(e registry.EOL, s version.Scheme, v version.V) string

CycleName fills the registry cycle template for v; an empty template means {major}.{minor}.

func EPSSScore added in v0.13.0

func EPSSScore(e *EPSS) float64

EPSSScore returns the score of e, or -1 without one, so advisories without a score sort last.

func FixedIn

func FixedIn(r *Record, pkg Package, v string) string

FixedIn returns the lowest fixed version above v in the ranges of pkg, or "".

func GoPrefixes added in v0.13.0

func GoPrefixes(path string) []string

GoPrefixes returns the prefixes of a Go package path that could be its module, longest first.

func GoSemver

func GoSemver(s string) string

GoSemver turns a Go version or tag (go1.24, 1.24.3, go1.25rc1) into the semver form OSV uses for the Go ecosystem (1.24.0, 1.24.3, 1.25.0-rc.1). Other text comes back trimmed of a v.

func KEVFirst added in v0.13.0

func KEVFirst(a, b *KEV) int

KEVFirst orders an advisory in the KEV catalog (a) before one that isn't (b): it returns -1 when only a is listed, 1 when only b is, and 0 otherwise.

func NameReason added in v0.13.0

func NameReason(name string) (string, bool)

NameReason returns the unchecked reason of a pin whose tool name alone says OSV is never asked about it: an image (private-source on a registry relgap never sends to, else no-advisory-source) or a chart. Neither takes a curated entry, so it needs no lookup. The second result is false for every other name.

func PackagesFor

func PackagesFor(pkgs []registry.OSVPackage, s version.Scheme, v version.V) []registry.OSVPackage

PackagesFor returns the OSV packages that describe major version line of v. A Go module path ending in /vN belongs to major N only; one without a suffix belongs to majors 0 and 1 when the list has suffixed paths too, and to every major otherwise.

func QueryVersion

func QueryVersion(p registry.OSVPackage, tag string, v version.V) string

QueryVersion is the version string OSV expects for v of a package: the tag for GIT, the Go semver form for Go, and the version itself elsewhere.

func Rating

func Rating(score float64) string

Rating returns the qualitative rating of a CVSS score.

func SkipReason added in v0.13.0

func SkipReason(name string, err error) string

SkipReason returns why a pin of the tool name isn't checked when resolving name failed with err: a tool relgap doesn't know is unresolved, a registry it may not read or that wants an account is private, and a failed lookup is offline or failed.

Types

type Affected

type Affected struct {
	Package          Package    `json:"package"`
	Ranges           []Range    `json:"ranges"`
	Versions         []string   `json:"versions"`
	Severity         []Severity `json:"severity"`
	DatabaseSpecific struct {
		Severity string `json:"severity"`
	} `json:"database_specific"`
}

Affected lists the affected versions of one package.

type Binary

type Binary struct {
	Tool          string `json:"tool"`
	Path          string `json:"path"`
	GoVersion     string `json:"go_version"`               // as OSV takes it, such as 1.24.3
	Module        string `json:"module,omitempty"`         // the main module path
	ModuleVersion string `json:"module_version,omitempty"` // absent for (devel) builds
	// ModuleUnchecked says why OSV wasn't asked about the main module, such as private-source.
	ModuleUnchecked string  `json:"module_unchecked,omitempty"`
	Queries         []Query `json:"queries"`
	Vulns           []Vuln  `json:"vulns"`
	// contains filtered or unexported fields
}

Binary is an installed Go executable of a tool and what OSV knows about its Go version and main module.

func ReadBinary

func ReadBinary(t registry.ToolSpec, path string) (*Binary, error)

ReadBinary reads the Go build info of the executable of tool t at path and the OSV queries it implies: the standard library at the Go version, and the main module unless it was built as (devel). Enricher.BinaryVulns drops the main module when it may be private.

type BinaryFinder

type BinaryFinder struct {
	Lookup func(key string) (string, bool) // environment
	// Which resolves a mise shim to the executable it runs, as `mise which` does; nil skips
	// shims, whose targets the installs directory has anyway.
	Which func(ctx context.Context, name string) (string, error)
}

BinaryFinder finds a tool's executables on PATH and among mise's installed versions.

func (BinaryFinder) Find

Find returns the executables named in t.Bin (default: the tool name), resolved paths without duplicates: PATH first, then $MISE_DATA_DIR/installs/<tool>/<version>/ and its bin/. Version aliases (symlinks such as latest or 1.17) are skipped.

type Coverage added in v0.13.0

type Coverage struct {
	Packages []registry.OSVPackage // queried at the version
	GoPath   string                // a go: package path; its longest prefix OSV knows is queried at the version
	Repo     Repo                  // the repository the packages name; zero for a curated list or a package backend
	Reason   string                // why nothing is queried; empty when the tool is checked
}

Coverage is what relgap asks OSV about one tool version, or why it asks nothing.

func CoverageOf added in v0.13.0

func CoverageOf(name string, t registry.ToolSpec, v version.V) Coverage

CoverageOf returns what relgap asks OSV about version v of tool t, whose pins name it name (the name `relgap digest` accepts, such as chart:argo/argo-cd). A curated osv list wins. Otherwise a package backend names the package, an action its GitHub Actions package, and a github.com tool gets its Go module and a GIT query on its repository, the mapping mise audit uses. Hosts other than github.com and gitlab.com are never sent.

func (Coverage) Checked added in v0.13.0

func (c Coverage) Checked() bool

Checked reports whether relgap asks OSV about the tool.

type Cycle

type Cycle struct {
	Name         string `json:"name"`
	IsEOL        bool   `json:"isEol"`
	EOLFrom      string `json:"eolFrom"` // date; empty when not announced
	IsMaintained bool   `json:"isMaintained"`
	Latest       struct {
		Name string `json:"name"`
	} `json:"latest"`
}

Cycle is one release cycle of an endoflife.date product.

type EOL

type EOL struct {
	Product string     `json:"product"`
	Current *EOLStatus `json:"current"`
	Target  *EOLStatus `json:"target,omitempty"`
}

EOL is the end-of-life state of a tool's current and target versions.

type EOLClient

type EOLClient struct {
	// contains filtered or unexported fields
}

EOLClient reads products from the endoflife.date API v1.

func NewEOLClient

func NewEOLClient(hc *http.Client, base string) *EOLClient

NewEOLClient returns a client that sends requests through hc to base (empty means EndOfLifeURL).

func (*EOLClient) Cycles

func (c *EOLClient) Cycles(ctx context.Context, product string) ([]Cycle, error)

Cycles returns the release cycles of product. It wraps ErrNoProduct for 404.

type EOLStatus

type EOLStatus struct {
	Version       string `json:"version"`
	Cycle         string `json:"cycle"`
	IsEOL         *bool  `json:"is_eol,omitempty"`          // absent when endoflife.date doesn't list the cycle
	EOLFrom       string `json:"eol_from,omitempty"`        // date the cycle reaches or reached its end
	LatestInCycle string `json:"latest_in_cycle,omitempty"` // newest release of the cycle
	Note          string `json:"note,omitempty"`
}

EOLStatus is the end-of-life state of one version's cycle.

func Status

func Status(cycles []Cycle, e registry.EOL, s version.Scheme, v version.V) *EOLStatus

Status looks up the cycle of v among cycles.

type EPSS added in v0.13.0

type EPSS struct {
	CVE        string  `json:"cve"`
	Score      float64 `json:"score"`      // probability of exploitation in the next 30 days, 0 to 1
	Percentile float64 `json:"percentile"` // share of scored CVEs at or below this score, 0 to 1
	Date       string  `json:"date"`       // YYYY-MM-DD the score was computed
}

EPSS is an advisory's FIRST EPSS score.

type EPSSClient added in v0.13.0

type EPSSClient struct {
	// contains filtered or unexported fields
}

EPSSClient reads EPSS scores, each CVE once per client.

func NewEPSSClient added in v0.13.0

func NewEPSSClient(hc *http.Client, url string) *EPSSClient

NewEPSSClient returns a client that sends its requests through hc to url (empty means EPSSURL).

func (*EPSSClient) Scores added in v0.13.0

func (c *EPSSClient) Scores(ctx context.Context, cves []string) (map[string]EPSS, error)

Scores returns the scores of the CVE IDs EPSS knows among cves. It sends the IDs it hasn't asked about yet, sorted, in as few requests as the API's limit on the cve parameter allows. A failed request fails the call, and its IDs are asked again next time.

type Enricher

type Enricher struct {
	// contains filtered or unexported fields
}

Enricher looks tools up on endoflife.date and OSV.

func NewEnricher

func NewEnricher(logger *slog.Logger, eol *EOLClient, osv *OSVClient, concurrency int) *Enricher

NewEnricher returns an enricher that uses eol and osv with up to concurrency requests at once. A nil eol skips endoflife.date.

func (*Enricher) BinaryVulns

func (e *Enricher) BinaryVulns(ctx context.Context, bins []*Binary) ([]Problem, error)

BinaryVulns queries OSV for every binary's queries in one batch and fills in their vulns, marking the ones the suppressor names and adding the feeds' fields. It returns the feeds that failed as problems, and an error when OSV failed.

func (*Enricher) Enrich

func (e *Enricher) Enrich(ctx context.Context, reqs []Request) (map[string]Result, []Problem, error)

Enrich answers every request. It asks endoflife.date and OSV at the same time, fetches each product's cycles once, sends all OSV queries in batches and fetches each record once. A failed source becomes a Problem; only a canceled context is an error.

func (*Enricher) SetFeeds added in v0.13.0

func (e *Enricher) SetFeeds(kev *KEVClient, epss *EPSSClient)

SetFeeds makes the enricher add the KEV entry and the EPSS score of each advisory's CVE aliases. A nil client skips its feed.

func (*Enricher) SetPrivacy added in v0.13.0

func (e *Enricher) SetPrivacy(p Privacy)

SetPrivacy sets what the enricher keeps away from OSV.

func (*Enricher) SetSuppressor added in v0.13.0

func (e *Enricher) SetSuppressor(s Suppressor)

SetSuppressor makes the enricher suppress the advisories s names before it works out the fix targets. A nil s suppresses nothing.

type Event

type Event struct {
	Introduced   string `json:"introduced,omitempty"`
	Fixed        string `json:"fixed,omitempty"`
	LastAffected string `json:"last_affected,omitempty"`
	Limit        string `json:"limit,omitempty"`
}

Event is one introduced, fixed, last_affected or limit event.

type Fix added in v0.13.0

type Fix struct {
	Lowest       string `json:"lowest,omitempty"`         // absent when no release qualifies
	LowestInLine string `json:"lowest_in_line,omitempty"` // the same within the current version's line
	Latest       string `json:"latest"`                   // the newest stable release
	// LatestAffected says whether OSV lists an advisory for Latest, named in LatestAffectedBy.
	LatestAffected   bool     `json:"latest_affected"`
	LatestAffectedBy []string `json:"latest_affected_by,omitempty"`
	// Unfixed lists the advisories of the current version that Latest still has: no release fixes
	// them.
	Unfixed []string `json:"unfixed,omitempty"`
}

Fix is the release a tool version can move to: the lowest stable release above it that every advisory with a fix has left behind and that has no fixable advisory of its own.

type GoPrivate added in v0.13.0

type GoPrivate struct {
	// contains filtered or unexported fields
}

GoPrivate holds the module path patterns of GOPRIVATE, GONOPROXY and GONOSUMDB, which Go keeps away from its proxy and checksum database.

func NewGoPrivate added in v0.13.0

func NewGoPrivate(values ...string) GoPrivate

NewGoPrivate returns the patterns of a GOPRIVATE value: comma-separated globs on path prefixes.

func ReadGoPrivate added in v0.13.0

func ReadGoPrivate(lookup func(string) (string, bool), goos string) GoPrivate

ReadGoPrivate reads GOPRIVATE, GONOPROXY and GONOSUMDB as the go command does: a non-empty environment variable, else the file `go env -w` writes ($GOENV, or go/env in the user config directory of goos). GONOPROXY and GONOSUMDB default to GOPRIVATE, so the patterns add up.

func (GoPrivate) Matches added in v0.13.0

func (g GoPrivate) Matches(path string) bool

Matches reports whether a pattern names the module path or one of its prefixes, by Go's rules: each glob matches as many leading path elements as it has.

func (GoPrivate) Patterns added in v0.13.0

func (g GoPrivate) Patterns() []string

Patterns returns the patterns, for the debug log.

type Hit added in v0.13.0

type Hit struct {
	ID       string `json:"id"`
	Modified string `json:"modified"` // RFC 3339, as querybatch returns it
}

Hit is a record a query returned, with the time OSV last changed it.

type KEV added in v0.13.0

type KEV struct {
	CVE        string `json:"cve"`
	DateAdded  string `json:"date_added"` // YYYY-MM-DD
	DueDate    string `json:"due_date"`   // YYYY-MM-DD, the remediation deadline for US federal agencies
	Ransomware bool   `json:"ransomware"` // CISA knows of its use in ransomware campaigns
}

KEV is an advisory's entry in the CISA Known Exploited Vulnerabilities catalog.

type KEVClient added in v0.13.0

type KEVClient struct {
	// contains filtered or unexported fields
}

KEVClient reads the CISA KEV catalog once per client.

func NewKEVClient added in v0.13.0

func NewKEVClient(hc *http.Client, url string) *KEVClient

NewKEVClient returns a client that sends its request through hc to url (empty means KEVURL).

func (*KEVClient) Catalog added in v0.13.0

func (c *KEVClient) Catalog(ctx context.Context) (map[string]KEV, error)

Catalog returns the catalog's entries by CVE ID. The first call fetches it; later calls return the same answer.

type OSVClient

type OSVClient struct {
	// contains filtered or unexported fields
}

OSVClient queries the OSV API.

func NewOSVClient

func NewOSVClient(hc *http.Client, base string) *OSVClient

NewOSVClient returns a client that sends requests through hc to base (empty means OSVURL).

func (*OSVClient) Known added in v0.13.0

func (c *OSVClient) Known(ctx context.Context, pkgs []Package) ([]bool, error)

Known reports, for each package, whether OSV has any record of it. It reads one page per package, sent as versionless queries in batches.

func (*OSVClient) OldestAge added in v0.13.0

func (c *OSVClient) OldestAge() (time.Duration, bool)

OldestAge returns the largest Age header of the responses read so far: how long ago the oldest answer was stored in a cache. The second result is false when no response had one.

func (*OSVClient) QueryBatch

func (c *OSVClient) QueryBatch(ctx context.Context, qs []Query) ([][]Hit, error)

QueryBatch returns the records of each query, in query order. It follows each result's next_page_token.

func (*OSVClient) Vuln

func (c *OSVClient) Vuln(ctx context.Context, id, modified string) (*Record, error)

Vuln returns the record of id. A modified time from a querybatch hit keeps the record cached for 7 days while it is unchanged; such an answer is current, so its Age doesn't count for OSVClient.OldestAge. Empty modified caches the record like any other OSV answer.

type Package

type Package struct {
	Ecosystem string `json:"ecosystem"`
	Name      string `json:"name"`
}

Package is a package in an OSV ecosystem.

type Privacy added in v0.13.0

type Privacy struct {
	Go GoPrivate
	// Repos answers for the repositories the user named: a github: or gitlab: pin, a
	// tools.<name>.repo entry, a --guess or an action. nil treats each of them as private.
	Repos Visibility
}

Privacy says what relgap keeps away from OSV beyond the hosts it never sends.

type Problem

type Problem struct {
	Source string
	Tool   string // empty for a feed that failed for every tool (KEV, EPSS)
	Err    error
}

Problem is a source that failed for a tool. The rest of the report stands.

type Query

type Query struct {
	Package Package `json:"package"`
	Version string  `json:"version,omitempty"` // empty asks about every version
}

Query asks which vulnerabilities affect one version of a package.

type Range

type Range struct {
	Type   string  `json:"type"`
	Repo   string  `json:"repo,omitempty"`
	Events []Event `json:"events"`
}

Range is an OSV affected range: events in a SEMVER, ECOSYSTEM or GIT ordering. GIT ranges name their repository instead of a package.

type Record

type Record struct {
	ID               string     `json:"id"`
	Aliases          []string   `json:"aliases"`
	Summary          string     `json:"summary"`
	Details          string     `json:"details"`
	Severity         []Severity `json:"severity"`
	Affected         []Affected `json:"affected"`
	DatabaseSpecific struct {
		Severity string `json:"severity"`
	} `json:"database_specific"`
	Withdrawn time.Time `json:"withdrawn,omitzero"` // set when the record no longer applies
}

Record is an OSV vulnerability record, reduced to the fields relgap reads.

func (*Record) Score

func (r *Record) Score(pkg Package) *Score

Score returns the highest score among the record's CVSS vectors for pkg, as osv-scanner does, or the advisory's database-specific rating (GitHub's MODERATE, HIGH). It returns nil when the record has neither, as Go vulnerability database records don't.

type Repo added in v0.13.0

type Repo struct {
	Host string // forge.GitHub or forge.GitLab
	Path string // owner/repo, or the project path
}

Repo is a repository on github.com or gitlab.com.

func (Repo) ModulePath added in v0.13.0

func (r Repo) ModulePath() string

ModulePath is the repository as a Go module path, such as github.com/acme/tool.

type Request

type Request struct {
	Key     string // the caller's key for the result
	Name    string // the pin's tool name, such as chart:argo/argo-cd; empty means Tool.Name
	Tool    registry.ToolSpec
	Current version.V
	Target  version.V // zero when there is no target
	// Versions lists the tool's releases for the fix target; nil skips it. It runs only when OSV
	// lists an advisory for Current.
	Versions VersionLister
	// Refs are other values the pins give the version, such as an action's commit SHA, which a
	// VEX statement can name instead of the tag.
	Refs []string
	// contains filtered or unexported fields
}

Request asks for the EOL state and vulnerabilities of one tool version, and how a target version compares.

type Result

type Result struct {
	EOL       *EOL
	Vulns     []Vuln
	Unchecked string // a Reason* constant; empty when OSV answered
	Fix       *Fix
}

Result is what enrichment found for one request. A nil EOL means the tool has no endoflife.date product or the source failed (see Problem). Vulns is nil when OSV wasn't asked or failed, and Unchecked says which. Fix is nil without an advisory of the current version, or when its version list or OSV failed.

type Score

type Score struct {
	Score  float64 `json:"score,omitempty"`
	Rating string  `json:"rating"`           // none, low, medium, high, critical or unknown
	Vector string  `json:"vector,omitempty"` // the CVSS vector the score comes from
	From   string  `json:"from,omitempty"`   // the GHSA alias the score comes from
}

Score is a record's severity: the highest CVSS base score among its vectors with its rating, only the advisory's own rating when it has no vector, or the rating unknown.

func (*Score) Unknown added in v0.13.0

func (s *Score) Unknown() bool

Unknown reports whether s carries no rating: nil, or the rating unknown.

type SentField added in v0.13.0

type SentField struct {
	Request     string `json:"request"` // the method and path of the request
	Name        string `json:"name"`    // the JSON path of the field in the body, or the path parameter
	Description string `json:"description"`
}

SentField is one value that a request to OSV carries.

func SentToOSV added in v0.13.0

func SentToOSV() []SentField

SentToOSV returns every value relgap's requests to OSV carry. A test checks it against the bodies and paths that OSVClient sends.

type Severity

type Severity struct {
	Type  string `json:"type"`
	Score string `json:"score"`
}

Severity is one severity score of a record, such as a CVSS vector.

type Subject added in v0.13.0

type Subject struct {
	Tool    string      // as pins show it, such as kubectl or action:actions/checkout
	Version string      // the version OSV was asked about
	PURLs   []purl.PURL // the package URLs of its OSV packages and repository, at the version
}

Subject is a tool version as suppression rules name it.

type Suppression added in v0.13.0

type Suppression struct {
	Kind          string `json:"kind"` // ignore or vex
	Reason        string `json:"reason"`
	Until         string `json:"until,omitempty"`         // the ignore entry's last day
	Source        string `json:"source,omitempty"`        // the VEX document's path
	Status        string `json:"status,omitempty"`        // the VEX status: not_affected or fixed
	Justification string `json:"justification,omitempty"` // the VEX justification label
}

Suppression says why an advisory doesn't count: a vulns.ignore entry or an OpenVEX statement. A suppressed advisory stays in the report and is left out of counts, gates and fix targets.

type Suppressor added in v0.13.0

type Suppressor interface {
	// Suppress returns why the advisory is suppressed for s, or nil, and counts a match as a use
	// of its rule.
	Suppress(s Subject, names []string) *Suppression
	// Covers reports whether a rule suppresses the advisory for s, without counting a use.
	Covers(s Subject, names []string) bool
}

Suppressor decides which advisories of a tool version are suppressed. names holds the advisory's ID and aliases.

type VersionLister added in v0.13.0

type VersionLister func(ctx context.Context) (*version.Universe, error)

VersionLister returns a tool's released versions.

type Visibility added in v0.13.0

type Visibility interface {
	// Public returns, for each repository, nil when it is public, an error wrapping
	// [ErrNotPublic] when it isn't, and the lookup's error when the forge didn't say. The error
	// is set only for a canceled context.
	Public(ctx context.Context, repos []Repo) (map[Repo]error, error)
}

Visibility looks up whether repositories are public.

type Vuln

type Vuln struct {
	ID             string   `json:"id"`
	Aliases        []string `json:"aliases,omitempty"`
	Summary        string   `json:"summary,omitempty"`
	Package        Package  `json:"package"`
	Severity       *Score   `json:"severity,omitempty"`
	FixedIn        string   `json:"fixed_in,omitempty"` // lowest fixed version above the current one
	AffectsCurrent bool     `json:"affects_current"`
	// FixedByTarget says whether the target version is outside every affected range. It is
	// absent without a target or when the record's ranges can't be compared locally.
	FixedByTarget *bool `json:"fixed_by_target,omitempty"`
	// Suppressed says why the advisory doesn't count; absent when it does.
	Suppressed *Suppression `json:"suppressed,omitempty"`
	KEV        *KEV         `json:"kev,omitempty"`  // with --kev, when a CVE alias is in the catalog
	EPSS       *EPSS        `json:"epss,omitempty"` // with --epss, when EPSS scores a CVE alias
	// contains filtered or unexported fields
}

Vuln is one known vulnerability of a tool's current version.

func (Vuln) Counts added in v0.13.0

func (v Vuln) Counts() bool

Counts reports whether the advisory affects the current version and isn't suppressed.

func (Vuln) PURL added in v0.13.0

func (v Vuln) PURL() string

PURL returns the package URL of the advisory's package at the version OSV was asked about, or "" for an ecosystem without a purl type.

Jump to

Keyboard shortcuts

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