Repository navigation
Upgrade Rails and MiniMagick for GHSA-f3w6-w445-fwh9 - #296
Merged
Merged
Conversation
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>
There was a problem hiding this comment.
🔵 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GHSA-f3w6-w445-fwh9 affects Active Storage
>= 8.1, < 8.1.4.1. Withconfig.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_magickalso needs mini_magick >= 5.1 so Active Storage can apply the policy it ships; older MiniMagick raises at boot.Locked versions:
rails/activestorage8.1.4.1 (Gemfile:~> 8.1, >= 8.1.4.1)mini_magick5.4.0 (Gemfile:~> 5.1, which allows 5.1 and later)config.active_storage.variant_processorstays:mini_magick.ruby-vipsstays 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.xmland prepends that directory toMAGICK_CONFIGURE_PATHthroughMiniMagick.cli_envfor every ImageMagick process MiniMagick starts. Boot check:ActiveStorage::MINIMAGICK_UNSECURABLEis false, andMiniMagick.cli_env["MAGICK_CONFIGURE_PATH"]is the shipped policy directory. This app does not replaceMiniMagick.cli_env,cli_prefix, orMiniMagick::Shell.Why this targets staging
PR #295 merges
stagingintomain, and its head isstaging. This branch is cut from currentstagingso 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 bundleruby-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 andcap production deployruns. A hostpolicy.xmlthat explicitly allows a coder the shipped policy denies overrides that deny.