VulnCheck.Feeds.OSV (VulnCheck v1.0.1)

Copy Markdown View Source

Ingests the OSV.dev Hex ecosystem archive (Hex/all.zip).

The archive is downloaded through VulnCheck.Cache (ETag revalidation, offline support), unpacked in memory with size and entry-count limits, and every record is converted into one VulnCheck.Types.Advisory per affected Hex package. Records of the same vulnerability (for example the EEF and GitHub records of one CVE) are merged by VulnCheck.Feeds.Merge.

Summary

Functions

Cache path (relative to the feeds directory) of the archive.

Default URL of the OSV Hex archive.

Groups advisories by package name and normalized git repository slug.

Fetches (or reads from cache) and parses the OSV Hex archive.

Parses an in-memory ZIP archive of OSV JSON records.

Converts one decoded OSV record into advisories (one per affected Hex package). Withdrawn records produce no advisories.

Restricts structured symbols to the affected blocks for a locked version.

Functions

cache_file()

@spec cache_file() :: String.t()

Cache path (relative to the feeds directory) of the archive.

default_url()

@spec default_url() :: String.t()

Default URL of the OSV Hex archive.

index(advisories)

@spec index([VulnCheck.Types.Advisory.t()]) :: %{
  required(String.t()) => [VulnCheck.Types.Advisory.t()]
}

Groups advisories by package name and normalized git repository slug.

load(config, opts \\ [])

Fetches (or reads from cache) and parses the OSV Hex archive.

Options: :osv_url, plus every option accepted by VulnCheck.Cache.fetch/4.

parse_archive(zip)

@spec parse_archive(binary()) ::
  {:ok, [VulnCheck.Types.Advisory.t()]} | {:error, term()}

Parses an in-memory ZIP archive of OSV JSON records.

parse_record(record)

@spec parse_record(map()) :: [VulnCheck.Types.Advisory.t()]

Converts one decoded OSV record into advisories (one per affected Hex package). Withdrawn records produce no advisories.

scope_symbols(advisory, version)

Restricts structured symbols to the affected blocks for a locked version.