Shows the active Hex policy and explains why specific versions are blocked.
$ mix hex.policy show
$ mix hex.policy why PACKAGE
Commands
show— Summarize the active policy: visibility and the per-repository restrictions (cooldown, advisory, retirement) and the package overrides, plus the effective cooldown.why PACKAGE— Walk every version of the named package in the registry, classify each against the active policy, and print a per-version table of status and the reasons it is blocked.
Opting in
A project opts into a single policy. It is configured like any other
Hex setting, with the usual precedence (HEX_POLICY env var, then
mix.exs, then mix hex.config):
mix.exs:hexblock, withorg:for a hexpm organization orrepo:for any configured repo:defp project() do [hex: [policy: [org: "myorg", name: "strict-prod"]]] endHEX_POLICYenv var (aREPO/NAMEpair). An empty value disables the configured policy for the invocation:$ HEX_POLICY=hexpm:myorg/strict-prod mix deps.get$ mix hex.config policy hexpm:myorg/strict-prod
Enforcing the lock
Versions already in mix.lock are trusted during resolution, so a locked
release that later gets an advisory, a retirement, or a DENY override is
still installed. Enable policy_enforce_lock to make mix deps.get and
mix deps.update fail instead:
defp project() do
[
hex: [
policy: [org: "myorg", name: "strict-prod"],
policy_enforce_lock: true
]
]
endAfter resolving, every Hex package in mix.lock goes through the check
mix hex.audit --policy runs. The policy's advisory and retirement
restrictions and overrides apply first, then ignore_advisories and
ignore_retirements from the project. An ignore entry acknowledges one
finding for the project without changing which new versions the policy
accepts. A package matched by a DENY override fails until the policy
changes. Cooldown doesn't apply to locked versions.
The setting follows the usual precedence: HEX_POLICY_ENFORCE_LOCK, then
mix.exs, then mix hex.config policy_enforce_lock true. An empty
HEX_POLICY_ENFORCE_LOCK disables the check for the invocation.
See https://hex.pm/docs/dependency-policies for the full guide.