brakeman-min 3.3.0 → 3.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfbe9bf6ab37921809b33145342e4bcd6df55e8e
4
- data.tar.gz: 62f41f3c6a63e4f1b9c662b28779cb821d60a7b9
3
+ metadata.gz: 0908b7c2b06cb913a06b7857e223ae7845c48036
4
+ data.tar.gz: 8b162cfe56b7acd0f4717d524c6e7ee1e5b8b516
5
5
  SHA512:
6
- metadata.gz: 3724d2c9aad208a2c5197decc4e72e46e9306a7745aaecdd6326bb8357367941b6f14586163bab5e299928cec1acb1d4f994f884441b78f521580cc0b26cbbcf
7
- data.tar.gz: 26f0ab2c6871b2a304773c7d93c1b25e2958adef16f97d96257a39ba8cf1c085c1451e5180754e2ae18f197b7b5efc2370e081bd21ec6cb2ab17bb9bc554321d
6
+ metadata.gz: 75ee0836a37948d3f4a8c6e0a639cbe20bd950897440de02375121133ae81f0f708bf92202a85540d068f3c04510a92a95a92155fe6e4bffc851b79cfd44c9fc
7
+ data.tar.gz: 97275a73c3804586be1c676584a8367403dca3ef043c8a1ec8064925a21cc28089aca9c44af1c51ac0eb8aa1b539a67303dda25862994749659939682e3587cf
data/CHANGES CHANGED
@@ -1,3 +1,14 @@
1
+ # 3.3.1
2
+
3
+ * Delay loading vendored gems and modifying load path
4
+ * Avoid warning about SQL injection with `quoted_primary_key`
5
+ * Support more safe `&.` operations
6
+ * Allow multile line regex in `validates_format_of` (Dmitrij Fedorenko)
7
+ * Only consider `if` branches in templates
8
+ * Avoid overwriting instance/class methods with same name (Tim Wade)
9
+ * Add `--force-scan` option (Neil Matatall)
10
+ * Improved line number accuracy in ERB templates (Patrick Toomey)
11
+
1
12
  # 3.3.0
2
13
 
