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
@spec advisories(VulnCheck.Types.Workspace.t(), VulnCheck.Config.t(), keyword()) :: {[VulnCheck.Types.Advisory.t()], [String.t()]}
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.
@spec default_api_url() :: String.t()
Default base URL of the Hex.pm packages API.
@spec gate?(VulnCheck.Types.Finding.t(), VulnCheck.Config.t()) :: boolean()
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.
@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.
@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
@spec severity(VulnCheck.Types.Retirement.reason()) :: VulnCheck.Types.Advisory.severity()
Severity assigned to a retirement reason.
@spec to_finding(VulnCheck.Types.Advisory.t(), VulnCheck.Types.Package.t()) :: VulnCheck.Types.Finding.t()
Converts a retirement advisory into a :retired finding for package.