Shows all Hex dependencies that have been marked as retired or have security advisories.
Retired packages are no longer recommended to be used by their maintainers. The task will display a message describing the reason for retirement and exit with a non-zero code if any retired dependencies are found.
Security advisories indicate known vulnerabilities in a package version. The task will display advisory details and exit with a non-zero code if any packages with advisories are found.
The task fails when the registry entry of a locked package can't be
fetched or doesn't include the locked version, and with --policy or
--policy-overrides when the active policy can't be fetched. A cached
entry can miss advisories published since it was fetched, and a cached
policy can miss changes to the policy, so the task doesn't fall back to
them. Set HEX_OFFLINE=1 to audit against the cache instead.
Ignoring advisories and retirements
Advisories that do not affect your project and retirements you cannot act
on yet can be acknowledged in the :hex section of your mix.exs project
configuration:
def project() do
[
# ...
hex: [
ignore_advisories: ["CVE-2026-32686"],
ignore_retirements: [:decimal, phoenix: "1.0.0"]
]
]
endignore_advisories lists advisory IDs; an advisory is ignored when the
given ID matches its primary ID or any of its aliases, so a GHSA advisory
can also be ignored by its CVE ID. ignore_retirements lists packages by
name, optionally pinned to a single version.
Ignored findings are listed in separate "Ignored" sections and do not cause
a non-zero exit code. Entries that do not match anything in the lock file
produce a warning so they can be cleaned up, and a non-zero exit code with
--check-unused-ignores. The same configuration
silences the advisory and retirement warnings printed by mix deps.get
and mix deps.update.
Both values can also be set with the HEX_IGNORE_ADVISORIES and
HEX_IGNORE_RETIREMENTS environment variables as comma-separated lists,
where retirement entries are NAME or NAME@VERSION.
Command line options
--policy-overrides- reports all advisory and retirement findings except those accepted by a matching policy ALLOW, ADVISORY, or RETIREMENT override, and locked packages matched by a DENY override--policy- reports advisory and retirement findings rejected by the active policy's restrictions and overrides, and locked packages matched by a DENY override--format FORMAT- selects the output format. Supported formats arehuman(default) andsarif. SARIF output requires OTP 27 or later--output PATH- writes the report to the given file instead of printing it. Can only be used with--format sarif--check-unused-ignores- exits with a non-zero code when anignore_advisoriesorignore_retirementsentry does not match anything in the lock file
Both policy modes list locked packages matched by a DENY override in a
"Denied:" section and exit with a non-zero code when any are found.
ignore_advisories and ignore_retirements do not apply to denied
packages.
With the policy_enforce_lock config enabled, mix deps.get and
mix deps.update run the --policy check on mix.lock after resolving
dependencies and fail when it reports anything. See mix help hex.policy.
SARIF output
With --format sarif the audit result is rendered as a
SARIF
v2.1.0 document that code scanning services can ingest. Each finding is
anchored to the dependency's entry in mix.lock, and advisory severities
are mapped to SARIF levels and GitHub security-severity scores. Findings
acknowledged with ignore_advisories or ignore_retirements, and with
--policy or --policy-overrides findings the active policy accepts, are
left out, so GitHub code scanning closes their alerts as fixed.
The exit code behaves the same as with the human format, so CI jobs still
fail while findings are open.
Usage with GitHub Actions
The report can be uploaded to GitHub code
scanning, which
lists the findings in the repository's Security tab and annotates
mix.lock in pull requests:
name: Audit dependencies
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 6 * * *"
permissions:
contents: read
security-events: write
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: erlef/setup-beam@v1
with:
otp-version: "28"
elixir-version: "1.18"
- run: mix deps.get
- run: mix hex.audit --format sarif --output hex-audit.sarif
- uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: hex-audit.sarif
category: hex-auditmix hex.audit exits with a non-zero code when it finds retired packages
or advisories, failing the job. if: always() makes sure the report is
still uploaded in that case. Add continue-on-error: true to the audit
step instead if the alerts should only appear in the Security tab without
failing the build.
In a project, this task must be invoked before any other tasks that may load or start your application. Otherwise, you must explicitly list
:hexas part of your:extra_applications.