Skip to content

Upgrade to Phoenix 1.8 and clear mix hex.audit advisories - #195

Merged
pagbabian-splunk merged 1 commit into
ocsf:mainfrom
floydtree:deps/phoenix-1.8
Nov 3, 2026
Merged

pagbabian-splunk merged 1 commit into
ocsf:mainfrom
floydtree:deps/phoenix-1.8

Conversation

@floydtree

Copy link
Copy Markdown
Contributor

Why

mix hex.audit on main reports 22 published advisories against locked dependencies. This PR upgrades Phoenix to 1.8 and the HTTP stack to releases that fix them. It also covers the Phoenix 1.8 and logger_file_backend follow-ups from #194.

Advisories

Package Before → after Advisories fixed
phoenix 1.7.21 → 1.8.16 EEF-CVE-2026-32689, EEF-CVE-2026-56811, EEF-CVE-2026-56812
phoenix_html 4.3.0 → 4.4.0 EEF-CVE-2026-117645
plug 1.19.1 → 1.20.3 EEF-CVE-2026-54892, EEF-CVE-2026-8468, EEF-CVE-2026-56813, EEF-CVE-2026-56814
plug_crypto 2.1.1 → 2.2.1 EEF-CVE-2026-105963
plug_cowboy 2.8.0 → 2.9.0 EEF-CVE-2026-32688
cowboy 2.14.2 → 2.20.0 EEF-CVE-2026-8466, EEF-CVE-2026-65624, GHSA-w4f7-4cxr-rv3c
cowlib 2.16.0 → 2.21.0 EEF-CVE-2026-43968, EEF-CVE-2026-43969, EEF-CVE-2026-43970, EEF-CVE-2026-43971, EEF-CVE-2026-7790, EEF-CVE-2026-59248
decimal 2.3.0 → removed EEF-CVE-2026-32686, EEF-CVE-2026-97853

One advisory remains: cowlib EEF-CVE-2026-43966. It's fixed in cowlib's git history, but 2.21.0 is the newest release and is still affected. It only matters when cow_http_struct_hd encodes attacker-controlled input, and nothing in this app or its dependencies calls cow_http_struct_hd. A later cowlib release will clear it.

Most of these were also unreachable already. For example, the endpoint's socket "/socket" disables both websocket and long-poll transports. Upgrading means we don't have to argue reachability for each one.

Changes

  • mix.exs / mix.lock: phoenix ~> 1.8.16, phoenix_html ~> 4.4, plug_cowboy ~> 2.9, then mix deps.update --all and mix deps.unlock --unused. The floors keep the fixed versions as minimums. Other minor bumps come along: telemetry, ranch, phoenix_pubsub, phoenix_template, phoenix_live_reload 1.7, websock_adapter 0.7, credo, and sobelow 0.18.
  • Removed number (and with it decimal): decimal's fixes exist only in 3.x, and number pins it to 2.x. The app used number once, format_number/1 in SchemaWeb.PageView, to add thousands separators. That's now a two-clause local helper with the same output, for example 0-65,535 on /data_types. Jason only uses decimal optionally, so decimal leaves the lock.
  • Removed logger_file_backend: it was never wired up. config/test.exs configured a :test_log backend, but nothing added it to Logger's backends. The dead config is gone too.
  • Phoenix 1.8 deprecations: use Phoenix.Controller now passes formats: [html: "View", json: "View"], layouts: [html: SchemaWeb.LayoutView] instead of the deprecated namespace: SchemaWeb. This is the compatibility form Phoenix suggests, and it resolves the same view and layout modules as before. The view helper no longer imports the deprecated, unused get_flash.
  • Removed force_ssl from config/releases.exs: under Phoenix 1.7 the endpoint read its config at compile time, so this runtime-only setting never took effect. I checked: today's release serves plain HTTP for a non-localhost Host with a 200, no redirect and no HSTS. Phoenix 1.8 reads force_ssl with Application.compile_env, so leaving the line in makes the release (and the Docker image) refuse to boot with a compile-time/runtime config mismatch. Removing it keeps production behaviour exactly as it is. Turning on HTTP→HTTPS redirects can be a separate, deliberate change in config/prod.exs.
  • @version: 4.6.1 → 4.6.2.

