Repository navigation
Conversation
ImageMagick was only used by Paperclip to resize provider logos to a 500x200 PNG "medium" style. Drop the style so Paperclip stores the logo as uploaded and never shells out, and add a 1 MB size limit so oversized uploads are rejected instead of served as-is. - Remove the unused mini_magick gem - Remove imagemagick from the Dockerfile and the CI workflow - Install `file` explicitly in the Dockerfile; Paperclip's content-type spoof check needs it and rejects every upload without it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Purpose
Remove the system and gem dependency on ImageMagick (
mini_magick) by discontinuing server-side image resizing for provider logos, while introducing a 1 MB file size limit to prevent oversized uploads.Approach
Previously, Paperclip shelled out to ImageMagick via
mini_magickto resize uploaded provider logos to amedium(500x200, PNG) style. ImageMagick introduces significant system-level attack surface and maintenance overhead.We now store uploaded logos directly without modification and rely on clients to handle display dimensions. To prevent excessively large files from being uploaded and served, a validation constraint is introduced limiting logo files to less than 1 MB. With logo resizing removed,
mini_magickand system-level ImageMagick installations have been removed from the application, CI, and Docker environments.Key Modifications
app/models/provider.rb:stylesdefinition (medium: ["500x200", :png]) anddefault_stylefromhas_attached_file :logo.size: { less_than: 1.megabyte }.logo_urlto returnlogo.urlinstead oflogo.url(:medium).mini_magickgem fromGemfileandGemfile.lock.imagemagickpackage fromDockerfileand.github/workflows/parallel_ci.yml.filepackage toDockerfileto support Paperclip's MIME-type detection.Important Technical Details
fileCLI package was added to the Docker image because Paperclip uses it for content type spoofing detection and MIME-type resolution when ImageMagick is absent.Types of changes
Reviewer, please remember our guidelines: