dragonfly 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of dragonfly might be problematic. Click here for more details.
- data/History.md +8 -1
- data/README.md +1 -1
- data/VERSION +1 -1
- data/dragonfly.gemspec +2 -50
- data/extra_docs/Rails2.md +1 -1
- data/extra_docs/Rails3.md +1 -1
- data/lib/dragonfly/data_storage/file_data_store.rb +1 -1
- data/lib/dragonfly/simple_endpoint.rb +13 -0
- data/spec/dragonfly/simple_endpoint_spec.rb +8 -0
- metadata +4 -49
data/History.md
CHANGED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.5
|
data/dragonfly.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dragonfly}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mark Evans"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-05-11}
|
13
13
|
s.email = %q{mark@new-bamboo.co.uk}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -178,54 +178,6 @@ Gem::Specification.new do |s|
|
|
178
178
|
s.require_paths = ["lib"]
|
179
179
|
s.rubygems_version = %q{1.5.2}
|
180
180
|
s.summary = %q{Dragonfly is an on-the-fly Rack-based image handling framework. It is suitable for use with Rails, Sinatra and other web frameworks. Although it's mainly used for images, it can handle any content type.}
|
181
|
-
s.test_files = [
|
182
|
-
"spec/argument_matchers.rb",
|
183
|
-
"spec/dragonfly/active_model_extensions/active_model_setup.rb",
|
184
|
-
"spec/dragonfly/active_model_extensions/active_record_setup.rb",
|
185
|
-
"spec/dragonfly/active_model_extensions/model_spec.rb",
|
186
|
-
"spec/dragonfly/active_model_extensions/spec_helper.rb",
|
187
|
-
"spec/dragonfly/analyser_spec.rb",
|
188
|
-
"spec/dragonfly/analysis/file_command_analyser_spec.rb",
|
189
|
-
"spec/dragonfly/analysis/image_magick_analyser_spec.rb",
|
190
|
-
"spec/dragonfly/analysis/r_magick_analyser_spec.rb",
|
191
|
-
"spec/dragonfly/analysis/shared_analyser_spec.rb",
|
192
|
-
"spec/dragonfly/app_spec.rb",
|
193
|
-
"spec/dragonfly/config/r_magick_spec.rb",
|
194
|
-
"spec/dragonfly/configurable_spec.rb",
|
195
|
-
"spec/dragonfly/core_ext/array_spec.rb",
|
196
|
-
"spec/dragonfly/core_ext/hash_spec.rb",
|
197
|
-
"spec/dragonfly/core_ext/string_spec.rb",
|
198
|
-
"spec/dragonfly/core_ext/symbol_spec.rb",
|
199
|
-
"spec/dragonfly/data_storage/data_store_spec.rb",
|
200
|
-
"spec/dragonfly/data_storage/file_data_store_spec.rb",
|
201
|
-
"spec/dragonfly/data_storage/mongo_data_store_spec.rb",
|
202
|
-
"spec/dragonfly/data_storage/s3_data_store_spec.rb",
|
203
|
-
"spec/dragonfly/encoding/image_magick_encoder_spec.rb",
|
204
|
-
"spec/dragonfly/encoding/r_magick_encoder_spec.rb",
|
205
|
-
"spec/dragonfly/function_manager_spec.rb",
|
206
|
-
"spec/dragonfly/generation/hash_with_css_style_keys_spec.rb",
|
207
|
-
"spec/dragonfly/generation/image_magick_generator_spec.rb",
|
208
|
-
"spec/dragonfly/generation/r_magick_generator_spec.rb",
|
209
|
-
"spec/dragonfly/generation/shared_generator_spec.rb",
|
210
|
-
"spec/dragonfly/image_magick_utils_spec.rb",
|
211
|
-
"spec/dragonfly/job_builder_spec.rb",
|
212
|
-
"spec/dragonfly/job_definitions_spec.rb",
|
213
|
-
"spec/dragonfly/job_endpoint_spec.rb",
|
214
|
-
"spec/dragonfly/job_spec.rb",
|
215
|
-
"spec/dragonfly/loggable_spec.rb",
|
216
|
-
"spec/dragonfly/middleware_spec.rb",
|
217
|
-
"spec/dragonfly/processing/image_magick_processor_spec.rb",
|
218
|
-
"spec/dragonfly/processing/r_magick_processor_spec.rb",
|
219
|
-
"spec/dragonfly/processing/shared_processing_spec.rb",
|
220
|
-
"spec/dragonfly/routed_endpoint_spec.rb",
|
221
|
-
"spec/dragonfly/serializer_spec.rb",
|
222
|
-
"spec/dragonfly/simple_cache_spec.rb",
|
223
|
-
"spec/dragonfly/simple_endpoint_spec.rb",
|
224
|
-
"spec/dragonfly/temp_object_spec.rb",
|
225
|
-
"spec/image_matchers.rb",
|
226
|
-
"spec/simple_matchers.rb",
|
227
|
-
"spec/spec_helper.rb"
|
228
|
-
]
|
229
181
|
|
230
182
|
if s.respond_to? :specification_version then
|
231
183
|
s.specification_version = 3
|
data/extra_docs/Rails2.md
CHANGED
data/extra_docs/Rails3.md
CHANGED
@@ -114,7 +114,7 @@ module Dragonfly
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def validate_uid!(uid)
|
117
|
-
raise BadUID, "tried to fetch uid #{uid.inspect} - perhaps due to a malicious user" if uid['
|
117
|
+
raise BadUID, "tried to fetch uid #{uid.inspect} - perhaps due to a malicious user" if uid['../']
|
118
118
|
end
|
119
119
|
|
120
120
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module Dragonfly
|
2
2
|
class SimpleEndpoint
|
3
3
|
|
4
|
+
# Exceptions
|
5
|
+
class JobNotAllowed < RuntimeError; end
|
6
|
+
|
4
7
|
include Loggable
|
5
8
|
|
6
9
|
# Instance methods
|
@@ -18,6 +21,7 @@ module Dragonfly
|
|
18
21
|
dragonfly_response
|
19
22
|
else
|
20
23
|
job = Job.from_path(request.path_info, app)
|
24
|
+
validate_job!(job)
|
21
25
|
job.validate_sha!(request['s']) if app.protect_from_dos_attacks
|
22
26
|
Response.new(job, env).to_response
|
23
27
|
end
|
@@ -28,6 +32,9 @@ module Dragonfly
|
|
28
32
|
[400, {"Content-Type" => 'text/plain'}, ["You need to give a SHA parameter"]]
|
29
33
|
rescue Job::IncorrectSHA => e
|
30
34
|
[400, {"Content-Type" => 'text/plain'}, ["The SHA parameter you gave (#{e}) is incorrect"]]
|
35
|
+
rescue JobNotAllowed => e
|
36
|
+
log.warn(e.message)
|
37
|
+
[403, {"Content-Type" => 'text/plain'}, ["Forbidden"]]
|
31
38
|
end
|
32
39
|
|
33
40
|
def required_params_for(job)
|
@@ -58,6 +65,12 @@ module Dragonfly
|
|
58
65
|
[body]
|
59
66
|
]
|
60
67
|
end
|
68
|
+
|
69
|
+
def validate_job!(job)
|
70
|
+
if job.fetch_file_step
|
71
|
+
raise JobNotAllowed, "Dragonfly Server doesn't allow requesting job with steps #{job.steps.inspect}"
|
72
|
+
end
|
73
|
+
end
|
61
74
|
|
62
75
|
end
|
63
76
|
end
|
@@ -56,6 +56,14 @@ describe Dragonfly::SimpleEndpoint do
|
|
56
56
|
response.content_type.should == 'text/plain'
|
57
57
|
end
|
58
58
|
|
59
|
+
it "should return a 403 forbidden when fetch_file is requested" do
|
60
|
+
url = @app.fetch_file('/some/file.txt').url
|
61
|
+
response = request(@endpoint, url)
|
62
|
+
response.status.should == 403
|
63
|
+
response.body.should == 'Forbidden'
|
64
|
+
response.content_type.should == 'text/plain'
|
65
|
+
end
|
66
|
+
|
59
67
|
it "should still work when mapped to a prefix" do
|
60
68
|
endpoint = @endpoint
|
61
69
|
rack_app = Rack::Builder.new do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: dragonfly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.8.
|
5
|
+
version: 0.8.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mark Evans
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-11 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -417,50 +417,5 @@ rubygems_version: 1.5.2
|
|
417
417
|
signing_key:
|
418
418
|
specification_version: 3
|
419
419
|
summary: Dragonfly is an on-the-fly Rack-based image handling framework. It is suitable for use with Rails, Sinatra and other web frameworks. Although it's mainly used for images, it can handle any content type.
|
420
|
-
test_files:
|
421
|
-
|
422
|
-
- spec/dragonfly/active_model_extensions/active_model_setup.rb
|
423
|
-
- spec/dragonfly/active_model_extensions/active_record_setup.rb
|
424
|
-
- spec/dragonfly/active_model_extensions/model_spec.rb
|
425
|
-
- spec/dragonfly/active_model_extensions/spec_helper.rb
|
426
|
-
- spec/dragonfly/analyser_spec.rb
|
427
|
-
- spec/dragonfly/analysis/file_command_analyser_spec.rb
|
428
|
-
- spec/dragonfly/analysis/image_magick_analyser_spec.rb
|
429
|
-
- spec/dragonfly/analysis/r_magick_analyser_spec.rb
|
430
|
-
- spec/dragonfly/analysis/shared_analyser_spec.rb
|
431
|
-
- spec/dragonfly/app_spec.rb
|
432
|
-
- spec/dragonfly/config/r_magick_spec.rb
|
433
|
-
- spec/dragonfly/configurable_spec.rb
|
434
|
-
- spec/dragonfly/core_ext/array_spec.rb
|
435
|
-
- spec/dragonfly/core_ext/hash_spec.rb
|
436
|
-
- spec/dragonfly/core_ext/string_spec.rb
|
437
|
-
- spec/dragonfly/core_ext/symbol_spec.rb
|
438
|
-
- spec/dragonfly/data_storage/data_store_spec.rb
|
439
|
-
- spec/dragonfly/data_storage/file_data_store_spec.rb
|
440
|
-
- spec/dragonfly/data_storage/mongo_data_store_spec.rb
|
441
|
-
- spec/dragonfly/data_storage/s3_data_store_spec.rb
|
442
|
-
- spec/dragonfly/encoding/image_magick_encoder_spec.rb
|
443
|
-
- spec/dragonfly/encoding/r_magick_encoder_spec.rb
|
444
|
-
- spec/dragonfly/function_manager_spec.rb
|
445
|
-
- spec/dragonfly/generation/hash_with_css_style_keys_spec.rb
|
446
|
-
- spec/dragonfly/generation/image_magick_generator_spec.rb
|
447
|
-
- spec/dragonfly/generation/r_magick_generator_spec.rb
|
448
|
-
- spec/dragonfly/generation/shared_generator_spec.rb
|
449
|
-
- spec/dragonfly/image_magick_utils_spec.rb
|
450
|
-
- spec/dragonfly/job_builder_spec.rb
|
451
|
-
- spec/dragonfly/job_definitions_spec.rb
|
452
|
-
- spec/dragonfly/job_endpoint_spec.rb
|
453
|
-
- spec/dragonfly/job_spec.rb
|
454
|
-
- spec/dragonfly/loggable_spec.rb
|
455
|
-
- spec/dragonfly/middleware_spec.rb
|
456
|
-
- spec/dragonfly/processing/image_magick_processor_spec.rb
|
457
|
-
- spec/dragonfly/processing/r_magick_processor_spec.rb
|
458
|
-
- spec/dragonfly/processing/shared_processing_spec.rb
|
459
|
-
- spec/dragonfly/routed_endpoint_spec.rb
|
460
|
-
- spec/dragonfly/serializer_spec.rb
|
461
|
-
- spec/dragonfly/simple_cache_spec.rb
|
462
|
-
- spec/dragonfly/simple_endpoint_spec.rb
|
463
|
-
- spec/dragonfly/temp_object_spec.rb
|
464
|
-
- spec/image_matchers.rb
|
465
|
-
- spec/simple_matchers.rb
|
466
|
-
- spec/spec_helper.rb
|
420
|
+
test_files: []
|
421
|
+
|