Skip to content

Upgrade Rails and MiniMagick for GHSA-f3w6-w445-fwh9 - #296

Merged
rsmoke merged 1 commit into
stagingfrom
cursor/rails-minimagick-advisory-52ac
Nov 10, 2026
Merged

rsmoke merged 1 commit into
stagingfrom
cursor/rails-minimagick-advisory-52ac

Conversation

@rsmoke

@rsmoke rsmoke commented Nov 10, 2026

Copy link
Copy Markdown
Member

Summary

GHSA-f3w6-w445-fwh9 affects Active Storage >= 8.1, < 8.1.4.1. With config.active_storage.variant_processor = :mini_magick, a crafted upload can write arbitrary server files during attachment analysis (no variant request required) and, with Disk storage, read files the app process can read. Patched Rails is 8.1.4.1, the latest 8.1 release. An app on :mini_magick also needs mini_magick >= 5.1 so Active Storage can apply the policy it ships; older MiniMagick raises at boot.

Locked versions:

  • rails / activestorage 8.1.4.1 (Gemfile: ~> 8.1, >= 8.1.4.1)
  • mini_magick 5.4.0 (Gemfile: ~> 5.1, which allows 5.1 and later)

config.active_storage.variant_processor stays :mini_magick. ruby-vips stays out of the bundle.

Attachment analysis no longer depends on the advisory's ImageMagick system-policy workaround. Active Storage 8.1.4.1 ships policy.xml and prepends that directory to MAGICK_CONFIGURE_PATH through MiniMagick.cli_env for every ImageMagick process MiniMagick starts. Boot check: ActiveStorage::MINIMAGICK_UNSECURABLE is false, and MiniMagick.cli_env["MAGICK_CONFIGURE_PATH"] is the shipped policy directory. This app does not replace MiniMagick.cli_env, cli_prefix, or MiniMagick::Shell.

Why this targets staging

PR #295 merges staging into main, and its head is staging. This branch is cut from current staging so the upgrade is on the branch #295 will merge.

Tests

spec/config/active_storage_variant_processor_spec.rb: 4 examples, 0 failures. The app still processes variants with MiniMagick, loads MiniMagick, and does not load libvips or bundle ruby-vips.

Production watch-item

ImageMagick is still required at request time to render variants (Action Text resize_to_limit). This pull request does not deploy. Production remains on Active Storage 8.1.3.1 and mini_magick 4.13.2 until #295 is merged and cap production deploy runs. A host policy.xml that explicitly allows a coder the shipped policy denies overrides that deny.

Open in Web Open in Cursor 

Lock Rails 8.1.4.1 and mini_magick 5.4.0 so Active Storage applies
its shipped ImageMagick policy during attachment analysis.

Co-authored-by: rsmoke <rsmoke@umich.edu>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The live GCS bucket CORS policy is unavailable, leaving support for Rails 8.1.4.1’s new x-goog-content-length-range header and production-like direct uploads unverified.

No open issues 🎉

What changed in this PR

Updates Rails and MiniMagick to address GHSA-f3w6-w445-fwh9 in Active Storage while preserving the MiniMagick image-processing setup introduced in PR #295.

Changes:

  • Raises the Rails minimum to 8.1.4.1 and updates all locked Rails components.
  • Requires MiniMagick 5.1 or later and locks 5.4.0 so Active Storage can apply its ImageMagick security policy.
File Description
Gemfile.lock Locks Rails components to 8.1.4.1 and MiniMagick to 5.4.0.
Gemfile Sets patched dependency minimums and documents the MiniMagick security requirement.

Review effort: Balanced

@rsmoke
rsmoke merged commit 82ccb13 into staging Nov 10, 2026
7 checks passed
@rsmoke
rsmoke deleted the cursor/rails-minimagick-advisory-52ac branch November 10, 2026 16:39
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