What users will notice

Browser pages get a new header from Phoenix 1.8's put_secure_browser_headers: content-security-policy: base-uri 'self'; frame-ancestors 'self';. The deprecated x-frame-options: SAMEORIGIN and x-download-options: noopen headers are no longer sent. Third-party framing stays blocked, now through frame-ancestors. Nothing else changes.

Testing

All runs used Elixir 1.19.7 / OTP 28.5.0.8 from .tool-versions.

  • mix compile --warnings-as-errors: passes with no app warnings.
  • mix hex.audit: reports only cowlib EEF-CVE-2026-43966.
  • Before/after comparison: I ran main and this branch side by side in MIX_ENV=prod with the same compiled 1.10.0-dev schema, and fetched 42 routes, plus 3 random /sample/* routes compared by status only. Those covered all browser pages (including one class, object, profile and category, /dictionary, /data_types and /visualizer), the /api/*, /schema/*, /export/* and /doc routes, 404s, and POST /api/validate and /api/v2/validate.
    • Every status code matched.
    • Bodies were identical apart from the server version in the footer, the port in absolute URLs, and JSON key/list order.
    • Two runs of unchanged main differ the same way, so that ordering is per-VM map iteration order, not this change.
    • The only header differences are the ones described above.
  • Release: a MIX_ENV=prod mix release built like the Dockerfile (with config/releases.exs as runtime.exs and a generated certificate) boots and serves HTTP and HTTPS on Phoenix 1.8.16 / Plug 1.20.3 / Cowboy 2.20.0. Before the force_ssl removal it aborted at boot.
  • I didn't build the Docker image locally because no Docker daemon was available. CI also only compiles, so a maintainer may want to build the image once before releasing.

🤖 Generated with Claude Code

mix hex.audit reported advisories against phoenix 1.7.21, phoenix_html
4.3.0, plug 1.19.1, plug_crypto 2.1.1, plug_cowboy 2.8.0, cowboy 2.14.2,
cowlib 2.16.0 and decimal 2.3.0. Upgrade to phoenix 1.8.16,
phoenix_html 4.4.0, plug 1.20.3, plug_crypto 2.2.1, plug_cowboy 2.9.0,
cowboy 2.20.0 and cowlib 2.21.0. The only advisory left is cowlib
EEF-CVE-2026-43966, which has no fixed release yet and affects only
cow_http_struct_hd encoding, which nothing here calls.

- Drop the number dependency, which pinned decimal to 2.x (decimal is
  fixed only in 3.x). Its one use, format_number/1 in PageView, becomes
  a small local helper with the same output, and decimal leaves the lock.
- Drop logger_file_backend and the :test_log config in test.exs. The
  backend was never added to Logger, so neither had any effect.
- Phoenix 1.8: pass :formats and :layouts to use Phoenix.Controller in
  place of the deprecated :namespace, keeping the same views and layout,
  and stop importing the deprecated, unused get_flash.
- Remove force_ssl from config/releases.exs. Phoenix 1.7 read endpoint
  config at compile time, so this runtime-only setting never applied.
  Phoenix 1.8 reads it with compile_env and refuses to boot the release
  on the mismatch. Removing it keeps production behaviour unchanged.
- Bump the server version to 4.6.2.

Signed-off-by: Rajas <panat.r@northeastern.edu>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pagbabian-splunk
pagbabian-splunk merged commit b573f34 into ocsf:main Nov 3, 2026
1 check passed
@floydtree
floydtree deleted the deps/phoenix-1.8 branch November 3, 2026 17:56
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.

3 participants