lib/brakeman/processors/lib/rails2_config_processor.rb in brakeman-3.0.5 vs lib/brakeman/processors/lib/rails2_config_processor.rb in brakeman-3.1.0

- old
+ new

@@ -1,32 +1,31 @@ require 'brakeman/processors/lib/basic_processor' #Processes configuration. Results are put in tracker.config. # -#Configuration of Rails via Rails::Initializer are stored in tracker.config[:rails]. +#Configuration of Rails via Rails::Initializer are stored in tracker.config.rails. #For example: # # Rails::Initializer.run |config| # config.action_controller.session_store = :cookie_store # end # #will be stored in # # tracker.config[:rails][:action_controller][:session_store] # -#Values for tracker.config[:rails] will still be Sexps. +#Values for tracker.config.rails will still be Sexps. class Brakeman::Rails2ConfigProcessor < Brakeman::BasicProcessor #Replace block variable in # # Rails::Initializer.run |config| # #with this value so we can keep track of it. RAILS_CONFIG = Sexp.new(:const, :"!BRAKEMAN_RAILS_CONFIG") def initialize *args super - @tracker.config[:rails] ||= {} end #Use this method to process configuration file def process_config src res = Brakeman::ConfigAliasProcessor.new.process_safely(src) @@ -38,11 +37,11 @@ target = exp.target target = process target if sexp? target if exp.method == :gem and exp.first_arg.value == "erubis" Brakeman.notify "[Notice] Using Erubis for ERB templates" - @tracker.config[:erubis] = true + @tracker.config.erubis = true end exp end @@ -51,17 +50,17 @@ if exp.target == RAILS_CONFIG #Get rid of '=' at end attribute = exp.method.to_s[0..-2].to_sym if exp.args.length > 1 #Multiple arguments?...not sure if this will ever happen - @tracker.config[:rails][attribute] = exp.args + @tracker.config.rails[attribute] = exp.args else - @tracker.config[:rails][attribute] = exp.first_arg + @tracker.config.rails[attribute] = exp.first_arg end elsif include_rails_config? exp options = get_rails_config exp - level = @tracker.config[:rails] + level = @tracker.config.rails options[0..-2].each do |o| level[o] ||= {} level = level[o] end @@ -73,10 +72,10 @@ #Check for Rails version def process_cdecl exp #Set Rails version required if exp.lhs == :RAILS_GEM_VERSION - @tracker.config[:rails_version] = exp.rhs.value + @tracker.config.rails_version = exp.rhs.value end exp end