Skip to content

Warn on installation of vulnerable packages#1150

Merged
ericmj merged 9 commits into
hexpm:mainfrom
maennchen:jm/advisories
May 14, 2026
Merged

Warn on installation of vulnerable packages#1150
ericmj merged 9 commits into
hexpm:mainfrom
maennchen:jm/advisories

Conversation

@maennchen
Copy link
Copy Markdown
Contributor

@maennchen maennchen commented May 8, 2026

clean retired
clean retired
vulnerable retired & vulnerable
vulnerable retired & vulnerable

@maennchen maennchen force-pushed the jm/advisories branch 3 times, most recently from c626e81 to 332cacc Compare May 14, 2026 16:08
… advisory output

- Bump `Hex.Dev.@ets_version` to 4 so registries extracted via
  `Hex.Dev.extract_registry/2` survive the version check in
  `Hex.Registry.Server.check_version/1`.
- Extract `print_advisories/2` in `Hex.RemoteConverger` so retired and
  non-retired branches share the same severity-colored advisory output.
- Add an integration test asserting the advisory warning is printed
  during `mix deps.get` for the resolved version.
@ericmj
Copy link
Copy Markdown
Member

ericmj commented May 14, 2026

@maennchen I pushed a commit with some minor fixes/tweaks.

maennchen added 6 commits May 14, 2026 20:08
** (MatchError) no match of right hand side value: {:error, "Hex is running in offline mode and the registry entry for package oidcc is not cached locally"}
    (hex 2.4.3-dev) lib/hex/registry/server.ex:31: Hex.Registry.Server.prefetch/1
@maennchen maennchen marked this pull request as ready for review May 14, 2026 19:42
- mix hex.audit: replace tables with stacked "Retired:" / "Advisories:"
  sections so long summaries and URLs no longer overflow column widths.
  Each retirement and each advisory is a self-contained block with a
  blank line between them, making it obvious where one ends and the next
  begins.
- mix deps.get / deps.update: insert a blank line between consecutive
  advisory blocks (and after the retirement message) for the same
  reason.
- format_advisory_ansi/2: underline URLs; drop unused format_advisory/1;
  replace :normal (which resets intensity, not color) with [].
- remote_converger: thread retired/advisories through dep_changes so the
  registry is queried once per dep instead of three times.
- Add a test for Registry.prefetch/1 raising a Mix.Error in offline
  mode when a package is not cached.
@ericmj ericmj merged commit 3c02464 into hexpm:main May 14, 2026
12 checks passed
@ericmj
Copy link
Copy Markdown
Member

ericmj commented May 14, 2026

This is great! Thanks so much for your work on this across all repos. 💜 💜 💜

@maennchen maennchen deleted the jm/advisories branch May 14, 2026 22:47
@maennchen
Copy link
Copy Markdown
Contributor Author

@ericmj Thnaks for all your help. I’m excited to get this out 😁

@ericmj
Copy link
Copy Markdown
Member

ericmj commented May 16, 2026

Final designs:
Screenshot 2026-05-15 at 00 17 13
Screenshot 2026-05-15 at 00 18 55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants