carrierwave 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of carrierwave might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 815b971ebb21afd416f1de7f2d5d35a67c7231bf
4
- data.tar.gz: 59b36c18c02eefb0f81438b54200c5f857759589
3
+ metadata.gz: 53da23e707788e0f5ebe68c6d77bf5fbe8e0cff4
4
+ data.tar.gz: 6fb8dc63a96871a884fdf2b5931aadbe3b7c1766
5
5
  SHA512:
6
- metadata.gz: 40f40f2cdd4e0657843260e6830e39e87465fd3b9e881e2dc3f1298479272cb0accbf7a9d4262f1c8df5d7573de4e7c49776b484ec7ad84fa7ad01462455676f
7
- data.tar.gz: b967fe877468cb9c26bc7fdc7c861f37692ceaf2293457c3e4fe7f9faf773abda94243dceef9ef38c4fdad979853ecac47b22df0b36ae945af0dfb830bbdeed9
6
+ metadata.gz: 18558766d40c6d41d42a5aab1ab486998102c9bb00dba031f005c500f85e045315924614e8b2ca3169ba78ea5d9998263bf4c7832629e9f0dfd03c9e1670b64c
7
+ data.tar.gz: 20f9644c4157dec516f579c45380b98e3aaa5f9859af18a74cb2fc3970fe6fb57b55d5f1068e3eca465983df1dba471e2b8fb1fb852b1f8c01f37a2f731d3cab
data/README.md CHANGED
@@ -161,6 +161,22 @@ class MyUploader < CarrierWave::Uploader::Base
161
161
  end
162
162
  ```
163
163
 
164
+ ### CVE-2016-3714 (ImageTragick)
165
+ This version of CarrierWave has the ability to mitigate CVE-2016-3714. However, you **MUST** set a `content_type_whitelist` in your uploaders for this protection to be effective, and you **MUST** either disable ImageMagick's default SVG delegate or use the RSVG delegate for SVG processing.
166
+
167
+ A valid whitelist that will restrict your uploader to images only, and mitigate the CVE is:
168
+
169
+ ```ruby
170
+ class MyUploader < CarrierWave::Uploader::Base
171
+ def content_type_whitelist
172
+ [/image\//]
173
+ end
174
+ end
175
+ ```
176
+
177
+ **WARNING**: A `content_type_whitelist` is the only form of whitelist or blacklist supported by CarrierWave that can effectively mitigate against CVE-2016-3714. Use of `extension_type_whitelist` will not inspect the file headers, and thus still leaves your application open to the vulnerability.
178
+
179
+
164
180
  ### Filenames and unicode chars
165
181
 
166
182
  Another security issue you should care for is the file names (see
@@ -3,6 +3,7 @@
3
3
  require 'pathname'
4
4
  require 'active_support/core_ext/string/multibyte'
5
5
  require 'mime/types'
6
+ require 'mimemagic'
6
7
 
7
8
  module CarrierWave
8
9
 
@@ -244,12 +245,10 @@ module CarrierWave
244
245
  # [String] the content type of the file
245
246
  #
246
247
  def content_type
247
- return @content_type if @content_type
248
- if @file.respond_to?(:content_type) and @file.content_type
249
- @content_type = @file.content_type.to_s.chomp
250
- elsif path
251
- @content_type = ::MIME::Types.type_for(path).first.to_s
252
- end
248
+ @content_type ||=
249
+ existing_content_type ||
250
+ mime_magic_content_type ||
251
+ mime_types_content_type
253
252
  end
254
253
 
255
254
  ##
@@ -309,6 +308,22 @@ module CarrierWave
309
308
  return name.mb_chars.to_s
310
309
  end
311
310
 
311
+ def existing_content_type
312
+ if @file.respond_to?(:content_type) && @file.content_type
313
+ @file.content_type.to_s.chomp
314
+ end
315
+ end
316
+
317
+ def mime_magic_content_type
318
+ MimeMagic.by_magic(File.open(path)).try(:type) if path
319
+ rescue Errno::ENOENT
320
+ nil
321
+ end
322
+
323
+ def mime_types_content_type
324
+ ::MIME::Types.type_for(path).first.to_s if path
325
+ end
326
+
312
327
  def split_extension(filename)
313
328
  # regular expressions to try for identifying extensions
314
329
  extension_matchers = [
@@ -1,9 +1,11 @@
1
1
  require "carrierwave/storage/abstract"
2
2
  require "carrierwave/storage/file"
3
3
 
4
- begin
5
- require "fog"
6
- rescue LoadError
4
+ %w(aws google openstack rackspace).each do |fog_dependency|
5
+ begin
6
+ require "fog/#{fog_dependency}"
7
+ rescue LoadError
8
+ end
7
9
  end
8
10
 
9
11
  require "carrierwave/storage/fog" if defined?(Fog)
@@ -1,7 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require "fog"
4
-
5
3
  module CarrierWave
6
4
  module Storage
7
5
 
@@ -1,3 +1,3 @@
1
1
  module CarrierWave
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.16'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mimemagic
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.3.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.3.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: pg
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -332,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
346
  version: '0'
333
347
  requirements: []
334
348
  rubyforge_project: carrierwave
335
- rubygems_version: 2.4.3
349
+ rubygems_version: 2.4.5.1
336
350
  signing_key:
337
351
  specification_version: 3
338
352
  summary: Ruby file upload library