Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Default to Paperclip::ContentTypeDetector #2270

Merged
merged 2 commits into from
Aug 19, 2016
Merged

Default to Paperclip::ContentTypeDetector #2270

merged 2 commits into from
Aug 19, 2016

Conversation

ivanoblomov
Copy link
Contributor

This patch defaults Paperclip::UploadedFileAdapter.content_type_detector to Paperclip::ContentTypeDetector.

Without it, Paperclip allows the upload of any content, including executables, so long as the client forges a permitted content-type.

Security holes shouldn't be the default setting where we can avoid it.

@tute
Copy link
Contributor

tute commented Aug 19, 2016

Thank you very much, @ivanoblomov.

dsteelma-umd added a commit to dsteelma-umd/student-applications that referenced this pull request Aug 20, 2018
Updated Paperclip gem from v5.0.0 to v5.3.0 to address gem
vulnerabilities.

Ran "bundle update paperclip" to update related gems.

Fixed a test that began failing due to better file content detection
in the new Rails version (see
thoughtbot/paperclip#2270). Prior to the
upgrade, the test was actually providing a PDF file, but the file was
being rejected because the provided MIME type was given as "text/html".
After the upgrade, the provided MIME type is not trusted, and the file
itself is examined. Since the file provided in the test is actually a
PDF file, the file is correctly identified as a PDF, and is accepted, so
the test failed. Updated the test to use a non-PDF file.

Also removed "before_validation" code in the
"student-applications/app/models/resume.rb" file, as the default
content type detector in Paperclip now performs a similar check
(see https://github.com/thoughtbot/paperclip/blob/v5.3.0/lib/paperclip/content_type_detector.rb).

https://issues.umd.edu/browse/LIBITD-1135
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants