Class: Brakeman::ConfigAliasProcessor

Inherits:
AliasProcessor
  • Object
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)

Instance Method Summary collapse

Instance Method Details

#process_iter(exp) ⇒ Object

Look for a call to

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

and replace config with RAILS_CONFIG



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

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