# `VulnCheck.Feeds.HexRetired`
[🔗](https://github.com/Voskan/vulncheck/blob/v1.0.1/lib/vulncheck/feeds/hex_retired.ex#L1)

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.

# `advisories`

```elixir
@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`.

# `default_api_url`

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

Default base URL of the Hex.pm packages API.

# `gate?`

```elixir
@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`.

# `hygiene`

```elixir
@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`

```elixir
@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`

```elixir
@spec severity(VulnCheck.Types.Retirement.reason()) ::
  VulnCheck.Types.Advisory.severity()
```

Severity assigned to a retirement reason.

# `to_finding`

```elixir
@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`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
