brakeman-min 3.4.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +15 -0
- data/README.md +4 -2
- data/bin/brakeman +11 -1
- data/lib/brakeman.rb +26 -2
- data/lib/brakeman/app_tree.rb +9 -4
- data/lib/brakeman/checks.rb +18 -0
- data/lib/brakeman/checks/check_sql.rb +32 -10
- data/lib/brakeman/options.rb +11 -3
- data/lib/brakeman/processors/controller_processor.rb +15 -1
- data/lib/brakeman/processors/library_processor.rb +12 -0
- data/lib/brakeman/report/report_table.rb +12 -5
- data/lib/brakeman/report/report_text.rb +11 -4
- data/lib/brakeman/tracker.rb +10 -0
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning.rb +1 -0
- metadata +2 -3
- data/WARNING_TYPES +0 -95
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34207b00cf9b699ce8f8330d267e6bae5fcb5aa3
|
4
|
+
data.tar.gz: 476ddf71d3b65d4a42ce4a0c3797afce2a668dd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ff7b88ba0c48c57ba0add9897e5518ebf95612ad4d0ef6077b473f0c5e074f39bd5622773715e6d21f39413b7bb0c3980c7eaf730392c4727eebdc1112c15f1
|
7
|
+
data.tar.gz: 31087cfd02979e3602e2d642f1594cfdb9439565a7d4295f810730ed48519144e2fb396a3f59da45f6693f5383045bb5e41303b40e2334d6e1dfc5dd502ac01f
|
data/CHANGES
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# 3.5.0
|
2
|
+
|
3
|
+
* Allow `-t None`
|
4
|
+
* Fail on invalid checks specified by `-x` or `-t`
|
5
|
+
* Avoid warning about all, first, or last after Rails 4.0
|
6
|
+
* Avoid warning about models in SQLi
|
7
|
+
* Lower confidence of SQLi when maybe not on models
|
8
|
+
* Warn about SQLi even potentially on non-models
|
9
|
+
* Report check name in JSON and plain reports
|
10
|
+
* Treat templates without `.html` as HTML anyway
|
11
|
+
* Add `--ensure-latest` option (tamgrosser / Michael Grosser)
|
12
|
+
* Add `--no-summary` to hide summaries in HTML/text reports
|
13
|
+
* Handle `included` block in concerns
|
14
|
+
* Process concerns before controllers
|
15
|
+
|
1
16
|
# 3.4.1
|
2
17
|
|
3
18
|
* Show action help at start of interactive ignore
|
data/README.md
CHANGED
@@ -36,7 +36,9 @@ Outside of Rails root:
|
|
36
36
|
|
37
37
|
# Compatibility
|
38
38
|
|
39
|
-
Brakeman
|
39
|
+
Brakeman should work with any version of Rails from 2.3.x to 5.x.
|
40
|
+
|
41
|
+
Brakeman can analyze code written with Ruby 1.8 syntax and newer, but requires at least Ruby 1.9.3 to run.
|
40
42
|
|
41
43
|
# Basic Options
|
42
44
|
|
@@ -101,7 +103,7 @@ To create and manage this file, use:
|
|
101
103
|
|
102
104
|
# Warning information
|
103
105
|
|
104
|
-
See [
|
106
|
+
See [warning\_types](docs/warning_types) for more information on the warnings reported by this tool.
|
105
107
|
|
106
108
|
# Warning context
|
107
109
|
|
data/bin/brakeman
CHANGED
@@ -57,6 +57,13 @@ if options[:quiet].nil?
|
|
57
57
|
end
|
58
58
|
|
59
59
|
begin
|
60
|
+
if options[:ensure_latest]
|
61
|
+
if error = Brakeman.ensure_latest
|
62
|
+
warn error
|
63
|
+
exit Brakeman::Not_Latest_Version_Exit_Code
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
60
67
|
if options[:previous_results_json]
|
61
68
|
require 'json'
|
62
69
|
vulns = Brakeman.compare options.merge(:quiet => options[:quiet])
|
@@ -84,6 +91,9 @@ begin
|
|
84
91
|
end
|
85
92
|
end
|
86
93
|
rescue Brakeman::NoApplication => e
|
87
|
-
|
94
|
+
warn e.message
|
88
95
|
exit Brakeman::No_App_Found_Exit_Code
|
96
|
+
rescue Brakeman::MissingChecksError => e
|
97
|
+
warn e.message
|
98
|
+
exit Brakeman::Missing_Checks_Exit_Code
|
89
99
|
end
|
data/lib/brakeman.rb
CHANGED
@@ -9,6 +9,12 @@ module Brakeman
|
|
9
9
|
#Exit code returned when no Rails application is detected
|
10
10
|
No_App_Found_Exit_Code = 4
|
11
11
|
|
12
|
+
#Exit code returned when brakeman was outdated
|
13
|
+
Not_Latest_Version_Exit_Code = 5
|
14
|
+
|
15
|
+
#Exit code returned when user requests non-existent checks
|
16
|
+
Missing_Checks_Exit_Code = 6
|
17
|
+
|
12
18
|
@debug = false
|
13
19
|
@quiet = false
|
14
20
|
@loaded_dependencies = []
|
@@ -48,8 +54,7 @@ module Brakeman
|
|
48
54
|
# * :skip_libs - do not process lib/ directory (default: false)
|
49
55
|
# * :skip_checks - checks not to run (run all if not specified)
|
50
56
|
# * :absolute_paths - show absolute path of each file (default: false)
|
51
|
-
# * :summary_only - only output summary section of report
|
52
|
-
# (does not apply to tabs format)
|
57
|
+
# * :summary_only - only output summary section of report for plain/table (:summary_only, :no_summary, true)
|
53
58
|
#
|
54
59
|
#Alternatively, just supply a path as a string.
|
55
60
|
def self.run options
|
@@ -324,6 +329,14 @@ module Brakeman
|
|
324
329
|
end
|
325
330
|
end
|
326
331
|
|
332
|
+
def self.ensure_latest
|
333
|
+
current = Brakeman::Version
|
334
|
+
latest = Gem.latest_version_for('brakeman').to_s
|
335
|
+
if current != latest
|
336
|
+
"Brakeman #{current} is not the latest version #{latest}"
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
327
340
|
#Run a scan. Generally called from Brakeman.run instead of directly.
|
328
341
|
def self.scan options
|
329
342
|
#Load scanner
|
@@ -341,6 +354,8 @@ module Brakeman
|
|
341
354
|
scanner = Scanner.new options
|
342
355
|
tracker = scanner.tracker
|
343
356
|
|
357
|
+
check_for_missing_checks options[:run_checks], options[:skip_checks]
|
358
|
+
|
344
359
|
notify "Processing application in #{tracker.app_path}"
|
345
360
|
scanner.process
|
346
361
|
|
@@ -506,8 +521,17 @@ module Brakeman
|
|
506
521
|
end if options[:additional_checks_path]
|
507
522
|
end
|
508
523
|
|
524
|
+
def self.check_for_missing_checks included_checks, excluded_checks
|
525
|
+
missing = Brakeman::Checks.missing_checks(included_checks || Set.new, excluded_checks || Set.new)
|
526
|
+
|
527
|
+
unless missing.empty?
|
528
|
+
raise MissingChecksError, "Could not find specified check#{missing.length > 1 ? 's' : ''}: #{missing.to_a.join(', ')}"
|
529
|
+
end
|
530
|
+
end
|
531
|
+
|
509
532
|
class DependencyError < RuntimeError; end
|
510
533
|
class RakeInstallError < RuntimeError; end
|
511
534
|
class NoBrakemanError < RuntimeError; end
|
512
535
|
class NoApplication < RuntimeError; end
|
536
|
+
class MissingChecksError < RuntimeError; end
|
513
537
|
end
|
data/lib/brakeman/app_tree.rb
CHANGED
@@ -89,19 +89,20 @@ module Brakeman
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def initializer_paths
|
92
|
-
@initializer_paths ||= find_paths("config/initializers")
|
92
|
+
@initializer_paths ||= prioritize_concerns(find_paths("config/initializers"))
|
93
93
|
end
|
94
94
|
|
95
95
|
def controller_paths
|
96
|
-
@controller_paths ||= find_paths("app/**/controllers")
|
96
|
+
@controller_paths ||= prioritize_concerns(find_paths("app/**/controllers"))
|
97
97
|
end
|
98
98
|
|
99
99
|
def model_paths
|
100
|
-
@model_paths ||= find_paths("app/**/models")
|
100
|
+
@model_paths ||= prioritize_concerns(find_paths("app/**/models"))
|
101
101
|
end
|
102
102
|
|
103
103
|
def template_paths
|
104
|
-
@template_paths ||= find_paths("app/**/views", "*.{#{VIEW_EXTENSIONS}}")
|
104
|
+
@template_paths ||= find_paths("app/**/views", "*.{#{VIEW_EXTENSIONS}}") +
|
105
|
+
find_paths("app/**/views", "*.{erb,haml,slim}").reject { |path| File.basename(path).count(".") > 1 }
|
105
106
|
end
|
106
107
|
|
107
108
|
def layout_exists?(name)
|
@@ -177,5 +178,9 @@ module Brakeman
|
|
177
178
|
rel_engines = (rel + [""]).join("/,")
|
178
179
|
@root_search_patrern = "{#{roots}}/{#{rel_engines}}"
|
179
180
|
end
|
181
|
+
|
182
|
+
def prioritize_concerns paths
|
183
|
+
paths.partition { |path| path.include? "concerns" }.flatten
|
184
|
+
end
|
180
185
|
end
|
181
186
|
end
|
data/lib/brakeman/checks.rb
CHANGED
@@ -37,6 +37,24 @@ class Brakeman::Checks
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
def self.missing_checks included_checks, excluded_checks
|
41
|
+
included_checks = included_checks.map(&:to_s).to_set
|
42
|
+
excluded_checks = excluded_checks.map(&:to_s).to_set
|
43
|
+
|
44
|
+
if included_checks == Set['CheckNone']
|
45
|
+
return []
|
46
|
+
else
|
47
|
+
loaded = self.checks.map { |name| name.to_s.gsub('Brakeman::', '') }.to_set
|
48
|
+
missing = (included_checks - loaded) + (excluded_checks - loaded)
|
49
|
+
|
50
|
+
unless missing.empty?
|
51
|
+
return missing
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
[]
|
56
|
+
end
|
57
|
+
|
40
58
|
#No need to use this directly.
|
41
59
|
def initialize options = { }
|
42
60
|
if options[:min_confidence]
|
@@ -14,11 +14,21 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
14
14
|
@description = "Check for SQL injection"
|
15
15
|
|
16
16
|
def run_check
|
17
|
-
|
18
|
-
|
19
|
-
@sql_targets
|
17
|
+
narrow_targets = [:exists?, :select]
|
18
|
+
|
19
|
+
@sql_targets = [:average, :calculate, :count, :count_by_sql, :delete_all, :destroy_all,
|
20
|
+
:find_by_sql, :maximum, :minimum, :pluck, :sum, :update_all]
|
21
|
+
@sql_targets.concat [:from, :group, :having, :joins, :lock, :order, :reorder, :where] if tracker.options[:rails3]
|
20
22
|
@sql_targets << :find_by << :find_by! if tracker.options[:rails4]
|
21
23
|
|
24
|
+
if version_between?("2.0.0", "3.9.9") or tracker.config.rails_version.nil?
|
25
|
+
@sql_targets << :first << :last << :all
|
26
|
+
end
|
27
|
+
|
28
|
+
if version_between?("2.0.0", "4.0.99") or tracker.config.rails_version.nil?
|
29
|
+
@sql_targets << :find
|
30
|
+
end
|
31
|
+
|
22
32
|
@connection_calls = [:delete, :execute, :insert, :select_all, :select_one,
|
23
33
|
:select_rows, :select_value, :select_values]
|
24
34
|
|
@@ -28,10 +38,12 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
28
38
|
@connection_calls.concat [:add_limit!, :add_offset_limit!, :add_lock!]
|
29
39
|
end
|
30
40
|
|
41
|
+
@expected_targets = active_record_models.keys + [:connection, :"ActiveRecord::Base"]
|
42
|
+
|
31
43
|
Brakeman.debug "Finding possible SQL calls on models"
|
32
|
-
calls = tracker.find_call :
|
33
|
-
|
34
|
-
|
44
|
+
calls = tracker.find_call(:methods => @sql_targets, :nested => true)
|
45
|
+
|
46
|
+
calls.concat tracker.find_call(:targets => active_record_models.keys, :methods => narrow_targets, :chained => true)
|
35
47
|
|
36
48
|
Brakeman.debug "Finding possible SQL calls with no target"
|
37
49
|
calls.concat tracker.find_call(:target => nil, :methods => @sql_targets)
|
@@ -39,8 +51,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
39
51
|
Brakeman.debug "Finding possible SQL calls using constantized()"
|
40
52
|
calls.concat tracker.find_call(:methods => @sql_targets).select { |result| constantize_call? result }
|
41
53
|
|
42
|
-
|
43
|
-
calls.concat tracker.find_call(:targets => connect_targets, :methods => @connection_calls, :chained => true).select { |result| connect_call? result }
|
54
|
+
calls.concat tracker.find_call(:targets => @expected_targets, :methods => @connection_calls, :chained => true).select { |result| connect_call? result }
|
44
55
|
|
45
56
|
Brakeman.debug "Finding calls to named_scope or scope"
|
46
57
|
calls.concat find_scope_calls
|
@@ -203,6 +214,17 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
203
214
|
user_input = dangerous_value
|
204
215
|
end
|
205
216
|
|
217
|
+
if result[:call].target and result[:chain] and not @expected_targets.include? result[:chain].first
|
218
|
+
confidence = case confidence
|
219
|
+
when CONFIDENCE[:high]
|
220
|
+
CONFIDENCE[:med]
|
221
|
+
when CONFIDENCE[:med]
|
222
|
+
CONFIDENCE[:low]
|
223
|
+
else
|
224
|
+
confidence
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
206
228
|
warn :result => result,
|
207
229
|
:warning_type => "SQL Injection",
|
208
230
|
:warning_code => :sql_injection,
|
@@ -429,7 +451,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
429
451
|
unsafe_sql? exp.then_clause or unsafe_sql? exp.else_clause
|
430
452
|
when :call
|
431
453
|
unless IGNORE_METHODS_IN_SQL.include? exp.method
|
432
|
-
if has_immediate_user_input? exp
|
454
|
+
if has_immediate_user_input? exp
|
433
455
|
exp
|
434
456
|
elsif exp.method == :to_s
|
435
457
|
find_dangerous_value exp.target, ignore_hash
|
@@ -446,7 +468,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
|
|
446
468
|
when :block, :rlist
|
447
469
|
unsafe_sql? exp.last
|
448
470
|
else
|
449
|
-
if has_immediate_user_input? exp
|
471
|
+
if has_immediate_user_input? exp
|
450
472
|
exp
|
451
473
|
else
|
452
474
|
nil
|
data/lib/brakeman/options.rb
CHANGED
@@ -43,6 +43,10 @@ module Brakeman::Options
|
|
43
43
|
options[:exit_on_warn] = exit_on_warn
|
44
44
|
end
|
45
45
|
|
46
|
+
opts.on "--ensure-latest", "Fail when Brakeman is outdated" do
|
47
|
+
options[:ensure_latest] = true
|
48
|
+
end
|
49
|
+
|
46
50
|
opts.on "-3", "--rails3", "Force Rails 3 mode" do
|
47
51
|
options[:rails3] = true
|
48
52
|
end
|
@@ -229,8 +233,12 @@ module Brakeman::Options
|
|
229
233
|
options[:collapse_mass_assignment] = !separate
|
230
234
|
end
|
231
235
|
|
232
|
-
opts.on "--summary", "Only output summary of warnings" do
|
233
|
-
|
236
|
+
opts.on "--[no-]summary", "Only output summary of warnings" do |summary_only|
|
237
|
+
if summary_only
|
238
|
+
options[:summary_only] = :summary_only
|
239
|
+
else
|
240
|
+
options[:summary_only] = :no_summary
|
241
|
+
end
|
234
242
|
end
|
235
243
|
|
236
244
|
opts.on "--absolute-paths", "Output absolute file paths in reports" do
|
@@ -249,7 +257,7 @@ module Brakeman::Options
|
|
249
257
|
options[:min_confidence] = 3 - level.to_i
|
250
258
|
end
|
251
259
|
|
252
|
-
opts.on "--compare FILE", "Compare the results of a previous
|
260
|
+
opts.on "--compare FILE", "Compare the results of a previous Brakeman scan (only JSON is supported)" do |file|
|
253
261
|
options[:previous_results_json] = File.expand_path(file)
|
254
262
|
end
|
255
263
|
|
@@ -61,6 +61,16 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
61
61
|
handle_module exp, Brakeman::Controller, parent
|
62
62
|
end
|
63
63
|
|
64
|
+
def process_concern concern_name
|
65
|
+
return unless @current_class
|
66
|
+
|
67
|
+
if mod = @tracker.find_class(concern_name)
|
68
|
+
if mod.options[:included]
|
69
|
+
process mod.options[:included].deep_clone
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
64
74
|
#Look for specific calls inside the controller
|
65
75
|
def process_call exp
|
66
76
|
return exp if process_call_defn? exp
|
@@ -89,7 +99,11 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
|
|
89
99
|
else
|
90
100
|
case method
|
91
101
|
when :include
|
92
|
-
|
102
|
+
if @current_class
|
103
|
+
concern = class_name(first_arg)
|
104
|
+
@current_class.add_include concern
|
105
|
+
process_concern concern
|
106
|
+
end
|
93
107
|
when :before_filter, :append_before_filter, :before_action, :append_before_action
|
94
108
|
if node_type? exp.first_arg, :iter
|
95
109
|
add_lambda_filter exp
|
@@ -51,4 +51,16 @@ class Brakeman::LibraryProcessor < Brakeman::BaseProcessor
|
|
51
51
|
process_default exp
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
def process_iter exp
|
56
|
+
res = process_default exp
|
57
|
+
|
58
|
+
if node_type? res, :iter and call? exp.block_call # sometimes this changes after processing
|
59
|
+
if exp.block_call.method == :included
|
60
|
+
(@current_module || @current_class).options[:included] = res.block
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
res
|
65
|
+
end
|
54
66
|
end
|
@@ -7,13 +7,20 @@ class Brakeman::Report::Table < Brakeman::Report::Base
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def generate_report
|
10
|
-
|
11
|
-
"
|
12
|
-
|
13
|
-
|
10
|
+
summary_option = tracker.options[:summary_only]
|
11
|
+
out = ""
|
12
|
+
|
13
|
+
unless summary_option == :no_summary
|
14
|
+
out << text_header <<
|
15
|
+
"\n\n+SUMMARY+\n\n" <<
|
16
|
+
truncate_table(generate_overview.to_s) << "\n\n" <<
|
17
|
+
truncate_table(generate_warning_overview.to_s) << "\n"
|
18
|
+
end
|
14
19
|
|
15
20
|
#Return output early if only summarizing
|
16
|
-
|
21
|
+
if summary_option == :summary_only or summary_option == true
|
22
|
+
return out
|
23
|
+
end
|
17
24
|
|
18
25
|
if tracker.options[:report_routes] or tracker.options[:debug]
|
19
26
|
out << "\n+CONTROLLERS+\n" <<
|
@@ -3,12 +3,18 @@ Brakeman.load_brakeman_dependency 'highline'
|
|
3
3
|
class Brakeman::Report::Text < Brakeman::Report::Base
|
4
4
|
def generate_report
|
5
5
|
HighLine.use_color = !!tracker.options[:output_color]
|
6
|
+
summary_option = tracker.options[:summary_only]
|
6
7
|
@output_string = "\n"
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
unless summary_option == :no_summary
|
10
|
+
add_chunk generate_header
|
11
|
+
add_chunk generate_overview
|
12
|
+
add_chunk generate_warning_overview
|
13
|
+
end
|
14
|
+
|
15
|
+
if summary_option == :summary_only or summary_option == true
|
16
|
+
return @output_string
|
17
|
+
end
|
12
18
|
|
13
19
|
add_chunk generate_controllers if tracker.options[:debug] or tracker.options[:report_routes]
|
14
20
|
add_chunk generate_templates if tracker.options[:debug]
|
@@ -126,6 +132,7 @@ class Brakeman::Report::Text < Brakeman::Report::Base
|
|
126
132
|
out = [
|
127
133
|
label('Confidence', confidence(w.confidence)),
|
128
134
|
label('Category', w.warning_type.to_s),
|
135
|
+
label('Check', w.check.gsub(/^Brakeman::Check/, '')),
|
129
136
|
label('Message', w.message)
|
130
137
|
]
|
131
138
|
|
data/lib/brakeman/tracker.rb
CHANGED
@@ -198,6 +198,16 @@ class Brakeman::Tracker
|
|
198
198
|
@constants.get_literal name unless @options[:disable_constant_tracking]
|
199
199
|
end
|
200
200
|
|
201
|
+
def find_class name
|
202
|
+
[@controllers, @models, @libs].each do |collection|
|
203
|
+
if c = collection[name]
|
204
|
+
return c
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
nil
|
209
|
+
end
|
210
|
+
|
201
211
|
def index_call_sites
|
202
212
|
finder = Brakeman::FindAllCalls.new self
|
203
213
|
|
data/lib/brakeman/version.rb
CHANGED
data/lib/brakeman/warning.rb
CHANGED
@@ -238,6 +238,7 @@ class Brakeman::Warning
|
|
238
238
|
{ :warning_type => self.warning_type,
|
239
239
|
:warning_code => @warning_code,
|
240
240
|
:fingerprint => self.fingerprint,
|
241
|
+
:check_name => self.check.gsub(/^Brakeman::Check/, ''),
|
241
242
|
:message => self.message,
|
242
243
|
:file => self.file,
|
243
244
|
:line => self.line,
|
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.
|
4
|
+
version: 3.5.0
|
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:
|
12
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -79,7 +79,6 @@ files:
|
|
79
79
|
- CHANGES
|
80
80
|
- FEATURES
|
81
81
|
- README.md
|
82
|
-
- WARNING_TYPES
|
83
82
|
- bin/brakeman
|
84
83
|
- lib/brakeman.rb
|
85
84
|
- lib/brakeman/app_tree.rb
|
data/WARNING_TYPES
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
This file describes the various warning types reported by this tool.
|
2
|
-
|
3
|
-
# Attribute Restriction
|
4
|
-
|
5
|
-
This warning comes up if a model does not limit what attributes can be set through mass assignment.
|
6
|
-
|
7
|
-
In particular, this check looks for `attr_accessible` inside model definitions. If it is not found, this warning will be issued.
|
8
|
-
|
9
|
-
Note that disabling mass assignment globally will suppress these warnings.
|
10
|
-
|
11
|
-
# Authentication
|
12
|
-
|
13
|
-
# Basic Auth
|
14
|
-
|
15
|
-
# Command Injection
|
16
|
-
|
17
|
-
Request parameters or string interpolation has been detected in a `system` call. This can lead to someone executing arbitrary commands. Use the safe form of `system` instead, which will pass in arguments safely.
|
18
|
-
|
19
|
-
See http://guides.rubyonrails.org/security.html#command-line-injection for details.
|
20
|
-
|
21
|
-
# Cross Site Scripting
|
22
|
-
|
23
|
-
Cross site scripting warnings are raised when a parameter or model attribute is output through a view without being escaped.
|
24
|
-
|
25
|
-
See http://guides.rubyonrails.org/security.html#cross-site-scripting-xss for details.
|
26
|
-
|
27
|
-
# Cross-Site Request Forgery
|
28
|
-
|
29
|
-
No call to `protect_from_forgery` was found in `ApplicationController`. This method prevents CSRF.
|
30
|
-
|
31
|
-
See http://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf for details.
|
32
|
-
|
33
|
-
# Dangerous Eval
|
34
|
-
|
35
|
-
# Dangerous Send
|
36
|
-
|
37
|
-
# Default Routes
|
38
|
-
|
39
|
-
The general default routes warning means there is a call to `map.connect ":controller/:action/:id"` in config/routes.rb. This allows any public method on any controller to be called as an action.
|
40
|
-
|
41
|
-
If this warning is reported for a particular controller, it means there is a route to that controller containing `:action`.
|
42
|
-
|
43
|
-
Default routes can be dangerous if methods are made public which are not intended to be used as URLs or actions.
|
44
|
-
|
45
|
-
# Denial of Service
|
46
|
-
|
47
|
-
# Dynamic Render Path
|
48
|
-
|
49
|
-
When a call to `render` uses a dynamically generated path, template name, file name, or action, there is the possibility that a user can access templates that should be restricted. The issue may be worse if those templates execute code or modify the database.
|
50
|
-
|
51
|
-
This warning is shown whenever the path to be rendered is not a static string or symbol.
|
52
|
-
|
53
|
-
# File Access
|
54
|
-
|
55
|
-
# Format Validation
|
56
|
-
|
57
|
-
Calls to `validates_format_of ..., :with => //` which do not use `\A` and `\z` as anchors will cause this warning. Using `^` and `$` is not sufficient, as `$` will only match up to a new line. This allows an attacker to put whatever malicious input they would like after a new line character.
|
58
|
-
|
59
|
-
See http://guides.rubyonrails.org/security.html#regular-expressions for details.
|
60
|
-
|
61
|
-
# Information Disclosure
|
62
|
-
|
63
|
-
# Mail Link
|
64
|
-
|
65
|
-
# Mass Assignment
|
66
|
-
|
67
|
-
Mass assignment is a method for initializing models. If the attributes which are set is not restricted, someone may set the attributes to any value they wish.
|
68
|
-
|
69
|
-
Mass assignment can be disabled globally.
|
70
|
-
|
71
|
-
Please see http://railspikes.com/2008/9/22/is-your-rails-application-safe-from-mass-assignment for more details.
|
72
|
-
|
73
|
-
# Nested Attributes
|
74
|
-
|
75
|
-
# Redirect
|
76
|
-
|
77
|
-
Redirects which rely on user-supplied values can be used to "spoof" websites or hide malicious links in otherwise harmless-looking URLs. They can also allow access to restricted areas of a site if the destination is not validated.
|
78
|
-
|
79
|
-
This warning is shown when request parameters are used inside a call to `redirect_to`.
|
80
|
-
|
81
|
-
See http://www.owasp.org/index.php/Top_10_2010-A10 for more information.
|
82
|
-
|
83
|
-
# Remote Code Execution
|
84
|
-
|
85
|
-
# Response Splitting
|
86
|
-
|
87
|
-
# Session Setting
|
88
|
-
|
89
|
-
# SQL Injection
|
90
|
-
|
91
|
-
String interpolation or concatenation has been detected in an SQL query. Use parameterized queries instead.
|
92
|
-
|
93
|
-
See http://guides.rubyonrails.org/security.html#sql-injection for details.
|
94
|
-
|
95
|
-
# SSL Verification Bypass
|