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::PARAMETERS, Util::PATH_PARAMETERS, Util::QUERY_PARAMETERS, Util::REQUEST_ENV, Util::REQUEST_PARAMETERS, Util::REQUEST_PARAMS, Util::SESSION

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

#duplicate?, #find_push_target, #initialize, #join_arrays, #join_strings, #only_ivars, #process_array_access, #process_attrasgn, #process_block, #process_call, #process_cdecl, #process_cvdecl, #process_default, #process_gasgn, #process_hash_access, #process_hash_merge, #process_hash_merge!, #process_iasgn, #process_if, #process_lasgn, #process_methdef, #process_op_asgn1, #process_op_asgn2, #process_safely, #process_scope, #process_selfdef, #process_svalue, #set_line

Methods included from Util

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

Methods included from ProcessorHelper

#class_name, #process_all, #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 Brakeman::RAILS_CONFIG



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

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


  if sexp? target and target == RAILS_INIT and method == :run
    exp.block_args.rhs = Brakeman::RAILS_CONFIG
  end

  process_default exp
end