Class: Spektr::Checks::Evaluation
- Defined in:
- lib/spektr/checks/evaluation.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(app, target) ⇒ Evaluation
constructor
A new instance of Evaluation.
- #run ⇒ Object
Methods inherited from Base
#app_version_between?, #dupe?, #full_receiver, #model_attribute?, #receivers_for, #should_run?, #target_affected?, #user_input?, #version_affected, #version_between?, #warn!
Constructor Details
#initialize(app, target) ⇒ Evaluation
Returns a new instance of Evaluation.
4 5 6 7 8 9 |
# File 'lib/spektr/checks/evaluation.rb', line 4 def initialize(app, target) super @name = "Arbitrary code execution" @type = "Remote Code Execution" @targets = ["Spektr::Targets::Base", "Spektr::Targets::Model", "Spektr::Targets::Controller", "Spektr::Targets::Routes", "Spektr::Targets::View"] end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/spektr/checks/evaluation.rb', line 11 def run return unless super [:eval, :instance_eval, :class_eval, :module_eval].each do |name| @target.find_calls(name).each do |call| call.arguments.arguments.each do |argument| if user_input?(argument) warn! @target, self, call.location, "User input in eval" end end end end end |