VulnCheck.Feeds.HexRetired (VulnCheck v1.0.1)

Copy Markdown View Source

Detects retired Hex.pm releases (the mix hex.audit check) and basic supply-chain hygiene problems in mix.lock.

Package metadata is fetched from https://hex.pm/api/packages/<name> through VulnCheck.Cache (ETag revalidation, offline support), eight packages at a time. Retired releases become advisories with a VulnCheck.Types.Retirement attached; to_finding/2 turns them into :retired findings.

Summary

Functions

Returns one advisory per locked Hex release that is retired, plus warnings.

Default base URL of the Hex.pm packages API.

Returns true when a retired finding should fail the gate: production dependencies fail when fail_on_retired is set; non-production ones only for security retirements under --fail-on any.

Supply-chain hygiene warnings for mix.lock workspaces: Hex entries without an outer SHA-256 checksum and production git dependencies that are not pinned to a full commit hash.

Extracts the retirement of version from a decoded Hex.pm package record.

Severity assigned to a retirement reason.

Converts a retirement advisory into a :retired finding for package.

Functions

advisories(workspace, config, opts \\ [])

Returns one advisory per locked Hex release that is retired, plus warnings.

Options: :hex_api_url, :http_client, :http_opts and every other option accepted by VulnCheck.Cache.fetch/4.

default_api_url()

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

Default base URL of the Hex.pm packages API.

gate?(finding, config)

Returns true when a retired finding should fail the gate: production dependencies fail when fail_on_retired is set; non-production ones only for security retirements under --fail-on any.

hygiene(workspace)

@spec hygiene(VulnCheck.Types.Workspace.t()) :: [String.t()]

Supply-chain hygiene warnings for mix.lock workspaces: Hex entries without an outer SHA-256 checksum and production git dependencies that are not pinned to a full commit hash.

retirement(record, version)

@spec retirement(map(), String.t()) :: VulnCheck.Types.Retirement.t() | nil

Extracts the retirement of version from a decoded Hex.pm package record.

Both the releases[].retirement and the top-level retirements map shapes are understood.

iex> record = %{"name" => "plug", "retirements" => %{"1.0.0" => %{"reason" => "security", "message" => "Use 1.0.1"}}}
iex> VulnCheck.Feeds.HexRetired.retirement(record, "1.0.0")
%VulnCheck.Types.Retirement{package: "plug", version: "1.0.0", reason: :security, message: "Use 1.0.1"}
iex> VulnCheck.Feeds.HexRetired.retirement(record, "1.1.0")
nil

severity(reason)

Severity assigned to a retirement reason.

to_finding(advisory, package)

Converts a retirement advisory into a :retired finding for package.