3
14
  * Skip processing obviously false if branches (more broadly)
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Brakeman Logo](http://brakemanscanner.org/images/logo_medium.png)](http://brakemanscanner.org/)
2
+ [![Brakeman Pro Logo](https://brakemanpro.com/images/bmp_square_white.png)](https://brakemanpro.com)
2
3
 
3
4
  [![Build Status](https://travis-ci.org/presidentbeef/brakeman.svg?branch=master)](https://travis-ci.org/presidentbeef/brakeman)
4
5
  [![Code Climate](https://codeclimate.com/github/presidentbeef/brakeman/badges/gpa.svg)](https://codeclimate.com/github/presidentbeef/brakeman)
@@ -159,9 +160,9 @@ For even more continuous testing, try the [Guard plugin](https://github.com/guar
159
160
 
160
161
  Website: http://brakemanscanner.org/
161
162
 
162
- Twitter: http://twitter.com/brakeman
163
+ Twitter: https://twitter.com/brakeman
163
164
 
164
- Mailing list: brakeman@librelist.com
165
+ Chat: https://gitter.im/presidentbeef/brakeman
165
166
 
166
167
  # License
167
168
 
@@ -1,11 +1,5 @@
1
1
  require 'set'
2
2
 
3
- path_load = "#{File.expand_path(File.dirname(__FILE__))}/../bundle/load.rb"
4
-
5
- if File.exist? path_load
6
- require path_load
7
- end
8
-
9
3
  module Brakeman
10
4
 
11
5
  #This exit code is used when warnings are found and the --exit-on-warn
@@ -18,6 +12,7 @@ module Brakeman
18
12
  @debug = false
19
13
  @quiet = false
20
14
  @loaded_dependencies = []
15
+ @vendored_paths = false
21
16
 
22
17
  #Run Brakeman scan. Returns Tracker object.
23
18
  #
@@ -101,7 +96,7 @@ module Brakeman
101
96
  #Load configuration file
102
97
  if config = config_file(custom_location, app_path)
103
98
  require 'date' # https://github.com/dtao/safe_yaml/issues/80
104
- require 'safe_yaml/load'
99
+ self.load_brakeman_dependency 'safe_yaml/load'
105
100
  options = SafeYAML.load_file config, :deserialize_symbols => true
106
101
 
107
102
  if options
@@ -167,7 +162,7 @@ module Brakeman
167
162
  get_formats_from_output_files options[:output_files]
168
163
  else
169
164
  begin
170
- require 'terminal-table'
165
+ self.load_brakeman_dependency 'terminal-table', :allow_fail
171
166
  return [:to_s]
172
167
  rescue LoadError
173
168
  return [:to_json]
@@ -433,15 +428,29 @@ module Brakeman
433
428
  Brakeman::Differ.new(new_results, previous_results).diff
434
429
  end
435
430
 
436
- def self.load_brakeman_dependency name
431
+ def self.load_brakeman_dependency name, allow_fail = false
437
432
  return if @loaded_dependencies.include? name
438
433
 
434
+ unless @vendored_paths
435
+ path_load = "#{File.expand_path(File.dirname(__FILE__))}/../bundle/load.rb"
436
+
437
+ if File.exist? path_load
438
+ require path_load
439
+ end
440
+
441
+ @vendored_paths = true
442
+ end
443
+
439
444
  begin
440
445
  require name
441
446
  rescue LoadError => e
442
- $stderr.puts e.message
443
- $stderr.puts "Please install the appropriate dependency: #{name}."
444
- exit!(-1)
447
+ if allow_fail
448
+ raise e
449
+ else
450
+ $stderr.puts e.message
451
+ $stderr.puts "Please install the appropriate dependency: #{name}."
452
+ exit!(-1)
453
+ end
445
454
  end
446
455
  end
447
456
 
@@ -545,9 +545,9 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
545
545
  string_building? exp.first_arg
546
546
  end
547
547
 
548
- IGNORE_METHODS_IN_SQL = Set[:id, :merge_conditions, :table_name, :quoted_table_name, :to_i, :to_f,
549
- :sanitize_sql, :sanitize_sql_array, :sanitize_sql_for_assignment,
550
- :sanitize_sql_for_conditions, :sanitize_sql_hash,
548
+ IGNORE_METHODS_IN_SQL = Set[:id, :merge_conditions, :table_name, :quoted_table_name,
549
+ :quoted_primary_key, :to_i, :to_f, :sanitize_sql, :sanitize_sql_array,
550
+ :sanitize_sql_for_assignment, :sanitize_sql_for_conditions, :sanitize_sql_hash,
551
551
  :sanitize_sql_hash_for_assignment, :sanitize_sql_hash_for_conditions,
552
552
  :to_sql, :sanitize, :primary_key, :table_name_prefix, :table_name_suffix]
553
553
 
@@ -59,17 +59,37 @@ class Brakeman::CheckValidationRegex < Brakeman::BaseCheck
59
59
  end
60
60
  end
61
61
 
62
+ # Match secure regexp without extended option
63
+ SECURE_REGEXP_PATTERN = %r{
64
+ \A
65
+ \\A
66
+ .*
67
+ \\[zZ]
68
+ \z
69
+ }x
70
+
71
+ # Match secure of regexp with extended option
72
+ EXTENDED_SECURE_REGEXP_PATTERN = %r{
73
+ \A
74
+ \s*
75
+ \\A
76
+ .*
77
+ \\[zZ]
78
+ \s*
79
+ \z
80
+ }mx
81
+
62
82
  #Issue warning if the regular expression does not use
63
83
  #+\A+ and +\z+
64
84
  def check_regex value, validator
65
85
  return unless regexp? value
66
86
 
67
- regex = value.value.inspect
68
- unless regex =~ /\A\/\\A.*\\(z|Z)\/(m|i|x|n|e|u|s|o)*\z/
87
+ regex = value.value
88
+ unless secure_regex?(regex)
69
89
  warn :model => @current_model,
70
90
  :warning_type => "Format Validation",
71
91
  :warning_code => :validation_regex,
72
- :message => "Insufficient validation for '#{get_name validator}' using #{regex}. Use \\A and \\z as anchors",
92
+ :message => "Insufficient validation for '#{get_name validator}' using #{regex.inspect}. Use \\A and \\z as anchors",
73
93
  :line => value.line,
74
94
  :confidence => CONFIDENCE[:high]
75
95
  end
@@ -85,4 +105,12 @@ class Brakeman::CheckValidationRegex < Brakeman::BaseCheck
85
105
  name
86
106
  end
87
107
  end
108
+
109
+ private
110
+
111
+ def secure_regex?(regex)
112
+ extended_regex = Regexp::EXTENDED == regex.options & Regexp::EXTENDED
113
+ regex_pattern = extended_regex ? EXTENDED_SECURE_REGEXP_PATTERN : SECURE_REGEXP_PATTERN
114
+ regex_pattern =~ regex.source
115
+ end
88
116
  end
@@ -276,6 +276,10 @@ module Brakeman::Options
276
276
  options[:show_version] = true
277
277
  end
278
278
 
279
+ opts.on "--force-scan", "Scan application even if rails is not detected" do
280
+ options[:force_scan] = true
281
+ end
282
+
279
283
  opts.on_tail "-h", "--help", "Display this message" do
280
284
  options[:show_help] = true
281
285
  end
@@ -1,54 +1,74 @@
1
1
  Brakeman.load_brakeman_dependency 'erubis'
2
2
 
3
- #This is from Rails 3 version of the Erubis handler
3
+ # This is from Rails 5 version of the Erubis handler
4
+ # https://github.com/rails/rails/blob/ec608107801b1e505db03ba76bae4a326a5804ca/actionview/lib/action_view/template/handlers/erb.rb#L7-L73
4
5
  class Brakeman::Rails3Erubis < ::Erubis::Eruby
5
6
 
6
7
  def add_preamble(src)
7
- # src << "_buf = ActionView::SafeBuffer.new;\n"
8
+ @newline_pending = 0
9
+ src << "@output_buffer = output_buffer || ActionView::OutputBuffer.new;"
8
10
  end
9
11
 
10
- #This is different from Rails 3 - fixes some line number issues
11
12
  def add_text(src, text)
13
+ return if text.empty?
14
+
12
15
  if text == "\n"
13
- src << "\n"
14
- elsif text.include? "\n"
15
- lines = text.split("\n")
16
- if text.match(/\n\z/)
17
- lines.each do |line|
18
- src << "@output_buffer << ('" << escape_text(line) << "'.html_safe!);\n"
19
- end
20
- else
21
- lines[0..-2].each do |line|
22
- src << "@output_buffer << ('" << escape_text(line) << "'.html_safe!);\n"
23
- end
24
-
25
- src << "@output_buffer << ('" << escape_text(lines.last) << "'.html_safe!);"
26
- end
16
+ @newline_pending += 1
17
+ else
18
+ src << "@output_buffer.safe_append='"
19
+ src << "\n" * @newline_pending if @newline_pending > 0
20
+ src << escape_text(text)
21
+ src << "'.freeze;"
22
+
23
+ @newline_pending = 0
24
+ end
25
+ end
26
+
27
+ # Erubis toggles <%= and <%== behavior when escaping is enabled.
28
+ # We override to always treat <%== as escaped.
29
+ def add_expr(src, code, indicator)
30
+ case indicator
31
+ when '=='
32
+ add_expr_escaped(src, code)
27
33
  else
28
- src << "@output_buffer << ('" << escape_text(text) << "'.html_safe!);"
34
+ super
29
35
  end
30
36
  end
31
37
 
32
38
  BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/
33
39
 
34
40
  def add_expr_literal(src, code)
41
+ flush_newline_if_pending(src)
35
42
  if code =~ BLOCK_EXPR
36
43
  src << '@output_buffer.append= ' << code
37
44
  else
38
- src << '@output_buffer.append= (' << code << ');'
45
+ src << '@output_buffer.append=(' << code << ');'
39
46
  end
40
47
  end
41
48
 
42
49
  def add_expr_escaped(src, code)
50
+ flush_newline_if_pending(src)
43
51
  if code =~ BLOCK_EXPR
44
- src << "@output_buffer.safe_append= " << code
52
+ src << "@output_buffer.safe_expr_append= " << code
45
53
  else
46
- src << "@output_buffer.safe_append= (" << code << ");"
54
+ src << "@output_buffer.safe_expr_append=(" << code << ");"
47
55
  end
48
56
  end
49
57
 
50
- #Add code to output buffer.
58
+ def add_stmt(src, code)
59
+ flush_newline_if_pending(src)
60
+ super
61
+ end
62
+
51
63
  def add_postamble(src)
52
- # src << '_buf.to_s'
64
+ flush_newline_if_pending(src)
65
+ src << '@output_buffer.to_s'
66
+ end
67
+
68
+ def flush_newline_if_pending(src)
69
+ if @newline_pending > 0
70
+ src << "@output_buffer.safe_append='#{"\n" * @newline_pending}'.freeze;"
71
+ @newline_pending = 0
72
+ end
53
73
  end
54
74
  end
@@ -1,12 +1,14 @@
1
1
  require 'brakeman/util'
2
2
  require 'ruby_parser/bm_sexp_processor'
3
3
  require 'brakeman/processors/lib/processor_helper'
4
+ require 'brakeman/processors/lib/safe_call_helper'
4
5
 
5
6
  #Returns an s-expression with aliases replaced with their value.
6
7
  #This does not preserve semantics (due to side effects, etc.), but it makes
7
8
  #processing easier when searching for various things.
8
9
  class Brakeman::AliasProcessor < Brakeman::SexpProcessor
9
10
  include Brakeman::ProcessorHelper
11
+ include Brakeman::SafeCallHelper
10
12
  include Brakeman::Util
11
13
 
12
14
  attr_reader :result, :tracker
@@ -94,6 +96,9 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
94
96
  return exp if process_call_defn? exp
95
97
  target_var = exp.target
96
98
  target_var &&= target_var.deep_clone
99
+ if exp.node_type == :safe_call
100
+ exp.node_type = :call
101
+ end
97
102
  exp = process_default exp
98
103
 
99
104
  #In case it is replaced with something else
@@ -1,9 +1,11 @@
1
1
  require 'brakeman/processors/lib/processor_helper'
2
+ require 'brakeman/processors/lib/safe_call_helper'
2
3
  require 'brakeman/util'
3
4
 
4
5
  #Base processor for most processors.
5
6
  class Brakeman::BaseProcessor < Brakeman::SexpProcessor
6
7
  include Brakeman::ProcessorHelper
8
+ include Brakeman::SafeCallHelper
7
9
  include Brakeman::Util
8
10
 
9
11
  IGNORE = Sexp.new :ignore
@@ -83,14 +85,6 @@ class Brakeman::BaseProcessor < Brakeman::SexpProcessor
83
85
  call
84
86
  end
85
87
 
86
- def process_safe_call exp
87
- if self.respond_to? :process_call
88
- process_call exp
89
- else
90
- process_default exp
91
- end
92
- end
93
-
94
88
  #String with interpolation.
95
89
  def process_dstr exp
96
90
  exp = exp.dup
@@ -23,11 +23,7 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
23
23
  raise "Did not expect more than a single argument to _erbout.concat"
24
24
  end
25
25
 
26
- arg = exp.first_arg
27
-
28
- if call? arg and arg.method == :to_s #erb always calls to_s on output
29
- arg = arg.target
30
- end
26
+ arg = normalize_output(exp.first_arg)
31
27
 
32
28
  if arg.node_type == :str #ignore plain strings
33
29
  ignore
@@ -2,7 +2,7 @@ require 'brakeman/processors/template_processor'
2
2
 
3
3
  #Processes ERB templates using Erubis instead of erb.
4
4
  class Brakeman::ErubisTemplateProcessor < Brakeman::TemplateProcessor
5
-
5
+
6
6
  #s(:call, TARGET, :method, ARGS)
7
7
  def process_call exp
8
8
  target = exp.target
@@ -18,12 +18,7 @@ class Brakeman::ErubisTemplateProcessor < Brakeman::TemplateProcessor
18
18
  if node_type?(target, :lvar, :ivar) and (target.value == :_buf or target.value == :@output_buffer)
19
19
  if method == :<< or method == :safe_concat
20
20
 
21
- arg = exp.first_arg
22
-
23
- #We want the actual content
24
- if call? arg and (arg.method == :to_s or arg.method == :html_safe!)
25
- arg = arg.target
26
- end
21
+ arg = normalize_output(exp.first_arg)
27
22
 
28
23
  if arg.node_type == :str #ignore plain strings
29
24
  ignore
@@ -70,14 +65,16 @@ class Brakeman::ErubisTemplateProcessor < Brakeman::TemplateProcessor
70
65
  #Look for assignments to output buffer that look like this:
71
66
  # @output_buffer.append = some_output
72
67
  # @output_buffer.safe_append = some_output
68
+ # @output_buffer.safe_expr_append = some_output
73
69
  def process_attrasgn exp
74
70
  if exp.target.node_type == :ivar and exp.target.value == :@output_buffer
75
- if exp.method == :append= or exp.method == :safe_append=
76
- arg = exp.first_arg = process(exp.first_arg)
71
+ if append_method?(exp.method)
72
+ exp.first_arg = process(exp.first_arg)
73
+ arg = normalize_output(exp.first_arg)
77
74
 
78
75
  if arg.node_type == :str
79
76
  ignore
80
- elsif exp.method == :safe_append=
77
+ elsif safe_append_method?(exp.method)
81
78
  s = Sexp.new :output, arg
82
79
  s.line(exp.line)
83
80
  @current_template.add_output s
@@ -95,4 +92,13 @@ class Brakeman::ErubisTemplateProcessor < Brakeman::TemplateProcessor
95
92
  super
96
93
  end
97
94
  end
95
+
96
+ private
97
+ def append_method?(method)
98
+ method == :append= || safe_append_method?(method)
99
+ end
100
+
101
+ def safe_append_method?(method)
102
+ method == :safe_append= || method == :safe_expr_append=
103
+ end
98
104
  end
@@ -29,7 +29,8 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
29
29
 
30
30
  if arg
31
31
  @inside_concat = true
32
- out = exp.first_arg = process(arg)
32
+ exp.first_arg = process(arg)
33
+ out = normalize_output(exp.first_arg)
33
34
  @inside_concat = false
34
35
  else
35
36
  raise "Empty _hamlout.#{method}()?"
@@ -73,7 +74,8 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
73
74
  #Has something to do with values of blocks?
74
75
  elsif sexp? target and method == :<< and is_buffer_target? target
75
76
  @inside_concat = true
76
- out = exp.first_arg = process(exp.first_arg)
77
+ exp.first_arg = process(exp.first_arg)
78
+ out = normalize_output(exp.first_arg)
77
79
  @inside_concat = false
78
80
 
79
81
  if out.node_type == :str #ignore plain strings
@@ -1,8 +1,10 @@
1
1
  require 'brakeman/processors/lib/processor_helper'
2
+ require 'brakeman/processors/lib/safe_call_helper'
2
3
  require 'brakeman/util'
3
4
 
4
5
  class Brakeman::BasicProcessor < Brakeman::SexpProcessor
5
6
  include Brakeman::ProcessorHelper
7
+ include Brakeman::SafeCallHelper
6
8
  include Brakeman::Util
7
9
 
8
10
  def initialize tracker
@@ -15,22 +17,6 @@ class Brakeman::BasicProcessor < Brakeman::SexpProcessor
15
17
  process_all exp
16
18
  end
17
19
 
18
- def process_safe_call exp
19
- if self.respond_to? :process_call
20
- process_call exp
21
- else
22
- process_default exp
23
- end
24
- end
25
-
26
- def process_safe_attrasgn exp
27
- if self.respond_to? :process_attrasgn
28
- process_attrasgn exp
29
- else
30
- process_default exp
31
- end
32
- end
33
-
34
20
  def process_if exp
35
21
  condition = exp.condition
36
22
 
@@ -0,0 +1,16 @@
1
+ module Brakeman
2
+ module SafeCallHelper
3
+ [[:process_safe_call, :process_call],
4
+ [:process_safe_attrasgn, :process_attrasgn],
5
+ [:process_safe_op_asgn, :process_op_asgn],
6
+ [:process_safe_op_asgn2, :process_op_asgn2]].each do |call, replacement|
7
+ define_method(call) do |exp|
8
+ if self.respond_to? replacement
9
+ self.send(replacement, exp)
10
+ else
11
+ process_default exp
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,4 +1,4 @@
1
- require 'ruby2ruby'
1
+ Brakeman.load_brakeman_dependency 'ruby2ruby'
2
2
  require 'brakeman/util'
3
3
 
4
4
  #Produces formatted output strings from Sexps.
@@ -13,11 +13,7 @@ class Brakeman::SlimTemplateProcessor < Brakeman::TemplateProcessor
13
13
  method = exp.method
14
14
 
15
15
  if method == :safe_concat and (target == SAFE_BUFFER or target == OUTPUT_BUFFER)
16
- arg = exp.first_arg
17
-
18
- if call? arg and arg.method == :to_s
19
- arg = arg.target
20
- end
16
+ arg = normalize_output(exp.first_arg)
21
17
 
22
18
  if is_escaped? arg
23
19
  make_escaped_output arg
@@ -52,4 +52,23 @@ class Brakeman::TemplateProcessor < Brakeman::BaseProcessor
52
52
  def process_escaped_output exp
53
53
  process_output exp
54
54
  end
55
+
56
+ # Pull out actual output value from template
57
+ def normalize_output arg
58
+ if call? arg and [:to_s, :html_safe!, :freeze].include? arg.method
59
+ arg.target
60
+ elsif node_type? arg, :if
61
+ branches = [arg.then_clause, arg.else_clause].compact
62
+
63
+ if branches.empty?
64
+ s(:nil)
65
+ elsif branches.length == 2
66
+ Sexp.new(:or, *branches)
67
+ else
68
+ branches.first
69
+ end
70
+ else
71
+ arg
72
+ end
73
+ end
55
74
  end
@@ -1,5 +1,4 @@
1
1
  require 'brakeman/scanner'
2
- require 'terminal-table'
3
2
  require 'brakeman/util'
4
3
  require 'brakeman/differ'
5
4
 
@@ -449,6 +448,8 @@ class Brakeman::RescanReport
449
448
 
450
449
  #Output total, fixed, and new warnings
451
450
  def to_s(verbose = false)
451
+ Brakeman.load_brakeman_dependency 'terminal-table'
452
+
452
453
  if !verbose
453
454
  <<-OUTPUT
454
455
  Total warnings: #{all_warnings.length}
@@ -1,7 +1,5 @@
1
- require 'rubygems'
2
-
3
1
  begin
4
- require 'ruby_parser'
2
+ Brakeman.load_brakeman_dependency 'ruby_parser'
5
3
  require 'ruby_parser/bm_sexp.rb'
6
4
  require 'ruby_parser/bm_sexp_processor.rb'
7
5
  require 'brakeman/processor'
@@ -24,7 +22,7 @@ class Brakeman::Scanner
24
22
  @options = options
25
23
  @app_tree = Brakeman::AppTree.from_options(options)
26
24
 
27
- if !@app_tree.root || !@app_tree.exists?("app")
25
+ if (!@app_tree.root || !@app_tree.exists?("app")) && !options[:force_scan]
28
26
  raise Brakeman::NoApplication, "Please supply the path to a Rails application."
29
27
  end
30
28
 
@@ -90,12 +90,7 @@ class Brakeman::Tracker
90
90
  set.each do |set_name, collection|
91
91
  collection.each_method do |method_name, definition|
92
92
  src = definition[:src]
93
- if src.node_type == :defs
94
- method_name = "#{src[1]}.#{method_name}"
95
- end
96
-
97
93
  yield src, set_name, method_name, definition[:file]
98
-
99
94
  end
100
95
  end
101
96
  end
@@ -254,10 +249,6 @@ class Brakeman::Tracker
254
249
  set.each do |set_name, info|
255
250
  info.each_method do |method_name, definition|
256
251
  src = definition[:src]
257
- if src.node_type == :defs
258
- method_name = "#{src[1]}.#{method_name}"
259
- end
260
-
261
252
  finder.process_source src, :class => set_name, :method => method_name, :file => definition[:file]
262
253
  end
263
254
  end
@@ -45,6 +45,10 @@ module Brakeman
45
45
  end
46
46
 
47
47
  def add_method visibility, name, src, file_name
48
+ if src.node_type == :defs
49
+ name = :"#{src[1]}.#{name}"
50
+ end
51
+
48
52
  @methods[visibility][name] = { :src => src, :file => file_name }
49
53
  end
50
54
 
@@ -1,3 +1,3 @@
1
1
  module Brakeman
2
- Version = "3.3.0"
2
+ Version = "3.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brakeman-min
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Collins
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - brakeman-public_cert.pem
12
- date: 2016-05-05 00:00:00.000000000 Z
12
+ date: 2016-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -184,6 +184,7 @@ files:
184
184
  - lib/brakeman/processors/lib/render_helper.rb
185
185
  - lib/brakeman/processors/lib/render_path.rb
186
186
  - lib/brakeman/processors/lib/route_helper.rb
187
+ - lib/brakeman/processors/lib/safe_call_helper.rb
187
188
  - lib/brakeman/processors/library_processor.rb
188
189
  - lib/brakeman/processors/model_processor.rb
189
190
  - lib/brakeman/processors/output_processor.rb