Class: Brakeman::ConfigAliasProcessor

Inherits:
AliasProcessor show all
Defined in:
lib/brakeman/processors/lib/rails2_config_processor.rb

Overview

This is necessary to replace block variable so we can track config settings

Constant Summary collapse

RAILS_INIT =
Sexp.new(:colon2, Sexp.new(:const, :Rails), :Initializer)

Constants included from Util

Util::ALL_PARAMETERS, Util::COOKIES, Util::COOKIES_SEXP, Util::PARAMETERS, Util::PARAMS_SEXP, Util::PATH_PARAMETERS, Util::QUERY_PARAMETERS, Util::REQUEST_ENV, Util::REQUEST_PARAMETERS, Util::REQUEST_PARAMS, Util::SESSION, Util::SESSION_SEXP

Constants inherited from SexpProcessor

SexpProcessor::VERSION

Instance Attribute Summary

Attributes inherited from AliasProcessor

#result

Attributes inherited from SexpProcessor

#context, #env, #expected

Instance Method Summary collapse

Methods inherited from AliasProcessor

#assign_args, #collapse_send_call, #duplicate?, #find_method, #find_push_target, #get_call_value, #initialize, #join_arrays, #join_strings, #merge_if_branch, #meth_env, #only_ivars, #only_request_vars, #process_array_access, #process_attrasgn, #process_block, #process_call, #process_call_with_block, #process_cdecl, #process_cvdecl, #process_default, #process_gasgn, #process_hash_access, #process_hash_merge, #process_hash_merge!, #process_helper_method, #process_iasgn, #process_if, #process_if_branch, #process_lasgn, #process_masgn, #process_methdef, #process_op_asgn1, #process_op_asgn2, #process_or_simple_operation, #process_or_target, #process_safely, #process_scope, #process_selfdef, #process_svalue, #same_value?, #self_assign?, #self_assign_target?, #self_assign_var?, #set_value, #too_deep?, #top_target, #value_from_if

Methods included from Util

#array?, #block?, #call?, #camelize, #contains_class?, #context_for, #cookies?, #false?, #file_by_name, #file_for, #github_url, #hash?, #hash_access, #hash_insert, #hash_iterate, #integer?, #make_call, #node_type?, #number?, #params?, #pluralize, #regexp?, #relative_path, #request_env?, #request_value?, #result?, #set_env_defaults, #sexp?, #string?, #symbol?, #table_to_csv, #template_path_to_name, #true?, #truncate_table, #underscore

Methods included from ProcessorHelper

#class_name, #process_all, #process_all!, #process_call_args, #process_class, #process_module

Methods inherited from SexpProcessor

#error_handler, #in_context, #initialize, #process, #process_dummy, #scope

Constructor Details

This class inherits a constructor from Brakeman::AliasProcessor

Instance Method Details

#process_iter(exp) ⇒ Object

Look for a call to

Rails::Initializer.run do |config|
  ...
end

and replace config with RAILS_CONFIG


135
136
137
138
139
140
141
142
143
144
# File 'lib/brakeman/processors/lib/rails2_config_processor.rb', line 135

def process_iter exp
  target = exp.block_call.target
  method = exp.block_call.method

  if sexp? target and target == RAILS_INIT and method == :run
    env[Sexp.new(:lvar, exp.block_args.value)] = Brakeman::Rails2ConfigProcessor::RAILS_CONFIG
  end

  process_default exp
end