Class: Brakeman::FindAllCalls
- Inherits:
-
BaseProcessor
- Object
- SexpProcessor
- BaseProcessor
- Brakeman::FindAllCalls
- Defined in:
- lib/brakeman/processors/lib/find_all_calls.rb
Constant Summary
Constant Summary
Constants included from Util
Util::ALL_PARAMETERS, Util::COOKIES, Util::PARAMETERS, Util::PATH_PARAMETERS, Util::QUERY_PARAMETERS, Util::REQUEST_PARAMETERS, Util::SESSION
Instance Attribute Summary (collapse)
-
- (Object) calls
readonly
Returns the value of attribute calls.
Attributes inherited from BaseProcessor
Instance Method Summary (collapse)
-
- (FindAllCalls) initialize(tracker)
constructor
A new instance of FindAllCalls.
-
- (Object) process_attrasgn(exp)
Process an assignment like a call.
- - (Object) process_call(exp)
-
- (Object) process_dxstr(exp)
Technically, " is call to Kernel#` But we just need them in the call cache for speed.
-
- (Object) process_methdef(exp)
Process body of method.
-
- (Object) process_render(exp)
Calls to render() are converted to s(:render, ...) but we would like them in the call cache still for speed.
-
- (Object) process_rlist(exp)
Process body of block.
-
- (Object) process_selfdef(exp)
Process body of method.
-
- (Object) process_source(exp, klass = nil, method = nil, template = nil)
Process the given source.
Methods inherited from BaseProcessor
#find_render_type, #make_render, #process_and, #process_arglist, #process_block, #process_default, #process_dstr, #process_evstr, #process_hash, #process_iasgn, #process_if, #process_ignore, #process_iter, #process_lasgn, #process_or, #process_scope
Methods included from Util
#array?, #call?, #camelize, #cookies?, #false?, #hash?, #hash_insert, #hash_iterate, #integer?, #number?, #params?, #pluralize, #regexp?, #result?, #set_env_defaults, #sexp?, #string?, #symbol?, #true?, #underscore
Methods included from ProcessorHelper
Constructor Details
- (FindAllCalls) initialize(tracker)
A new instance of FindAllCalls
6 7 8 9 10 11 12 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 6 def initialize tracker super @current_class = nil @current_method = nil @in_target = false @calls = [] end |
Instance Attribute Details
- (Object) calls (readonly)
Returns the value of attribute calls
4 5 6 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 4 def calls @calls end |
Instance Method Details
- (Object) process_attrasgn(exp)
Process an assignment like a call
105 106 107 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 105 def process_attrasgn exp process_call exp end |
- (Object) process_call(exp)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 42 def process_call exp target = get_target exp[1] if call? target already_in_target = @in_target @in_target = true process target @in_target = already_in_target end method = exp[2] process exp[3] call = { :target => target, :method => method, :call => exp, :nested => @in_target, :chain => get_chain(exp) } if @current_template call[:location] = [:template, @current_template] else call[:location] = [:class, @current_class, @current_method] end @calls << call exp end |
- (Object) process_dxstr(exp)
Technically, " is call to Kernel#` But we just need them in the call cache for speed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 88 def process_dxstr exp process exp[-1] if sexp? exp[-1] call = { :target => nil, :method => :`, :call => exp, :nested => false } if @current_template call[:location] = [:template, @current_template] else call[:location] = [:class, @current_class, @current_method] end @calls << call exp end |
- (Object) process_methdef(exp)
Process body of method
24 25 26 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 24 def process_methdef exp process exp[3] end |
- (Object) process_render(exp)
Calls to render() are converted to s(:render, ...) but we would like them in the call cache still for speed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 70 def process_render exp process exp[-1] if sexp? exp[-1] call = { :target => nil, :method => :render, :call => exp, :nested => false } if @current_template call[:location] = [:template, @current_template] else call[:location] = [:class, @current_class, @current_method] end @calls << call exp end |
- (Object) process_rlist(exp)
Process body of block
34 35 36 37 38 39 40 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 34 def process_rlist exp exp[1..-1].each do |e| process e end exp end |
- (Object) process_selfdef(exp)
Process body of method
29 30 31 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 29 def process_selfdef exp process exp[4] end |
- (Object) process_source(exp, klass = nil, method = nil, template = nil)
Process the given source. Provide either class and method being searched or the template. These names are used when reporting results.
16 17 18 19 20 21 |
# File 'lib/brakeman/processors/lib/find_all_calls.rb', line 16 def process_source exp, klass = nil, method = nil, template = nil @current_class = klass @current_method = method @current_template = template process exp end |