brakeman-min 3.7.2 → 4.0.0
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 +4 -4
- data/CHANGES +15 -1
- data/FEATURES +1 -1
- data/lib/brakeman.rb +55 -17
- data/lib/brakeman/call_index.rb +2 -2
- data/lib/brakeman/checks/base_check.rb +4 -2
- data/lib/brakeman/checks/check_basic_auth.rb +3 -3
- data/lib/brakeman/checks/check_basic_auth_timing_attack.rb +1 -1
- data/lib/brakeman/checks/check_content_tag.rb +12 -12
- data/lib/brakeman/checks/check_create_with.rb +5 -5
- data/lib/brakeman/checks/check_cross_site_scripting.rb +8 -8
- data/lib/brakeman/checks/check_default_routes.rb +4 -4
- data/lib/brakeman/checks/check_deserialize.rb +2 -2
- data/lib/brakeman/checks/check_detailed_exceptions.rb +4 -4
- data/lib/brakeman/checks/check_digest_dos.rb +2 -2
- data/lib/brakeman/checks/check_dynamic_finders.rb +1 -1
- data/lib/brakeman/checks/check_escape_function.rb +2 -2
- data/lib/brakeman/checks/check_evaluation.rb +1 -1
- data/lib/brakeman/checks/check_execute.rb +5 -5
- data/lib/brakeman/checks/check_file_access.rb +4 -4
- data/lib/brakeman/checks/check_file_disclosure.rb +2 -2
- data/lib/brakeman/checks/check_filter_skipping.rb +2 -2
- data/lib/brakeman/checks/check_forgery_setting.rb +2 -2
- data/lib/brakeman/checks/check_header_dos.rb +1 -1
- data/lib/brakeman/checks/check_i18n_xss.rb +2 -2
- data/lib/brakeman/checks/check_jruby_xml.rb +2 -4
- data/lib/brakeman/checks/check_json_encoding.rb +4 -4
- data/lib/brakeman/checks/check_json_parsing.rb +6 -6
- data/lib/brakeman/checks/check_link_to.rb +5 -5
- data/lib/brakeman/checks/check_link_to_href.rb +37 -31
- data/lib/brakeman/checks/check_mail_to.rb +2 -2
- data/lib/brakeman/checks/check_mass_assignment.rb +6 -6
- data/lib/brakeman/checks/check_mime_type_dos.rb +1 -1
- data/lib/brakeman/checks/check_model_attr_accessible.rb +5 -5
- data/lib/brakeman/checks/check_model_attributes.rb +4 -4
- data/lib/brakeman/checks/check_model_serialize.rb +3 -3
- data/lib/brakeman/checks/check_nested_attributes.rb +2 -2
- data/lib/brakeman/checks/check_nested_attributes_bypass.rb +1 -1
- data/lib/brakeman/checks/check_number_to_currency.rb +5 -5
- data/lib/brakeman/checks/check_quote_table_name.rb +2 -2
- data/lib/brakeman/checks/check_redirect.rb +2 -2
- data/lib/brakeman/checks/check_regex_dos.rb +3 -3
- data/lib/brakeman/checks/check_render.rb +4 -4
- data/lib/brakeman/checks/check_render_dos.rb +1 -1
- data/lib/brakeman/checks/check_render_inline.rb +5 -5
- data/lib/brakeman/checks/check_response_splitting.rb +1 -1
- data/lib/brakeman/checks/check_route_dos.rb +1 -1
- data/lib/brakeman/checks/check_safe_buffer_manipulation.rb +2 -2
- data/lib/brakeman/checks/check_sanitize_methods.rb +7 -7
- data/lib/brakeman/checks/check_secrets.rb +1 -1
- data/lib/brakeman/checks/check_select_tag.rb +2 -2
- data/lib/brakeman/checks/check_select_vulnerability.rb +3 -3
- data/lib/brakeman/checks/check_send.rb +1 -1
- data/lib/brakeman/checks/check_session_manipulation.rb +2 -2
- data/lib/brakeman/checks/check_session_settings.rb +3 -3
- data/lib/brakeman/checks/check_simple_format.rb +4 -4
- data/lib/brakeman/checks/check_single_quotes.rb +3 -3
- data/lib/brakeman/checks/check_skip_before_filter.rb +3 -3
- data/lib/brakeman/checks/check_sql.rb +9 -9
- data/lib/brakeman/checks/check_sql_cves.rb +2 -2
- data/lib/brakeman/checks/check_ssl_verify.rb +1 -1
- data/lib/brakeman/checks/check_strip_tags.rb +7 -7
- data/lib/brakeman/checks/check_symbol_dos.rb +2 -2
- data/lib/brakeman/checks/check_symbol_dos_cve.rb +1 -1
- data/lib/brakeman/checks/check_translate_bug.rb +3 -3
- data/lib/brakeman/checks/check_unsafe_reflection.rb +2 -2
- data/lib/brakeman/checks/check_unscoped_find.rb +1 -1
- data/lib/brakeman/checks/check_validation_regex.rb +1 -1
- data/lib/brakeman/checks/check_weak_hash.rb +6 -6
- data/lib/brakeman/checks/check_without_protection.rb +2 -2
- data/lib/brakeman/checks/check_xml_dos.rb +1 -1
- data/lib/brakeman/checks/check_yaml_parsing.rb +2 -2
- data/lib/brakeman/commandline.rb +2 -2
- data/lib/brakeman/options.rb +9 -5
- data/lib/brakeman/processors/alias_processor.rb +3 -1
- data/lib/brakeman/processors/lib/rails2_route_processor.rb +8 -8
- data/lib/brakeman/processors/lib/render_helper.rb +3 -3
- data/lib/brakeman/report.rb +9 -6
- data/lib/brakeman/report/report_base.rb +2 -1
- data/lib/brakeman/report/report_text.rb +4 -6
- data/lib/brakeman/rescanner.rb +8 -8
- data/lib/brakeman/tracker.rb +3 -3
- data/lib/brakeman/tracker/collection.rb +1 -1
- data/lib/brakeman/util.rb +5 -1
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning.rb +49 -21
- metadata +2 -2
|
@@ -18,10 +18,10 @@ class Brakeman::CheckSimpleFormat < Brakeman::CheckCrossSiteScripting
|
|
|
18
18
|
def generic_warning
|
|
19
19
|
message = "Rails #{rails_version} has a vulnerability in simple_format (CVE-2013-6416). Upgrade to Rails version 4.0.2"
|
|
20
20
|
|
|
21
|
-
warn :warning_type => "Cross
|
|
21
|
+
warn :warning_type => "Cross-Site Scripting",
|
|
22
22
|
:warning_code => :CVE_2013_6416,
|
|
23
23
|
:message => message,
|
|
24
|
-
:confidence =>
|
|
24
|
+
:confidence => :medium,
|
|
25
25
|
:gem_info => gemfile_or_environment,
|
|
26
26
|
:link_path => "https://groups.google.com/d/msg/ruby-security-ann/5ZI1-H5OoIM/ZNq4FoR2GnIJ"
|
|
27
27
|
end
|
|
@@ -48,10 +48,10 @@ class Brakeman::CheckSimpleFormat < Brakeman::CheckCrossSiteScripting
|
|
|
48
48
|
@found_any = true
|
|
49
49
|
|
|
50
50
|
warn :result => result,
|
|
51
|
-
:warning_type => "Cross
|
|
51
|
+
:warning_type => "Cross-Site Scripting",
|
|
52
52
|
:warning_code => :CVE_2013_6416_call,
|
|
53
53
|
:message => "Values passed to simple_format are not safe in Rails #{rails_version}",
|
|
54
|
-
:confidence =>
|
|
54
|
+
:confidence => :high,
|
|
55
55
|
:link_path => "https://groups.google.com/d/msg/ruby-security-ann/5ZI1-H5OoIM/ZNq4FoR2GnIJ",
|
|
56
56
|
:user_input => match
|
|
57
57
|
end
|
|
@@ -29,10 +29,10 @@ class Brakeman::CheckSingleQuotes < Brakeman::BaseCheck
|
|
|
29
29
|
return
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
warn :warning_type => "Cross
|
|
32
|
+
warn :warning_type => "Cross-Site Scripting",
|
|
33
33
|
:warning_code => :CVE_2012_3464,
|
|
34
34
|
:message => message,
|
|
35
|
-
:confidence =>
|
|
35
|
+
:confidence => :medium,
|
|
36
36
|
:gem_info => gemfile_or_environment,
|
|
37
37
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/kKGNeMrnmiY/discussion"
|
|
38
38
|
end
|
|
@@ -40,7 +40,7 @@ class Brakeman::CheckSingleQuotes < Brakeman::BaseCheck
|
|
|
40
40
|
#Process initializers to see if they use workaround
|
|
41
41
|
#by replacing Erb::Util.html_escape
|
|
42
42
|
def uses_rack_escape?
|
|
43
|
-
@tracker.initializers.each do |
|
|
43
|
+
@tracker.initializers.each do |_name, src|
|
|
44
44
|
process src
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -13,7 +13,7 @@ class Brakeman::CheckSkipBeforeFilter < Brakeman::BaseCheck
|
|
|
13
13
|
@description = "Warn when skipping CSRF or authentication checks by default"
|
|
14
14
|
|
|
15
15
|
def run_check
|
|
16
|
-
tracker.controllers.each do |
|
|
16
|
+
tracker.controllers.each do |_name, controller|
|
|
17
17
|
controller.skip_filters.each do |filter|
|
|
18
18
|
process_skip_filter filter, controller
|
|
19
19
|
end
|
|
@@ -28,7 +28,7 @@ class Brakeman::CheckSkipBeforeFilter < Brakeman::BaseCheck
|
|
|
28
28
|
:warning_code => :csrf_blacklist,
|
|
29
29
|
:message => "Use whitelist (:only => [..]) when skipping CSRF check",
|
|
30
30
|
:code => filter,
|
|
31
|
-
:confidence =>
|
|
31
|
+
:confidence => :medium,
|
|
32
32
|
:file => controller.file
|
|
33
33
|
|
|
34
34
|
when :login_required, :authenticate_user!, :require_user
|
|
@@ -37,7 +37,7 @@ class Brakeman::CheckSkipBeforeFilter < Brakeman::BaseCheck
|
|
|
37
37
|
:warning_type => "Authentication",
|
|
38
38
|
:message => "Use whitelist (:only => [..]) when skipping authentication",
|
|
39
39
|
:code => filter,
|
|
40
|
-
:confidence =>
|
|
40
|
+
:confidence => :medium,
|
|
41
41
|
:link => "authentication_whitelist",
|
|
42
42
|
:file => controller.file
|
|
43
43
|
end
|
|
@@ -207,19 +207,19 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
|
207
207
|
|
|
208
208
|
input = include_user_input? dangerous_value
|
|
209
209
|
if input
|
|
210
|
-
confidence =
|
|
210
|
+
confidence = :high
|
|
211
211
|
user_input = input
|
|
212
212
|
else
|
|
213
|
-
confidence =
|
|
213
|
+
confidence = :medium
|
|
214
214
|
user_input = dangerous_value
|
|
215
215
|
end
|
|
216
216
|
|
|
217
217
|
if result[:call].target and result[:chain] and not @expected_targets.include? result[:chain].first
|
|
218
218
|
confidence = case confidence
|
|
219
|
-
when
|
|
220
|
-
|
|
221
|
-
when
|
|
222
|
-
|
|
219
|
+
when :high
|
|
220
|
+
:medium
|
|
221
|
+
when :medium
|
|
222
|
+
:weak
|
|
223
223
|
else
|
|
224
224
|
confidence
|
|
225
225
|
end
|
|
@@ -235,9 +235,9 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
|
235
235
|
|
|
236
236
|
if check_for_limit_or_offset_vulnerability call.last_arg
|
|
237
237
|
if include_user_input? call.last_arg
|
|
238
|
-
confidence =
|
|
238
|
+
confidence = :high
|
|
239
239
|
else
|
|
240
|
-
confidence =
|
|
240
|
+
confidence = :weak
|
|
241
241
|
end
|
|
242
242
|
|
|
243
243
|
warn :result => result,
|
|
@@ -364,7 +364,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
|
364
364
|
#(Seems unlikely, but if a user can control the column names queried, that
|
|
365
365
|
#could be bad)
|
|
366
366
|
def check_hash_keys exp
|
|
367
|
-
hash_iterate(exp) do |key,
|
|
367
|
+
hash_iterate(exp) do |key, _value|
|
|
368
368
|
unless symbol?(key)
|
|
369
369
|
unsafe_key = unsafe_sql? key
|
|
370
370
|
return unsafe_key if unsafe_key
|
|
@@ -79,7 +79,7 @@ class Brakeman::CheckSQLCVEs < Brakeman::BaseCheck
|
|
|
79
79
|
warn :warning_type => 'SQL Injection',
|
|
80
80
|
:warning_code => code,
|
|
81
81
|
:message => "Rails #{rails_version} contains a SQL injection vulnerability (#{cve}). Upgrade to #{upgrade_version}",
|
|
82
|
-
:confidence =>
|
|
82
|
+
:confidence => :high,
|
|
83
83
|
:gem_info => gemfile_or_environment,
|
|
84
84
|
:link_path => link
|
|
85
85
|
end
|
|
@@ -99,7 +99,7 @@ class Brakeman::CheckSQLCVEs < Brakeman::BaseCheck
|
|
|
99
99
|
warn :warning_type => 'SQL Injection',
|
|
100
100
|
:warning_code => :CVE_2014_0080,
|
|
101
101
|
:message => "Rails #{rails_version} contains a SQL injection vulnerability (CVE-2014-0080) with PostgreSQL. Upgrade to 4.0.3",
|
|
102
|
-
:confidence =>
|
|
102
|
+
:confidence => :high,
|
|
103
103
|
:gem_info => gemfile_or_environment(:pg),
|
|
104
104
|
:link_path => "https://groups.google.com/d/msg/rubyonrails-security/Wu96YkTUR6s/pPLBMZrlwvYJ"
|
|
105
105
|
end
|
|
@@ -43,6 +43,6 @@ class Brakeman::CheckSSLVerify < Brakeman::BaseCheck
|
|
|
43
43
|
:warning_type => "SSL Verification Bypass",
|
|
44
44
|
:warning_code => :ssl_verification_bypass,
|
|
45
45
|
:message => "SSL certificate verification was bypassed",
|
|
46
|
-
:confidence =>
|
|
46
|
+
:confidence => :high
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -30,11 +30,11 @@ class Brakeman::CheckStripTags < Brakeman::BaseCheck
|
|
|
30
30
|
message = "Versions before 2.3.13 have a vulnerability in strip_tags (CVE-2011-2931)"
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
warn :warning_type => "Cross
|
|
33
|
+
warn :warning_type => "Cross-Site Scripting",
|
|
34
34
|
:warning_code => :CVE_2011_2931,
|
|
35
35
|
:message => message,
|
|
36
36
|
:gem_info => gemfile_or_environment,
|
|
37
|
-
:confidence =>
|
|
37
|
+
:confidence => :high,
|
|
38
38
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/K5EwdJt06hI/discussion"
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -53,10 +53,10 @@ class Brakeman::CheckStripTags < Brakeman::BaseCheck
|
|
|
53
53
|
return
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
warn :warning_type => "Cross
|
|
56
|
+
warn :warning_type => "Cross-Site Scripting",
|
|
57
57
|
:warning_code => :CVE_2012_3465,
|
|
58
58
|
:message => message,
|
|
59
|
-
:confidence =>
|
|
59
|
+
:confidence => :high,
|
|
60
60
|
:gem_info => gemfile_or_environment,
|
|
61
61
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/FgVEtBajcTY/discussion"
|
|
62
62
|
end
|
|
@@ -64,14 +64,14 @@ class Brakeman::CheckStripTags < Brakeman::BaseCheck
|
|
|
64
64
|
def cve_2015_7579
|
|
65
65
|
if tracker.config.gem_version(:'rails-html-sanitizer') == '1.0.2'
|
|
66
66
|
if uses_strip_tags?
|
|
67
|
-
confidence =
|
|
67
|
+
confidence = :high
|
|
68
68
|
else
|
|
69
|
-
confidence =
|
|
69
|
+
confidence = :medium
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
message = "rails-html-sanitizer 1.0.2 is vulnerable (CVE-2015-7579). Upgrade to 1.0.3"
|
|
73
73
|
|
|
74
|
-
warn :warning_type => "Cross
|
|
74
|
+
warn :warning_type => "Cross-Site Scripting",
|
|
75
75
|
:warning_code => :CVE_2015_7579,
|
|
76
76
|
:message => message,
|
|
77
77
|
:confidence => confidence,
|
|
@@ -28,9 +28,9 @@ class Brakeman::CheckSymbolDoS < Brakeman::BaseCheck
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
if input = args.map{ |arg| has_immediate_user_input?(arg) }.compact.first
|
|
31
|
-
confidence =
|
|
31
|
+
confidence = :high
|
|
32
32
|
elsif input = args.map{ |arg| include_user_input?(arg) }.compact.first
|
|
33
|
-
confidence =
|
|
33
|
+
confidence = :medium
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
if confidence
|
|
@@ -21,7 +21,7 @@ class Brakeman::CheckSymbolDoSCVE < Brakeman::BaseCheck
|
|
|
21
21
|
warn :warning_type => "Denial of Service",
|
|
22
22
|
:warning_code => :CVE_2013_1854,
|
|
23
23
|
:message => "Rails #{rails_version} has a denial of service vulnerability in ActiveRecord: upgrade to #{fix_version} or patch",
|
|
24
|
-
:confidence =>
|
|
24
|
+
:confidence => :medium,
|
|
25
25
|
:gem_info => gemfile_or_environment,
|
|
26
26
|
:link => "https://groups.google.com/d/msg/rubyonrails-security/jgJ4cjjS8FE/BGbHRxnDRTIJ"
|
|
27
27
|
end
|
|
@@ -13,9 +13,9 @@ class Brakeman::CheckTranslateBug < Brakeman::BaseCheck
|
|
|
13
13
|
version_between?('3.1.0', '3.1.1')
|
|
14
14
|
|
|
15
15
|
confidence = if uses_translate?
|
|
16
|
-
|
|
16
|
+
:high
|
|
17
17
|
else
|
|
18
|
-
|
|
18
|
+
:medium
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
description = "have a vulnerability in the translate helper with keys ending in _html"
|
|
@@ -28,7 +28,7 @@ class Brakeman::CheckTranslateBug < Brakeman::BaseCheck
|
|
|
28
28
|
"Rails 2.3.x using the rails_xss plugin #{description}."
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
warn :warning_type => "Cross
|
|
31
|
+
warn :warning_type => "Cross-Site Scripting",
|
|
32
32
|
:warning_code => :translate_vuln,
|
|
33
33
|
:message => message,
|
|
34
34
|
:confidence => confidence,
|
|
@@ -31,9 +31,9 @@ class Brakeman::CheckUnsafeReflection < Brakeman::BaseCheck
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
if input = has_immediate_user_input?(arg)
|
|
34
|
-
confidence =
|
|
34
|
+
confidence = :high
|
|
35
35
|
elsif input = include_user_input?(arg)
|
|
36
|
-
confidence =
|
|
36
|
+
confidence = :medium
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
if confidence
|
|
@@ -35,7 +35,7 @@ class Brakeman::CheckUnscopedFind < Brakeman::BaseCheck
|
|
|
35
35
|
:warning_code => :unscoped_find,
|
|
36
36
|
:message => "Unscoped call to #{result[:target]}##{result[:method]}",
|
|
37
37
|
:code => result[:call],
|
|
38
|
-
:confidence =>
|
|
38
|
+
:confidence => :weak,
|
|
39
39
|
:user_input => input
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -91,7 +91,7 @@ class Brakeman::CheckValidationRegex < Brakeman::BaseCheck
|
|
|
91
91
|
:warning_code => :validation_regex,
|
|
92
92
|
:message => "Insufficient validation for '#{get_name validator}' using #{regex.inspect}. Use \\A and \\z as anchors",
|
|
93
93
|
:line => value.line,
|
|
94
|
-
:confidence =>
|
|
94
|
+
:confidence => :high
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
@@ -29,14 +29,14 @@ class Brakeman::CheckWeakHash < Brakeman::BaseCheck
|
|
|
29
29
|
|
|
30
30
|
if DIGEST_CALLS.include? call.method
|
|
31
31
|
if input = user_input_as_arg?(call)
|
|
32
|
-
confidence =
|
|
32
|
+
confidence = :high
|
|
33
33
|
elsif input = hashing_password?(call)
|
|
34
|
-
confidence =
|
|
34
|
+
confidence = :high
|
|
35
35
|
else
|
|
36
|
-
confidence =
|
|
36
|
+
confidence = :medium
|
|
37
37
|
end
|
|
38
38
|
else
|
|
39
|
-
confidence =
|
|
39
|
+
confidence = :medium
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
|
|
@@ -75,7 +75,7 @@ class Brakeman::CheckWeakHash < Brakeman::BaseCheck
|
|
|
75
75
|
:warning_type => "Weak Hash",
|
|
76
76
|
:warning_code => :weak_hash_hmac,
|
|
77
77
|
:message => "Weak hashing algorithm (#{alg}) used in HMAC",
|
|
78
|
-
:confidence =>
|
|
78
|
+
:confidence => :medium
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def process_openssl_result result
|
|
@@ -91,7 +91,7 @@ class Brakeman::CheckWeakHash < Brakeman::BaseCheck
|
|
|
91
91
|
:warning_type => "Weak Hash",
|
|
92
92
|
:warning_code => :weak_hash_digest,
|
|
93
93
|
:message => "Weak hashing algorithm (#{alg}) used",
|
|
94
|
-
:confidence =>
|
|
94
|
+
:confidence => :medium
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
end
|
|
@@ -42,11 +42,11 @@ class Brakeman::CheckWithoutProtection < Brakeman::BaseCheck
|
|
|
42
42
|
add_result res
|
|
43
43
|
|
|
44
44
|
if input = include_user_input?(call.arglist)
|
|
45
|
-
confidence =
|
|
45
|
+
confidence = :high
|
|
46
46
|
elsif all_literals? call
|
|
47
47
|
return
|
|
48
48
|
else
|
|
49
|
-
confidence =
|
|
49
|
+
confidence = :medium
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
warn :result => res,
|
|
@@ -28,7 +28,7 @@ class Brakeman::CheckXMLDoS < Brakeman::BaseCheck
|
|
|
28
28
|
warn :warning_type => "Denial of Service",
|
|
29
29
|
:warning_code => :CVE_2015_3227,
|
|
30
30
|
:message => message,
|
|
31
|
-
:confidence =>
|
|
31
|
+
:confidence => :medium,
|
|
32
32
|
:gem_info => gemfile_or_environment,
|
|
33
33
|
:link_path => "https://groups.google.com/d/msg/rubyonrails-security/bahr2JLnxvk/x4EocXnHPp8J"
|
|
34
34
|
end
|
|
@@ -27,7 +27,7 @@ class Brakeman::CheckYAMLParsing < Brakeman::BaseCheck
|
|
|
27
27
|
warn :warning_type => "Remote Code Execution",
|
|
28
28
|
:warning_code => :CVE_2013_0156,
|
|
29
29
|
:message => message,
|
|
30
|
-
:confidence =>
|
|
30
|
+
:confidence => :high,
|
|
31
31
|
:gem_info => gemfile_or_environment,
|
|
32
32
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/61bkgvnSGTQ/discussion"
|
|
33
33
|
end
|
|
@@ -39,7 +39,7 @@ class Brakeman::CheckYAMLParsing < Brakeman::BaseCheck
|
|
|
39
39
|
warn :warning_type => "Remote Code Execution",
|
|
40
40
|
:warning_code => :CVE_2013_0156,
|
|
41
41
|
:message => message,
|
|
42
|
-
:confidence =>
|
|
42
|
+
:confidence => :high,
|
|
43
43
|
:gem_info => gemfile_or_environment,
|
|
44
44
|
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/61bkgvnSGTQ/discussion"
|
|
45
45
|
end
|
data/lib/brakeman/commandline.rb
CHANGED
|
@@ -117,11 +117,11 @@ module Brakeman
|
|
|
117
117
|
def regular_report options
|
|
118
118
|
tracker = run_brakeman options
|
|
119
119
|
|
|
120
|
-
if options[:exit_on_warn] and not tracker.filtered_warnings.empty?
|
|
120
|
+
if tracker.options[:exit_on_warn] and not tracker.filtered_warnings.empty?
|
|
121
121
|
quit Brakeman::Warnings_Found_Exit_Code
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
if options[:exit_on_error] and tracker.errors.any?
|
|
124
|
+
if tracker.options[:exit_on_error] and tracker.errors.any?
|
|
125
125
|
quit Brakeman::Errors_Found_Exit_Code
|
|
126
126
|
end
|
|
127
127
|
end
|
data/lib/brakeman/options.rb
CHANGED
|
@@ -55,11 +55,11 @@ module Brakeman::Options
|
|
|
55
55
|
options[:quiet] = quiet
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
opts.on( "-z", "--[no-]exit-on-warn", "Exit code is non-zero if warnings found") do |exit_on_warn|
|
|
58
|
+
opts.on( "-z", "--[no-]exit-on-warn", "Exit code is non-zero if warnings found (Default)") do |exit_on_warn|
|
|
59
59
|
options[:exit_on_warn] = exit_on_warn
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
opts.on "--[no-]exit-on-error", "Exit code is non-zero if errors
|
|
62
|
+
opts.on "--[no-]exit-on-error", "Exit code is non-zero if errors raised (Default)" do |exit_on_error|
|
|
63
63
|
options[:exit_on_error] = exit_on_error
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -89,7 +89,7 @@ module Brakeman::Options
|
|
|
89
89
|
options[:run_all_checks] = true
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
opts.on "-a", "--[no-]assume-routes", "Assume all controller methods are actions (
|
|
92
|
+
opts.on "-a", "--[no-]assume-routes", "Assume all controller methods are actions (Default)" do |assume|
|
|
93
93
|
options[:assume_all_routes] = assume
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -111,7 +111,7 @@ module Brakeman::Options
|
|
|
111
111
|
options[:ignore_attr_protected] = true
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
opts.on "--[no-]index-libs", "Add libraries to call index (
|
|
114
|
+
opts.on "--[no-]index-libs", "Add libraries to call index (Default)" do |index|
|
|
115
115
|
options[:index_libs] = index
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -201,7 +201,7 @@ module Brakeman::Options
|
|
|
201
201
|
|
|
202
202
|
opts.on "-f",
|
|
203
203
|
"--format TYPE",
|
|
204
|
-
[:pdf, :text, :html, :csv, :tabs, :json, :markdown, :codeclimate, :cc, :plain],
|
|
204
|
+
[:pdf, :text, :html, :csv, :tabs, :json, :markdown, :codeclimate, :cc, :plain, :table],
|
|
205
205
|
"Specify output formats. Default is text" do |type|
|
|
206
206
|
|
|
207
207
|
type = "s" if type == :text
|
|
@@ -240,6 +240,10 @@ module Brakeman::Options
|
|
|
240
240
|
options[:message_limit] = limit.to_i
|
|
241
241
|
end
|
|
242
242
|
|
|
243
|
+
opts.on "--[no-]pager", "Use pager for output to terminal (Default)" do |pager|
|
|
244
|
+
options[:pager] = pager
|
|
245
|
+
end
|
|
246
|
+
|
|
243
247
|
opts.on "--table-width WIDTH", "Limit table width in text report" do |width|
|
|
244
248
|
options[:table_width] = width.to_i
|
|
245
249
|
end
|
|
@@ -706,9 +706,11 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
|
|
|
706
706
|
|
|
707
707
|
def early_return? exp
|
|
708
708
|
return true if node_type? exp, :return
|
|
709
|
+
return true if call? exp and [:fail, :raise].include? exp.method
|
|
709
710
|
|
|
710
711
|
if node_type? exp, :block, :rlist
|
|
711
|
-
node_type? exp.last, :return
|
|
712
|
+
node_type? exp.last, :return or
|
|
713
|
+
(call? exp and [:fail, :raise].include? exp.method)
|
|
712
714
|
else
|
|
713
715
|
false
|
|
714
716
|
end
|
|
@@ -184,7 +184,7 @@ class Brakeman::Rails2RoutesProcessor < Brakeman::BasicProcessor
|
|
|
184
184
|
|
|
185
185
|
controller = check_for_controller_name exp
|
|
186
186
|
self.current_controller = controller if controller
|
|
187
|
-
|
|
187
|
+
|
|
188
188
|
#Check for default route
|
|
189
189
|
if string? exp.first
|
|
190
190
|
if exp.first.value == ":controller/:action/:id"
|
|
@@ -202,7 +202,7 @@ class Brakeman::Rails2RoutesProcessor < Brakeman::BasicProcessor
|
|
|
202
202
|
exp.last.each_with_index do |e,i|
|
|
203
203
|
if symbol? e and e.value == :action
|
|
204
204
|
action = exp.last[i + 1]
|
|
205
|
-
|
|
205
|
+
|
|
206
206
|
if node_type? action, :lit
|
|
207
207
|
@tracker.routes[@current_controller] << action.value.to_sym
|
|
208
208
|
end
|
|
@@ -220,7 +220,7 @@ class Brakeman::Rails2RoutesProcessor < Brakeman::BasicProcessor
|
|
|
220
220
|
@nested = Sexp.new(:lvar, exp.block_args.value)
|
|
221
221
|
|
|
222
222
|
self.current_controller = check_for_controller_name exp.block_call.args
|
|
223
|
-
|
|
223
|
+
|
|
224
224
|
#process block
|
|
225
225
|
process exp.block
|
|
226
226
|
|
|
@@ -258,7 +258,7 @@ class Brakeman::Rails2RoutesProcessor < Brakeman::BasicProcessor
|
|
|
258
258
|
return unless exp.node_type == :hash
|
|
259
259
|
routes = @tracker.routes[@current_controller]
|
|
260
260
|
|
|
261
|
-
hash_iterate(exp) do |action,
|
|
261
|
+
hash_iterate(exp) do |action, _type|
|
|
262
262
|
routes << action.value
|
|
263
263
|
end
|
|
264
264
|
end
|
|
@@ -283,14 +283,14 @@ end
|
|
|
283
283
|
#This is for a really specific case where a hash is used as arguments
|
|
284
284
|
#to one of the map methods.
|
|
285
285
|
class Brakeman::RouteAliasProcessor < Brakeman::AliasProcessor
|
|
286
|
-
|
|
286
|
+
|
|
287
287
|
#This replaces
|
|
288
288
|
# { :some => :hash }.keys
|
|
289
|
-
#with
|
|
289
|
+
#with
|
|
290
290
|
# [:some]
|
|
291
291
|
def process_call exp
|
|
292
292
|
process_default exp
|
|
293
|
-
|
|
293
|
+
|
|
294
294
|
if hash? exp.target and exp.method == :keys
|
|
295
295
|
keys = get_keys exp.target
|
|
296
296
|
exp.clear
|
|
@@ -304,7 +304,7 @@ class Brakeman::RouteAliasProcessor < Brakeman::AliasProcessor
|
|
|
304
304
|
#Returns an array Sexp containing the keys from the hash
|
|
305
305
|
def get_keys hash
|
|
306
306
|
keys = Sexp.new(:array)
|
|
307
|
-
hash_iterate(hash) do |key,
|
|
307
|
+
hash_iterate(hash) do |key, _value|
|
|
308
308
|
keys << key
|
|
309
309
|
end
|
|
310
310
|
|