brakeman 1.8.3 → 1.9.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -27
- data/lib/brakeman.rb +36 -38
- data/lib/brakeman/app_tree.rb +90 -0
- data/lib/brakeman/call_index.rb +5 -38
- data/lib/brakeman/checks.rb +11 -11
- data/lib/brakeman/checks/base_check.rb +53 -29
- data/lib/brakeman/checks/check_cross_site_scripting.rb +11 -9
- data/lib/brakeman/checks/check_evaluation.rb +1 -1
- data/lib/brakeman/checks/check_execute.rb +3 -3
- data/lib/brakeman/checks/check_link_to.rb +15 -13
- data/lib/brakeman/checks/check_link_to_href.rb +1 -1
- data/lib/brakeman/checks/check_mail_to.rb +1 -1
- data/lib/brakeman/checks/check_mass_assignment.rb +27 -13
- data/lib/brakeman/checks/check_redirect.rb +4 -4
- data/lib/brakeman/checks/check_select_tag.rb +1 -1
- data/lib/brakeman/checks/check_select_vulnerability.rb +1 -1
- data/lib/brakeman/checks/check_send.rb +2 -2
- data/lib/brakeman/checks/check_session_settings.rb +12 -5
- data/lib/brakeman/checks/check_single_quotes.rb +3 -3
- data/lib/brakeman/checks/check_skip_before_filter.rb +4 -3
- data/lib/brakeman/checks/check_sql.rb +30 -30
- data/lib/brakeman/checks/check_translate_bug.rb +11 -10
- data/lib/brakeman/checks/check_validation_regex.rb +36 -11
- data/lib/brakeman/checks/check_without_protection.rb +1 -1
- data/lib/brakeman/options.rb +6 -2
- data/lib/brakeman/processor.rb +6 -5
- data/lib/brakeman/processors/alias_processor.rb +153 -38
- data/lib/brakeman/processors/base_processor.rb +16 -21
- data/lib/brakeman/processors/controller_alias_processor.rb +24 -11
- data/lib/brakeman/processors/controller_processor.rb +25 -25
- data/lib/brakeman/processors/erb_template_processor.rb +6 -7
- data/lib/brakeman/processors/erubis_template_processor.rb +2 -3
- data/lib/brakeman/processors/gem_processor.rb +5 -4
- data/lib/brakeman/processors/haml_template_processor.rb +4 -6
- data/lib/brakeman/processors/lib/find_all_calls.rb +3 -3
- data/lib/brakeman/processors/lib/find_call.rb +2 -2
- data/lib/brakeman/processors/lib/find_return_value.rb +134 -0
- data/lib/brakeman/processors/lib/processor_helper.rb +24 -2
- data/lib/brakeman/processors/lib/rails2_config_processor.rb +13 -14
- data/lib/brakeman/processors/lib/rails2_route_processor.rb +9 -4
- data/lib/brakeman/processors/lib/rails3_config_processor.rb +8 -8
- data/lib/brakeman/processors/lib/rails3_route_processor.rb +23 -21
- data/lib/brakeman/processors/lib/render_helper.rb +2 -2
- data/lib/brakeman/processors/library_processor.rb +2 -2
- data/lib/brakeman/processors/model_processor.rb +16 -12
- data/lib/brakeman/processors/output_processor.rb +2 -1
- data/lib/brakeman/processors/template_alias_processor.rb +12 -8
- data/lib/brakeman/report.rb +28 -14
- data/lib/brakeman/rescanner.rb +5 -5
- data/lib/brakeman/scanner.rb +56 -94
- data/lib/brakeman/templates/header.html.erb +7 -2
- data/lib/brakeman/tracker.rb +14 -4
- data/lib/brakeman/util.rb +38 -17
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning.rb +14 -6
- data/lib/ruby_parser/bm_sexp.rb +157 -57
- data/lib/ruby_parser/bm_sexp_processor.rb +1 -2
- metadata +26 -25
- data/lib/ruby_parser/ruby18_parser.rb +0 -5544
- data/lib/ruby_parser/ruby19_parser.rb +0 -5756
- data/lib/ruby_parser/ruby_lexer.rb +0 -1349
- data/lib/ruby_parser/ruby_parser.rb +0 -5
- data/lib/ruby_parser/ruby_parser_extras.rb +0 -1057
@@ -6,38 +6,31 @@ class Brakeman::BaseProcessor < Brakeman::SexpProcessor
|
|
6
6
|
include Brakeman::ProcessorHelper
|
7
7
|
include Brakeman::Util
|
8
8
|
|
9
|
-
|
9
|
+
IGNORE = Sexp.new :ignore
|
10
10
|
|
11
11
|
#Return a new Processor.
|
12
12
|
def initialize tracker
|
13
13
|
super()
|
14
14
|
@last = nil
|
15
15
|
@tracker = tracker
|
16
|
-
@ignore = Sexp.new :ignore
|
17
16
|
@current_template = @current_module = @current_class = @current_method = nil
|
18
17
|
end
|
19
18
|
|
19
|
+
def ignore
|
20
|
+
IGNORE
|
21
|
+
end
|
22
|
+
|
20
23
|
def process_class exp
|
21
24
|
current_class = @current_class
|
22
25
|
@current_class = class_name exp[1]
|
23
|
-
|
26
|
+
process_all exp.body
|
24
27
|
@current_class = current_class
|
25
28
|
exp
|
26
29
|
end
|
27
30
|
|
28
31
|
#Process a new scope. Removes expressions that are set to nil.
|
29
32
|
def process_scope exp
|
30
|
-
|
31
|
-
exp.shift
|
32
|
-
exp.map! do |e|
|
33
|
-
res = process e
|
34
|
-
if res.empty?
|
35
|
-
res = nil
|
36
|
-
else
|
37
|
-
res
|
38
|
-
end
|
39
|
-
end.compact
|
40
|
-
exp.unshift :scope
|
33
|
+
#NOPE?
|
41
34
|
end
|
42
35
|
|
43
36
|
#Default processing.
|
@@ -188,7 +181,7 @@ class Brakeman::BaseProcessor < Brakeman::SexpProcessor
|
|
188
181
|
|
189
182
|
#Generates :render node from call to render.
|
190
183
|
def make_render exp, in_view = false
|
191
|
-
render_type, value, rest = find_render_type exp
|
184
|
+
render_type, value, rest = find_render_type exp, in_view
|
192
185
|
rest = process rest
|
193
186
|
result = Sexp.new(:render, render_type, value, rest)
|
194
187
|
result.line(exp.line)
|
@@ -202,14 +195,14 @@ class Brakeman::BaseProcessor < Brakeman::SexpProcessor
|
|
202
195
|
#:template, :text, :update, :xml
|
203
196
|
#
|
204
197
|
#And also :layout for inside templates
|
205
|
-
def find_render_type
|
198
|
+
def find_render_type call, in_view = false
|
206
199
|
rest = Sexp.new(:hash)
|
207
200
|
type = nil
|
208
201
|
value = nil
|
209
|
-
first_arg =
|
202
|
+
first_arg = call.first_arg
|
210
203
|
|
211
|
-
if
|
212
|
-
return :update, nil, Sexp.new(:arglist, *args[0..-2]) #TODO HUH?
|
204
|
+
if call.second_arg.nil? and first_arg == Sexp.new(:lit, :update)
|
205
|
+
return :update, nil, Sexp.new(:arglist, *call.args[0..-2]) #TODO HUH?
|
213
206
|
end
|
214
207
|
|
215
208
|
#Look for render :action, ... or render "action", ...
|
@@ -238,10 +231,12 @@ class Brakeman::BaseProcessor < Brakeman::SexpProcessor
|
|
238
231
|
types_in_hash << :layout
|
239
232
|
end
|
240
233
|
|
234
|
+
last_arg = call.last_arg
|
235
|
+
|
241
236
|
#Look for "type" of render in options hash
|
242
237
|
#For example, render :file => "blah"
|
243
|
-
if hash?
|
244
|
-
hash_iterate(
|
238
|
+
if hash? last_arg
|
239
|
+
hash_iterate(last_arg) do |key, val|
|
245
240
|
if symbol? key and types_in_hash.include? key.value
|
246
241
|
type = key.value
|
247
242
|
value = val
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'brakeman/processors/alias_processor'
|
2
2
|
require 'brakeman/processors/lib/render_helper'
|
3
|
+
require 'brakeman/processors/lib/find_return_value'
|
3
4
|
|
4
5
|
#Processes aliasing in controllers, but includes following
|
5
6
|
#renders in routes and putting variables into templates
|
@@ -9,8 +10,9 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
|
|
9
10
|
#If only_method is specified, only that method will be processed,
|
10
11
|
#other methods will be skipped.
|
11
12
|
#This is for rescanning just a single action.
|
12
|
-
def initialize tracker, only_method = nil
|
13
|
+
def initialize app_tree, tracker, only_method = nil
|
13
14
|
super()
|
15
|
+
@app_tree = app_tree
|
14
16
|
@only_method = only_method
|
15
17
|
@tracker = tracker
|
16
18
|
@rendered = false
|
@@ -46,7 +48,7 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
|
|
46
48
|
methods.each do |name|
|
47
49
|
#Need to process the method like it was in a controller in order
|
48
50
|
#to get the renders set
|
49
|
-
processor = Brakeman::ControllerProcessor.new(@tracker)
|
51
|
+
processor = Brakeman::ControllerProcessor.new(@app_tree, @tracker)
|
50
52
|
method = mixin[:public][name]
|
51
53
|
|
52
54
|
if node_type? method, :methdef
|
@@ -97,7 +99,7 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
|
|
97
99
|
end
|
98
100
|
end
|
99
101
|
|
100
|
-
|
102
|
+
process_all exp.body
|
101
103
|
|
102
104
|
if is_route and not @rendered
|
103
105
|
process_default_render exp
|
@@ -111,10 +113,18 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
|
|
111
113
|
#Look for calls to head()
|
112
114
|
def process_call exp
|
113
115
|
exp = super
|
116
|
+
return exp unless call? exp
|
114
117
|
|
115
|
-
|
118
|
+
method = exp.method
|
119
|
+
|
120
|
+
if method == :head
|
116
121
|
@rendered = true
|
122
|
+
elsif @tracker.options[:interprocedural] and
|
123
|
+
@current_method and (exp.target.nil? or exp.target.node_type == :self)
|
124
|
+
|
125
|
+
exp = get_call_value(exp)
|
117
126
|
end
|
127
|
+
|
118
128
|
exp
|
119
129
|
end
|
120
130
|
|
@@ -132,7 +142,7 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
|
|
132
142
|
#Processes a call to a before filter.
|
133
143
|
#Basically, adds any instance variable assignments to the environment.
|
134
144
|
#TODO: method arguments?
|
135
|
-
def process_before_filter name
|
145
|
+
def process_before_filter name
|
136
146
|
filter = find_method name, @current_class
|
137
147
|
|
138
148
|
if filter.nil?
|
@@ -148,7 +158,7 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
|
|
148
158
|
end
|
149
159
|
else
|
150
160
|
processor = Brakeman::AliasProcessor.new @tracker
|
151
|
-
processor.process_safely(method.
|
161
|
+
processor.process_safely(method.body_list)
|
152
162
|
|
153
163
|
ivars = processor.only_ivars(:include_request_vars).all
|
154
164
|
|
@@ -200,9 +210,12 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
|
|
200
210
|
|
201
211
|
#Returns true if the given method name is also a route
|
202
212
|
def route? method
|
203
|
-
|
204
|
-
|
205
|
-
|
213
|
+
if @tracker.routes[:allow_all_actions] or @tracker.options[:assume_all_routes]
|
214
|
+
true
|
215
|
+
else
|
216
|
+
routes = @tracker.routes[@current_class]
|
217
|
+
routes and (routes == :allow_all_actions or routes.include? method)
|
218
|
+
end
|
206
219
|
end
|
207
220
|
|
208
221
|
#Get list of filters, including those that are inherited
|
@@ -236,9 +249,9 @@ class Brakeman::ControllerAliasProcessor < Brakeman::AliasProcessor
|
|
236
249
|
end
|
237
250
|
|
238
251
|
controller[:before_filter_cache].each do |f|
|
239
|
-
if f[:all] or
|
252
|
+
if f[:all] or
|
240
253
|
(f[:only] == method) or
|
241
|
-
(f[:only].is_a? Array and f[:only].include? method) or
|
254
|
+
(f[:only].is_a? Array and f[:only].include? method) or
|
242
255
|
(f[:except].is_a? Symbol and f[:except] != method) or
|
243
256
|
(f[:except].is_a? Array and not f[:except].include? method)
|
244
257
|
|
@@ -2,10 +2,11 @@ require 'brakeman/processors/base_processor'
|
|
2
2
|
|
3
3
|
#Processes controller. Results are put in tracker.controllers
|
4
4
|
class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
5
|
-
FORMAT_HTML = Sexp.new(:call, Sexp.new(:lvar, :format), :html
|
5
|
+
FORMAT_HTML = Sexp.new(:call, Sexp.new(:lvar, :format), :html)
|
6
6
|
|
7
|
-
def initialize tracker
|
8
|
-
super
|
7
|
+
def initialize app_tree, tracker
|
8
|
+
super(tracker)
|
9
|
+
@app_tree = app_tree
|
9
10
|
@controller = nil
|
10
11
|
@current_method = nil
|
11
12
|
@current_module = nil
|
@@ -49,7 +50,7 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
49
50
|
:src => exp,
|
50
51
|
:file => @file_name }
|
51
52
|
@tracker.controllers[@controller[:name]] = @controller
|
52
|
-
exp.body =
|
53
|
+
exp.body = process_all! exp.body
|
53
54
|
set_layout_name
|
54
55
|
@controller = nil
|
55
56
|
exp
|
@@ -63,12 +64,13 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
63
64
|
end
|
64
65
|
|
65
66
|
method = exp.method
|
66
|
-
|
67
|
+
first_arg = exp.first_arg
|
68
|
+
last_arg = exp.last_arg
|
67
69
|
|
68
70
|
#Methods called inside class definition
|
69
71
|
#like attr_* and other settings
|
70
72
|
if @current_method.nil? and target.nil? and @controller
|
71
|
-
if
|
73
|
+
if first_arg.nil? #No args
|
72
74
|
case method
|
73
75
|
when :private, :protected, :public
|
74
76
|
@visibility = method
|
@@ -80,21 +82,21 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
80
82
|
else
|
81
83
|
case method
|
82
84
|
when :include
|
83
|
-
@controller[:includes] << class_name(
|
85
|
+
@controller[:includes] << class_name(first_arg) if @controller
|
84
86
|
when :before_filter
|
85
87
|
@controller[:options][:before_filters] ||= []
|
86
|
-
@controller[:options][:before_filters] << args
|
88
|
+
@controller[:options][:before_filters] << exp.args
|
87
89
|
when :layout
|
88
|
-
if string?
|
90
|
+
if string? last_arg
|
89
91
|
#layout "some_layout"
|
90
92
|
|
91
|
-
name =
|
92
|
-
|
93
|
+
name = last_arg.value.to_s
|
94
|
+
if @app_tree.layout_exists?(name)
|
93
95
|
@controller[:layout] = "layouts/#{name}"
|
94
96
|
else
|
95
97
|
Brakeman.debug "[Notice] Layout not found: #{name}"
|
96
98
|
end
|
97
|
-
elsif node_type?
|
99
|
+
elsif node_type? last_arg, :nil, :false
|
98
100
|
#layout :false or layout nil
|
99
101
|
@controller[:layout] = false
|
100
102
|
end
|
@@ -107,7 +109,7 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
107
109
|
exp
|
108
110
|
elsif target == nil and method == :render
|
109
111
|
make_render exp
|
110
|
-
elsif exp == FORMAT_HTML and context[1] != :iter
|
112
|
+
elsif exp == FORMAT_HTML and context[1] != :iter
|
111
113
|
#This is an empty call to
|
112
114
|
# format.html
|
113
115
|
#Which renders the default template if no arguments
|
@@ -116,7 +118,7 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
116
118
|
call.line(exp.line)
|
117
119
|
call
|
118
120
|
else
|
119
|
-
call =
|
121
|
+
call = make_call target, method, process_all!(exp.args)
|
120
122
|
call.line(exp.line)
|
121
123
|
call
|
122
124
|
end
|
@@ -126,11 +128,10 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
126
128
|
def process_defn exp
|
127
129
|
name = exp.method_name
|
128
130
|
@current_method = name
|
129
|
-
res = Sexp.new :methdef, name,
|
131
|
+
res = Sexp.new :methdef, name, exp.formal_args, *process_all!(exp.body)
|
130
132
|
res.line(exp.line)
|
131
133
|
@current_method = nil
|
132
134
|
@controller[@visibility][name] = res unless @controller.nil?
|
133
|
-
|
134
135
|
res
|
135
136
|
end
|
136
137
|
|
@@ -151,7 +152,7 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
151
152
|
end
|
152
153
|
|
153
154
|
@current_method = name
|
154
|
-
res = Sexp.new :selfdef, target, name,
|
155
|
+
res = Sexp.new :selfdef, target, name, exp.formal_args, *process_all!(exp.body)
|
155
156
|
res.line(exp.line)
|
156
157
|
@current_method = nil
|
157
158
|
@controller[@visibility][name] = res unless @controller.nil?
|
@@ -175,7 +176,7 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
175
176
|
name = underscore(@controller[:name].to_s.split("::")[-1].gsub("Controller", ''))
|
176
177
|
|
177
178
|
#There is a layout for this Controller
|
178
|
-
|
179
|
+
if @app_tree.layout_exists?(name)
|
179
180
|
@controller[:layout] = "layouts/#{name}"
|
180
181
|
end
|
181
182
|
end
|
@@ -188,9 +189,9 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
188
189
|
filter_name = ("fake_filter" + rand.to_s[/\d+$/]).to_sym
|
189
190
|
args = exp.block_call.arglist
|
190
191
|
args.insert(1, Sexp.new(:lit, filter_name))
|
191
|
-
before_filter_call =
|
192
|
+
before_filter_call = make_call(nil, :before_filter, args)
|
192
193
|
|
193
|
-
if exp.block_args
|
194
|
+
if exp.block_args.length > 1
|
194
195
|
block_variable = exp.block_args[1]
|
195
196
|
else
|
196
197
|
block_variable = :temp
|
@@ -203,12 +204,11 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
203
204
|
end
|
204
205
|
|
205
206
|
#Build Sexp for filter method
|
206
|
-
body = Sexp.new(:
|
207
|
-
|
208
|
-
|
209
|
-
Sexp.new(:call, Sexp.new(:const, @controller[:name]), :new, Sexp.new(:arglist)))).concat(block_inner))
|
207
|
+
body = Sexp.new(:lasgn,
|
208
|
+
block_variable,
|
209
|
+
Sexp.new(:call, Sexp.new(:const, @controller[:name]), :new))
|
210
210
|
|
211
|
-
filter_method = Sexp.new(:defn, filter_name, Sexp.new(:args), body).line(exp.line)
|
211
|
+
filter_method = Sexp.new(:defn, filter_name, Sexp.new(:args), body).concat(block_inner).line(exp.line)
|
212
212
|
|
213
213
|
vis = @visibility
|
214
214
|
@visibility = :private
|
@@ -4,7 +4,7 @@ require 'brakeman/processors/template_processor'
|
|
4
4
|
#(those ending in .html.erb or .rthml).
|
5
5
|
class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
|
6
6
|
|
7
|
-
#s(:call, TARGET, :method,
|
7
|
+
#s(:call, TARGET, :method, ARGS)
|
8
8
|
def process_call exp
|
9
9
|
target = exp.target
|
10
10
|
if sexp? target
|
@@ -16,14 +16,14 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
|
|
16
16
|
if node_type? target, :lvar and target.value == :_erbout
|
17
17
|
if method == :concat
|
18
18
|
@inside_concat = true
|
19
|
-
|
19
|
+
exp.arglist = process(exp.arglist)
|
20
20
|
@inside_concat = false
|
21
21
|
|
22
|
-
if
|
22
|
+
if exp.second_arg
|
23
23
|
raise Exception.new("Did not expect more than a single argument to _erbout.concat")
|
24
24
|
end
|
25
25
|
|
26
|
-
arg =
|
26
|
+
arg = exp.first_arg
|
27
27
|
|
28
28
|
if arg.node_type == :call and arg.method == :to_s #erb always calls to_s on output
|
29
29
|
arg = arg.target
|
@@ -47,8 +47,7 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
|
|
47
47
|
make_render_in_view exp
|
48
48
|
else
|
49
49
|
#TODO: Is it really necessary to create a new Sexp here?
|
50
|
-
|
51
|
-
call = Sexp.new :call, target, method, args
|
50
|
+
call = make_call target, method, process_all!(exp.args)
|
52
51
|
call.original_line(exp.original_line)
|
53
52
|
call.line(exp.line)
|
54
53
|
call
|
@@ -64,7 +63,7 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
|
|
64
63
|
process e
|
65
64
|
end
|
66
65
|
@inside_concat = true
|
67
|
-
process exp
|
66
|
+
process exp.last
|
68
67
|
else
|
69
68
|
exp.map! do |e|
|
70
69
|
res = process e
|
@@ -3,7 +3,7 @@ require 'brakeman/processors/template_processor'
|
|
3
3
|
#Processes ERB templates using Erubis instead of erb.
|
4
4
|
class Brakeman::ErubisTemplateProcessor < Brakeman::TemplateProcessor
|
5
5
|
|
6
|
-
#s(:call, TARGET, :method,
|
6
|
+
#s(:call, TARGET, :method, ARGS)
|
7
7
|
def process_call exp
|
8
8
|
target = exp.target
|
9
9
|
if sexp? target
|
@@ -46,8 +46,7 @@ class Brakeman::ErubisTemplateProcessor < Brakeman::TemplateProcessor
|
|
46
46
|
make_render_in_view exp
|
47
47
|
else
|
48
48
|
#TODO: Is it really necessary to create a new Sexp here?
|
49
|
-
|
50
|
-
call = Sexp.new :call, target, method, args
|
49
|
+
call = make_call target, method, process_all!(exp.args)
|
51
50
|
call.original_line(exp.original_line)
|
52
51
|
call.line(exp.line)
|
53
52
|
call
|
@@ -27,12 +27,13 @@ class Brakeman::GemProcessor < Brakeman::BaseProcessor
|
|
27
27
|
|
28
28
|
def process_call exp
|
29
29
|
if exp.target == nil and exp.method == :gem
|
30
|
-
|
30
|
+
gem_name = exp.first_arg
|
31
|
+
gem_version = exp.second_arg
|
31
32
|
|
32
|
-
if string?
|
33
|
-
@tracker.config[:gems][
|
33
|
+
if string? gem_version
|
34
|
+
@tracker.config[:gems][gem_name.value.to_sym] = gem_version.value
|
34
35
|
else
|
35
|
-
@tracker.config[:gems][
|
36
|
+
@tracker.config[:gems][gem_name.value.to_sym] = ">=0.0.0"
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
@@ -36,14 +36,13 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
|
|
36
36
|
when :options, :buffer
|
37
37
|
exp
|
38
38
|
when :open_tag
|
39
|
-
|
40
|
-
exp
|
39
|
+
process_call_args exp
|
41
40
|
else
|
42
41
|
arg = exp.first_arg
|
43
42
|
|
44
43
|
if arg
|
45
44
|
@inside_concat = true
|
46
|
-
out = exp.
|
45
|
+
out = exp.first_arg = process(arg)
|
47
46
|
@inside_concat = false
|
48
47
|
else
|
49
48
|
raise Exception.new("Empty _hamlout.#{method}()?")
|
@@ -78,7 +77,7 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
|
|
78
77
|
#Has something to do with values of blocks?
|
79
78
|
elsif sexp? target and method == :<< and is_buffer_target? target
|
80
79
|
@inside_concat = true
|
81
|
-
out = exp.
|
80
|
+
out = exp.first_arg = process(exp.first_arg)
|
82
81
|
@inside_concat = false
|
83
82
|
|
84
83
|
if out.node_type == :str #ignore plain strings
|
@@ -95,8 +94,7 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
|
|
95
94
|
make_render_in_view exp
|
96
95
|
else
|
97
96
|
#TODO: Do we really need a new Sexp here?
|
98
|
-
|
99
|
-
call = Sexp.new :call, target, method, args
|
97
|
+
call = make_call target, method, process_all!(exp.args)
|
100
98
|
call.original_line(exp.original_line)
|
101
99
|
call.line(exp.line)
|
102
100
|
call
|
@@ -22,12 +22,12 @@ class Brakeman::FindAllCalls < Brakeman::BaseProcessor
|
|
22
22
|
|
23
23
|
#Process body of method
|
24
24
|
def process_methdef exp
|
25
|
-
|
25
|
+
process_all exp.body
|
26
26
|
end
|
27
27
|
|
28
28
|
#Process body of method
|
29
29
|
def process_selfdef exp
|
30
|
-
|
30
|
+
process_all exp.body
|
31
31
|
end
|
32
32
|
|
33
33
|
#Process body of block
|
@@ -46,7 +46,7 @@ class Brakeman::FindAllCalls < Brakeman::BaseProcessor
|
|
46
46
|
end
|
47
47
|
|
48
48
|
method = exp.method
|
49
|
-
|
49
|
+
process_call_args exp
|
50
50
|
|
51
51
|
call = { :target => target, :method => method, :call => exp, :nested => @in_target, :chain => get_chain(exp) }
|
52
52
|
|