Sha256: cdea21a061f4bb68b055923bfb228e16f0de508f902802809e86a4f8da4825cb
Contents?: true
Size: 952 Bytes
Versions: 24
Compression:
Stored size: 952 Bytes
Contents
require 'brakeman/checks/base_check' #This check looks for calls to +eval+, +instance_eval+, etc. which include #user input. class Brakeman::CheckEvaluation < Brakeman::BaseCheck Brakeman::Checks.add self @description = "Searches for evaluation of user input" #Process calls def run_check Brakeman.debug "Finding eval-like calls" calls = tracker.find_call methods: [:eval, :instance_eval, :class_eval, :module_eval], nested: true Brakeman.debug "Processing eval-like calls" calls.each do |call| process_result call end end #Warns if eval includes user input def process_result result return unless original? result if input = include_user_input?(result[:call].arglist) warn :result => result, :warning_type => "Dangerous Eval", :warning_code => :code_eval, :message => "User input in eval", :user_input => input, :confidence => :high end end end
Version data entries
24 entries across 24 versions & 3 rubygems