Module: ImageProcessing
- Defined in:
- lib/image_processing.rb,
lib/image_processing/vips.rb,
lib/image_processing/builder.rb,
lib/image_processing/version.rb,
lib/image_processing/pipeline.rb,
lib/image_processing/chainable.rb,
lib/image_processing/processor.rb,
lib/image_processing/mini_magick.rb
Defined Under Namespace
Modules: Chainable, MiniMagick, Vips Classes: Builder, Pipeline, Processor
Constant Summary collapse
- Error =
Class.new(StandardError)
- UNSAFE_METHOD_OWNERS =
Method owners considered unsafe to dispatch to when a method name comes from user input, because they expose Ruby's metaprogramming and shell primitives (e.g. Kernel#send, Kernel#eval, BasicObject#instance_eval, Kernel#system). Any name whose implementation is inherited from one of these should never be treated as an image operation or a loader/saver option.
[BasicObject, Kernel, Object, Module].freeze
- VERSION =
"2.0.3"
Class Method Summary collapse
-
.unsafe_method?(receiver, name) ⇒ Boolean
Whether calling
nameonreceiverwould dispatch to an unsafe Ruby core method rather than a genuine operation.
Class Method Details
.unsafe_method?(receiver, name) ⇒ Boolean
Whether calling name on receiver would dispatch to an unsafe Ruby core
method rather than a genuine operation. Used as a single, shared guard at
every place where a user-provided name is dispatched via public_send.
21 22 23 24 25 26 27 |
# File 'lib/image_processing.rb', line 21 def self.unsafe_method?(receiver, name) UNSAFE_METHOD_OWNERS.include?(receiver.method(name.to_s).owner) rescue NameError # An unknown name is not a Ruby core method, so it is safe to forward to # the receiver (which will reject it if it is not a real operation). false end |