mod osv

module osv

A package URL, or a CVE id resolved through OSV.

The CVE record often has only a git range. The package name and the versions EasyBuild actually pins are on the GHSA or RUSTSEC alias, or in name-version tags such as libXpm-3.5.17. A GIT range is mapped onto release versions from affected[].versions when that list is present, and otherwise from tags in the upstream repository. An offline tag lookup leaves the range unresolved.

Re-exports

  • eb_stack::osv_git::CachingGitRanges

  • eb_stack::osv_git::GitRangeSource

  • eb_stack::osv_git::NoGit

Functions

fn load_recorded_osv(dir: &Path) -> Result<MapClient, String>

Read OSV responses saved under dir.

queries.json records the date and each request URL. The named files are the bodies returned for those URLs, so a later run does not ask the network.

fn parse_purl(raw: &str) -> Result<ParsedPurl, String>

Parse a package URL into the name and version a reach query uses.

fn resolve_vulnerability(id: &str, client: &dyn RegistryClient) -> Result<OsvResolution, String>

Fetch id and the advisory aliases that carry a package.

GIT ranges are not resolved against upstream tags. Use resolve_vulnerability_with when a GitRangeSource is available.

fn resolve_vulnerability_with(id: &str, client: &dyn RegistryClient, git: &dyn GitRangeSource) -> Result<OsvResolution, String>

Fetch id, and map GIT ranges with git when the advisory has no versions.

Structs and Unions

struct OsvResolution

What one OSV id resolved to.

id: String

Id that was asked for.

components: Vec<ResolvedComponent>

Affected packages that name a version.

notes: Vec<String>

Alias fetches that failed. The packages above are still usable.

unresolved: Vec<String>

Ranges with no package name, and other drops that are not on a component.

struct ParsedPurl

pkg:type/namespace/name@version.

kind: String

cargo, pypi, generic, …

ecosystem: String

OSV ecosystem for Self::kind, when there is a usual one.

namespace: Option<String>

Namespace, when the purl has one.

name: String

Package name.

version: Option<String>

Version, when the purl pins one.

struct ResolvedComponent

One affected package OSV named.

ecosystem: String

OSV ecosystem, empty when the record only had name-version tags.

name: String

Component name to search for.

purl: String

Package URL, filled in when OSV omitted it.

version_reqs: Vec<String>

Requirements, any one of which matches. >=0,<0.103.13.

versions: Vec<String>

Exact versions, any one of which matches.

unresolved: Vec<String>

Ranges and events that were not parsed into a requirement.