image_vise 0.0.21 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a79d07f95e9fcf0800a432a49420da6d856ee52
4
- data.tar.gz: 5bd849b46ac06048071bbad834e9bf2a396f902e
3
+ metadata.gz: fd846193c9dfec3d6a6489d87a2145eeb602a02c
4
+ data.tar.gz: 5d0cf54a6245a0c345517e9a5eca524f0621d6f0
5
5
  SHA512:
6
- metadata.gz: 8ab89461f69e6efb15e776f73dfcd1fc85346b8744cce1d0b9b2df28bd44cb75f0a23bb12e6be61394609cbe60354d64ad04b4124c941f1ac26770e5c5f5d684
7
- data.tar.gz: 24fd679469621e2c2e03c039e22185fde97e931bc2883a9c3dc8c5733e376363fa78c4ce21ed970559b6173efc492a821e7a266079ab7666bd359bb43c1ac7c2
6
+ metadata.gz: 7e818b5aa0a04154d248f94a29d95e923ca995cc009115004f86cbfb636136b5f88c9b94b9da568a623832bb1bc230b0cd35688bd67410e8237f512f75c912ba
7
+ data.tar.gz: c0a1e0fb980a1f2b92a5b337d4ccf9051ffc0d52358a14cc6e9ab7a46e28f1c32c35354621a54de2f1c1e780a7d843ce33ff6659acd4428c8b96d0959994dba0
data/image_vise.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: image_vise 0.0.21 ruby lib
5
+ # stub: image_vise 0.0.22 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "image_vise"
9
- s.version = "0.0.21"
9
+ s.version = "0.0.22"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -25,8 +25,9 @@ class ImageVise::ImageRequest < Ks.strict(:src_url, :pipeline)
25
25
 
26
26
  src_url = URI.parse(src_url)
27
27
  if src_url.scheme == 'file'
28
+ file_path = URI.decode(src_url.path)
28
29
  raise URLError, "#{src_url} not permitted since filesystem access is disabled" if allowed_filesystem_patterns.empty?
29
- raise URLError, "#{src_url} is not on the path whitelist" unless allowed_path?(allowed_filesystem_patterns, src_url.path)
30
+ raise URLError, "#{src_url} is not on the path whitelist" unless allowed_path?(allowed_filesystem_patterns, file_path)
30
31
  elsif src_url.scheme != 'file'
31
32
  raise URLError, "#{src_url} is not permitted as source" unless permitted_source_hosts.include?(src_url.host)
32
33
  end
@@ -55,7 +56,7 @@ class ImageVise::ImageRequest < Ks.strict(:src_url, :pipeline)
55
56
  private
56
57
 
57
58
  def self.allowed_path?(filesystem_glob_patterns, path_to_check)
58
- expanded_path = File.expand_path(path_to_check)
59
+ expanded_path = File.realpath(File.expand_path(path_to_check))
59
60
  filesystem_glob_patterns.any? {|pattern| File.fnmatch?(pattern, expanded_path) }
60
61
  end
61
62
 
@@ -234,7 +234,8 @@ class ImageVise::RenderEngine
234
234
 
235
235
  def copy_path_into_tempfile(path_on_filesystem)
236
236
  tf = binary_tempfile
237
- File.open(path_on_filesystem, 'rb') do |f|
237
+ real_path_on_filesystem = File.realpath(File.expand_path(path_on_filesystem))
238
+ File.open(real_path_on_filesystem, 'rb') do |f|
238
239
  IO.copy_stream(f, tf)
239
240
  end
240
241
  tf.rewind; tf
data/lib/image_vise.rb CHANGED
@@ -8,7 +8,7 @@ require 'base64'
8
8
  require 'rack'
9
9
 
10
10
  class ImageVise
11
- VERSION = '0.0.21'
11
+ VERSION = '0.0.22'
12
12
  S_MUTEX = Mutex.new
13
13
  private_constant :S_MUTEX
14
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_vise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov