VulnCheck.Feeds.CVSS (VulnCheck v1.0.1)

Copy Markdown View Source

CVSS helpers: computes CVSS v3.0/v3.1 base scores and CVSS v4.0 scores (VulnCheck.Feeds.CVSS.V4) from vector strings.

Summary

Functions

Computes the score of a CVSS v3.x or v4.0 vector, or nil when the vector is not valid. A v4.0 vector with Threat or Environmental metrics is scored with them.

CycloneDX method name corresponding to the vector header.

Returns the CVSS major version of a vector string (3 or 4), or nil.

Types

rating()

@type rating() :: %{
  score: float(),
  vector: String.t() | nil,
  method: String.t(),
  source: String.t()
}

Functions

base_score(vector)

@spec base_score(String.t() | nil) :: float() | nil

Computes the score of a CVSS v3.x or v4.0 vector, or nil when the vector is not valid. A v4.0 vector with Threat or Environmental metrics is scored with them.

iex> VulnCheck.Feeds.CVSS.base_score("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H")
9.8
iex> VulnCheck.Feeds.CVSS.base_score("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H")
7.5
iex> VulnCheck.Feeds.CVSS.base_score("CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N")
9.3
iex> VulnCheck.Feeds.CVSS.base_score("not a vector")
nil

method(arg1)

@spec method(term()) :: String.t() | nil

CycloneDX method name corresponding to the vector header.

version(vector)

@spec version(String.t() | nil) :: 3 | 4 | nil

Returns the CVSS major version of a vector string (3 or 4), or nil.