brakeman 5.2.1 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +21 -0
- data/bundle/load.rb +4 -4
- data/bundle/ruby/2.7.0/gems/{parallel-1.21.0 → parallel-1.22.1}/MIT-LICENSE.txt +0 -0
- data/bundle/ruby/2.7.0/gems/{parallel-1.21.0 → parallel-1.22.1}/lib/parallel/processor_count.rb +2 -3
- data/bundle/ruby/2.7.0/gems/parallel-1.22.1/lib/parallel/version.rb +4 -0
- data/bundle/ruby/2.7.0/gems/{parallel-1.21.0 → parallel-1.22.1}/lib/parallel.rb +84 -4
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/History.rdoc +28 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/Manifest.txt +2 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/README.rdoc +8 -6
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/compare/normalize.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/debugging.md +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/gauntlet.md +19 -18
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/rp_extensions.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/rp_stringscanner.rb +0 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby20_parser.rb +10973 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby20_parser.y +14 -27
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby21_parser.rb +10980 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby21_parser.y +14 -27
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby22_parser.rb +11123 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby22_parser.y +14 -27
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby23_parser.rb +11132 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby23_parser.y +14 -27
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby24_parser.rb +11231 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby24_parser.y +14 -27
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby25_parser.rb +11231 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby25_parser.y +14 -27
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby26_parser.rb +11253 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby26_parser.y +14 -27
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby27_parser.rb +12980 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby27_parser.y +19 -41
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby30_parser.rb +13242 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby30_parser.y +65 -90
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby31_parser.rb +13622 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1/lib/ruby3_parser.yy → ruby_parser-3.19.1/lib/ruby31_parser.y} +110 -105
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.19.1/lib/ruby3_parser.yy +3536 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby_lexer.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby_lexer.rex +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby_lexer.rex.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby_lexer_strings.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby_parser.rb +2 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby_parser.yy +19 -41
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/lib/ruby_parser_extras.rb +55 -2
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/tools/munge.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.18.1 → ruby_parser-3.19.1}/tools/ripper.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/History.rdoc +6 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/Manifest.txt +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/README.rdoc +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/lib/composite_sexp_processor.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/lib/pt_testcase.rb +7 -3
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/lib/sexp.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/lib/sexp_matcher.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/lib/strict_sexp.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.16.0 → sexp_processor-4.16.1}/lib/unique.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/COPYING +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/asciidoc.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/babel.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/bluecloth.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/builder.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/coffee.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/commonmarker.rb +11 -1
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/creole.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/csv.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/dummy.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/erb.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/erubi.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/erubis.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/etanni.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/haml.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/kramdown.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/less.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/liquid.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/livescript.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/mapping.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/markaby.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/maruku.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/nokogiri.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/pandoc.rb +23 -15
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/plain.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/prawn.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/radius.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/rdiscount.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/rdoc.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/redcarpet.rb +5 -2
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/redcloth.rb +0 -0
- data/bundle/ruby/2.7.0/gems/tilt-2.0.11/lib/tilt/rst-pandoc.rb +23 -0
- data/bundle/ruby/2.7.0/gems/tilt-2.0.11/lib/tilt/sass.rb +78 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/sigil.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/string.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/template.rb +12 -1
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/typescript.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/wikicloth.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt/yajl.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{tilt-2.0.10 → tilt-2.0.11}/lib/tilt.rb +2 -1
- data/lib/brakeman/app_tree.rb +9 -1
- data/lib/brakeman/checks/check_basic_auth.rb +4 -2
- data/lib/brakeman/checks/check_basic_auth_timing_attack.rb +2 -1
- data/lib/brakeman/checks/check_content_tag.rb +8 -4
- data/lib/brakeman/checks/check_cookie_serialization.rb +2 -1
- data/lib/brakeman/checks/check_create_with.rb +4 -2
- data/lib/brakeman/checks/check_cross_site_scripting.rb +6 -3
- data/lib/brakeman/checks/check_csrf_token_forgery_cve.rb +2 -1
- data/lib/brakeman/checks/check_default_routes.rb +6 -3
- data/lib/brakeman/checks/check_deserialize.rb +2 -1
- data/lib/brakeman/checks/check_detailed_exceptions.rb +4 -2
- data/lib/brakeman/checks/check_digest_dos.rb +2 -1
- data/lib/brakeman/checks/check_divide_by_zero.rb +2 -1
- data/lib/brakeman/checks/check_dynamic_finders.rb +2 -1
- data/lib/brakeman/checks/check_escape_function.rb +2 -1
- data/lib/brakeman/checks/check_evaluation.rb +2 -1
- data/lib/brakeman/checks/check_execute.rb +6 -3
- data/lib/brakeman/checks/check_file_access.rb +2 -1
- data/lib/brakeman/checks/check_file_disclosure.rb +2 -1
- data/lib/brakeman/checks/check_filter_skipping.rb +2 -1
- data/lib/brakeman/checks/check_force_ssl.rb +2 -1
- data/lib/brakeman/checks/check_forgery_setting.rb +4 -2
- data/lib/brakeman/checks/check_header_dos.rb +2 -1
- data/lib/brakeman/checks/check_i18n_xss.rb +2 -1
- data/lib/brakeman/checks/check_jruby_xml.rb +2 -1
- data/lib/brakeman/checks/check_json_encoding.rb +2 -1
- data/lib/brakeman/checks/check_json_entity_escape.rb +4 -2
- data/lib/brakeman/checks/check_json_parsing.rb +4 -2
- data/lib/brakeman/checks/check_link_to.rb +2 -1
- data/lib/brakeman/checks/check_link_to_href.rb +4 -2
- data/lib/brakeman/checks/check_mail_to.rb +2 -1
- data/lib/brakeman/checks/check_mass_assignment.rb +6 -3
- data/lib/brakeman/checks/check_mime_type_dos.rb +2 -1
- data/lib/brakeman/checks/check_model_attr_accessible.rb +2 -1
- data/lib/brakeman/checks/check_model_attributes.rb +4 -2
- data/lib/brakeman/checks/check_model_serialize.rb +2 -1
- data/lib/brakeman/checks/check_nested_attributes.rb +2 -1
- data/lib/brakeman/checks/check_nested_attributes_bypass.rb +2 -1
- data/lib/brakeman/checks/check_number_to_currency.rb +4 -2
- data/lib/brakeman/checks/check_page_caching_cve.rb +2 -1
- data/lib/brakeman/checks/check_permit_attributes.rb +2 -1
- data/lib/brakeman/checks/check_quote_table_name.rb +2 -1
- data/lib/brakeman/checks/check_redirect.rb +2 -1
- data/lib/brakeman/checks/check_regex_dos.rb +2 -1
- data/lib/brakeman/checks/check_render.rb +4 -2
- data/lib/brakeman/checks/check_render_dos.rb +2 -1
- data/lib/brakeman/checks/check_render_inline.rb +4 -2
- data/lib/brakeman/checks/check_response_splitting.rb +2 -1
- data/lib/brakeman/checks/check_reverse_tabnabbing.rb +2 -1
- data/lib/brakeman/checks/check_route_dos.rb +2 -1
- data/lib/brakeman/checks/check_safe_buffer_manipulation.rb +2 -1
- data/lib/brakeman/checks/check_sanitize_config_cve.rb +120 -0
- data/lib/brakeman/checks/check_sanitize_methods.rb +6 -3
- data/lib/brakeman/checks/check_secrets.rb +2 -1
- data/lib/brakeman/checks/check_select_tag.rb +2 -1
- data/lib/brakeman/checks/check_select_vulnerability.rb +2 -1
- data/lib/brakeman/checks/check_send.rb +2 -1
- data/lib/brakeman/checks/check_session_manipulation.rb +2 -1
- data/lib/brakeman/checks/check_session_settings.rb +6 -3
- data/lib/brakeman/checks/check_simple_format.rb +4 -2
- data/lib/brakeman/checks/check_single_quotes.rb +2 -1
- data/lib/brakeman/checks/check_skip_before_filter.rb +4 -2
- data/lib/brakeman/checks/check_sprockets_path_traversal.rb +2 -1
- data/lib/brakeman/checks/check_sql.rb +7 -4
- data/lib/brakeman/checks/check_sql_cves.rb +4 -2
- data/lib/brakeman/checks/check_ssl_verify.rb +2 -1
- data/lib/brakeman/checks/check_strip_tags.rb +6 -3
- data/lib/brakeman/checks/check_symbol_dos.rb +2 -1
- data/lib/brakeman/checks/check_symbol_dos_cve.rb +2 -1
- data/lib/brakeman/checks/check_template_injection.rb +2 -1
- data/lib/brakeman/checks/check_translate_bug.rb +2 -1
- data/lib/brakeman/checks/check_unsafe_reflection.rb +9 -3
- data/lib/brakeman/checks/check_unsafe_reflection_methods.rb +2 -1
- data/lib/brakeman/checks/check_unscoped_find.rb +2 -1
- data/lib/brakeman/checks/check_validation_regex.rb +2 -1
- data/lib/brakeman/checks/check_verb_confusion.rb +2 -1
- data/lib/brakeman/checks/check_weak_hash.rb +6 -3
- data/lib/brakeman/checks/check_without_protection.rb +2 -1
- data/lib/brakeman/checks/check_xml_dos.rb +2 -1
- data/lib/brakeman/checks/check_yaml_parsing.rb +4 -2
- data/lib/brakeman/checks/eol_check.rb +4 -2
- data/lib/brakeman/options.rb +1 -1
- data/lib/brakeman/processors/alias_processor.rb +41 -2
- data/lib/brakeman/processors/lib/find_all_calls.rb +1 -0
- data/lib/brakeman/report/ignore/interactive.rb +2 -2
- data/lib/brakeman/report/report_csv.rb +2 -0
- data/lib/brakeman/report/report_junit.rb +2 -2
- data/lib/brakeman/report/report_table.rb +5 -5
- data/lib/brakeman/report/report_text.rb +2 -0
- data/lib/brakeman/report/templates/controller_warnings.html.erb +2 -0
- data/lib/brakeman/report/templates/ignored_warnings.html.erb +2 -0
- data/lib/brakeman/report/templates/model_warnings.html.erb +2 -0
- data/lib/brakeman/report/templates/security_warnings.html.erb +2 -0
- data/lib/brakeman/report/templates/view_warnings.html.erb +2 -0
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning.rb +5 -2
- data/lib/brakeman/warning_codes.rb +1 -0
- metadata +95 -92
- data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/version.rb +0 -4
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby20_parser.rb +0 -7128
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby21_parser.rb +0 -7182
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby22_parser.rb +0 -7228
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby23_parser.rb +0 -7237
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby24_parser.rb +0 -7268
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby25_parser.rb +0 -7268
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby26_parser.rb +0 -7287
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby27_parser.rb +0 -8517
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.rb +0 -8751
- data/bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/rst-pandoc.rb +0 -18
- data/bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/sass.rb +0 -52
@@ -40,7 +40,8 @@ class Brakeman::CheckUnscopedFind < Brakeman::BaseCheck
|
|
40
40
|
:message => msg("Unscoped call to ", msg_code("#{result[:target]}##{result[:method]}")),
|
41
41
|
:code => result[:call],
|
42
42
|
:confidence => :weak,
|
43
|
-
:user_input => input
|
43
|
+
:user_input => input,
|
44
|
+
:cwe_id => [285]
|
44
45
|
end
|
45
46
|
|
46
47
|
def optional_belongs_to? exp
|
@@ -91,7 +91,8 @@ class Brakeman::CheckValidationRegex < Brakeman::BaseCheck
|
|
91
91
|
:warning_code => :validation_regex,
|
92
92
|
:message => msg("Insufficient validation for ", msg_code(get_name validator), " using ", msg_code(regex.inspect), ". Use ", msg_code("\\A"), " and ", msg_code("\\z"), " as anchors"),
|
93
93
|
:line => value.line,
|
94
|
-
:confidence => :high
|
94
|
+
:confidence => :high,
|
95
|
+
:cwe_id => [777]
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
@@ -53,7 +53,8 @@ class Brakeman::CheckWeakHash < Brakeman::BaseCheck
|
|
53
53
|
:warning_code => :weak_hash_digest,
|
54
54
|
:message => message,
|
55
55
|
:confidence => confidence,
|
56
|
-
:user_input => input
|
56
|
+
:user_input => input,
|
57
|
+
:cwe_id => [328]
|
57
58
|
end
|
58
59
|
|
59
60
|
def process_hmac_result result
|
@@ -74,7 +75,8 @@ class Brakeman::CheckWeakHash < Brakeman::BaseCheck
|
|
74
75
|
:warning_type => "Weak Hash",
|
75
76
|
:warning_code => :weak_hash_hmac,
|
76
77
|
:message => message,
|
77
|
-
:confidence => :medium
|
78
|
+
:confidence => :medium,
|
79
|
+
:cwe_id => [328]
|
78
80
|
end
|
79
81
|
|
80
82
|
def process_openssl_result result
|
@@ -90,7 +92,8 @@ class Brakeman::CheckWeakHash < Brakeman::BaseCheck
|
|
90
92
|
:warning_type => "Weak Hash",
|
91
93
|
:warning_code => :weak_hash_digest,
|
92
94
|
:message => msg("Weak hashing algorithm used: ", msg_lit(alg)),
|
93
|
-
:confidence => :medium
|
95
|
+
:confidence => :medium,
|
96
|
+
:cwe_id => [328]
|
94
97
|
end
|
95
98
|
end
|
96
99
|
end
|
@@ -30,7 +30,8 @@ class Brakeman::CheckXMLDoS < Brakeman::BaseCheck
|
|
30
30
|
:message => message,
|
31
31
|
:confidence => :medium,
|
32
32
|
:gem_info => gemfile_or_environment,
|
33
|
-
:link_path => "https://groups.google.com/d/msg/rubyonrails-security/bahr2JLnxvk/x4EocXnHPp8J"
|
33
|
+
:link_path => "https://groups.google.com/d/msg/rubyonrails-security/bahr2JLnxvk/x4EocXnHPp8J",
|
34
|
+
:cwe_id => [125]
|
34
35
|
end
|
35
36
|
|
36
37
|
def has_workaround?
|
@@ -29,7 +29,8 @@ class Brakeman::CheckYAMLParsing < Brakeman::BaseCheck
|
|
29
29
|
:message => message,
|
30
30
|
:confidence => :high,
|
31
31
|
:gem_info => gemfile_or_environment,
|
32
|
-
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/61bkgvnSGTQ/discussion"
|
32
|
+
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/61bkgvnSGTQ/discussion",
|
33
|
+
:cwe_id => [20]
|
33
34
|
end
|
34
35
|
|
35
36
|
#Warn if app accepts YAML
|
@@ -41,7 +42,8 @@ class Brakeman::CheckYAMLParsing < Brakeman::BaseCheck
|
|
41
42
|
:message => message,
|
42
43
|
:confidence => :high,
|
43
44
|
:gem_info => gemfile_or_environment,
|
44
|
-
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/61bkgvnSGTQ/discussion"
|
45
|
+
:link_path => "https://groups.google.com/d/topic/rubyonrails-security/61bkgvnSGTQ/discussion",
|
46
|
+
:cwe_id => [20]
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
@@ -34,7 +34,8 @@ class Brakeman::EOLCheck < Brakeman::BaseCheck
|
|
34
34
|
warning_code: :"pending_eol_#{library}",
|
35
35
|
message: msg("Support for ", msg_version(version, library.capitalize), " ends on #{eol_date}"),
|
36
36
|
confidence: confidence,
|
37
|
-
gem_info: gemfile_or_environment
|
37
|
+
gem_info: gemfile_or_environment,
|
38
|
+
:cwe_id => [1104]
|
38
39
|
end
|
39
40
|
|
40
41
|
def warn_about_unsupported_version library, eol_date, version
|
@@ -42,6 +43,7 @@ class Brakeman::EOLCheck < Brakeman::BaseCheck
|
|
42
43
|
warning_code: :"eol_#{library}",
|
43
44
|
message: msg("Support for ", msg_version(version, library.capitalize), " ended on #{eol_date}"),
|
44
45
|
confidence: :high,
|
45
|
-
gem_info: gemfile_or_environment
|
46
|
+
gem_info: gemfile_or_environment,
|
47
|
+
:cwe_id => [1104]
|
46
48
|
end
|
47
49
|
end
|
data/lib/brakeman/options.rb
CHANGED
@@ -323,7 +323,7 @@ module Brakeman::Options
|
|
323
323
|
end
|
324
324
|
|
325
325
|
opts.on "--text-fields field1,field2,etc.", Array, "Specify fields for text report format" do |format|
|
326
|
-
valid_options = [:category, :category_id, :check, :code, :confidence, :file, :fingerprint, :line, :link, :message, :render_path]
|
326
|
+
valid_options = [:category, :category_id, :check, :code, :confidence, :cwe, :file, :fingerprint, :line, :link, :message, :render_path]
|
327
327
|
|
328
328
|
options[:text_fields] = format.map(&:to_sym)
|
329
329
|
|
@@ -404,7 +404,7 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
|
|
404
404
|
end
|
405
405
|
|
406
406
|
def join_item item, join_value
|
407
|
-
if item.is_a?
|
407
|
+
if item.nil? || item.is_a?(String)
|
408
408
|
"#{item}#{join_value}"
|
409
409
|
elsif string? item or symbol? item or number? item
|
410
410
|
s(:str, "#{item.value}#{join_value}").line(item.line)
|
@@ -703,7 +703,30 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
|
|
703
703
|
end
|
704
704
|
end
|
705
705
|
|
706
|
-
|
706
|
+
# Return early unless there might be short-hand syntax,
|
707
|
+
# since handling it is kind of expensive.
|
708
|
+
return exp unless exp.any? { |e| e.nil? }
|
709
|
+
|
710
|
+
# Need to handle short-hand hash syntax
|
711
|
+
new_hash = [:hash]
|
712
|
+
hash_iterate(exp) do |key, value|
|
713
|
+
# e.g. { a: }
|
714
|
+
if value.nil? and symbol? key
|
715
|
+
# Only handling local variables for now, not calls
|
716
|
+
lvar = s(:lvar, key.value)
|
717
|
+
if var_value = env[lvar]
|
718
|
+
new_hash << key << var_value.deep_clone(key.line || 0)
|
719
|
+
else
|
720
|
+
# If the value is unknown, assume it was a call
|
721
|
+
# and set the value to a call
|
722
|
+
new_hash.concat << key << s(:call, nil, key.value).line(key.line || 0)
|
723
|
+
end
|
724
|
+
else
|
725
|
+
new_hash.concat << key << value
|
726
|
+
end
|
727
|
+
end
|
728
|
+
|
729
|
+
Sexp.from_array(new_hash).line(exp.line || 0)
|
707
730
|
end
|
708
731
|
|
709
732
|
#Merge values into hash when processing
|
@@ -864,6 +887,9 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
|
|
864
887
|
elsif false? condition
|
865
888
|
no_branch = true
|
866
889
|
exps = [nil, exp.else_clause]
|
890
|
+
elsif equality_check? condition and condition.target == condition.first_arg
|
891
|
+
no_branch = true
|
892
|
+
exps = [exp.then_clause, nil]
|
867
893
|
else
|
868
894
|
no_branch = false
|
869
895
|
exps = [exp.then_clause, exp.else_clause]
|
@@ -897,6 +923,14 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
|
|
897
923
|
env.current[var] = safe_literal(var.line)
|
898
924
|
exp[branch_index] = process_if_branch branch
|
899
925
|
env.current[var] = previous_value
|
926
|
+
elsif i == 0 and equality_check? condition
|
927
|
+
# For conditions like a == b,
|
928
|
+
# set a to b inside the true branch
|
929
|
+
var = condition.target
|
930
|
+
previous_value = env.current[var]
|
931
|
+
env.current[var] = condition.first_arg
|
932
|
+
exp[branch_index] = process_if_branch branch
|
933
|
+
env.current[var] = previous_value
|
900
934
|
elsif i == 1 and hash_or_array_include_all_literals? condition and early_return? branch
|
901
935
|
var = condition.first_arg
|
902
936
|
env.current[var] = safe_literal(var.line)
|
@@ -931,6 +965,11 @@ class Brakeman::AliasProcessor < Brakeman::SexpProcessor
|
|
931
965
|
end
|
932
966
|
end
|
933
967
|
|
968
|
+
def equality_check? exp
|
969
|
+
call? exp and
|
970
|
+
exp.method == :==
|
971
|
+
end
|
972
|
+
|
934
973
|
def simple_when? exp
|
935
974
|
node_type? exp[1], :array and
|
936
975
|
not node_type? exp[1][1], :splat, :array and
|
@@ -5,6 +5,7 @@ class Brakeman::Report::CSV < Brakeman::Report::Base
|
|
5
5
|
headers = [
|
6
6
|
"Confidence",
|
7
7
|
"Warning Type",
|
8
|
+
"CWE",
|
8
9
|
"File",
|
9
10
|
"Line",
|
10
11
|
"Message",
|
@@ -35,6 +36,7 @@ class Brakeman::Report::CSV < Brakeman::Report::Base
|
|
35
36
|
[
|
36
37
|
warning.confidence_name,
|
37
38
|
warning.warning_type,
|
39
|
+
warning.cwe_id.first,
|
38
40
|
warning_file(warning),
|
39
41
|
warning.line,
|
40
42
|
warning.message,
|
@@ -98,7 +98,7 @@ class Brakeman::Report::Table < Brakeman::Report::Base
|
|
98
98
|
render_warnings generic_warnings,
|
99
99
|
:warning,
|
100
100
|
'security_warnings',
|
101
|
-
["Confidence", "Class", "Method", "Warning Type", "Message"],
|
101
|
+
["Confidence", "Class", "Method", "Warning Type", "CWE ID", "Message"],
|
102
102
|
'Class'
|
103
103
|
end
|
104
104
|
|
@@ -107,7 +107,7 @@ class Brakeman::Report::Table < Brakeman::Report::Base
|
|
107
107
|
render_warnings template_warnings,
|
108
108
|
:template,
|
109
109
|
'view_warnings',
|
110
|
-
['Confidence', 'Template', 'Warning Type', 'Message'],
|
110
|
+
['Confidence', 'Template', 'Warning Type', "CWE ID", 'Message'],
|
111
111
|
'Template'
|
112
112
|
|
113
113
|
end
|
@@ -117,7 +117,7 @@ class Brakeman::Report::Table < Brakeman::Report::Base
|
|
117
117
|
render_warnings model_warnings,
|
118
118
|
:model,
|
119
119
|
'model_warnings',
|
120
|
-
['Confidence', 'Model', 'Warning Type', 'Message'],
|
120
|
+
['Confidence', 'Model', 'Warning Type', "CWE ID", 'Message'],
|
121
121
|
'Model'
|
122
122
|
end
|
123
123
|
|
@@ -126,7 +126,7 @@ class Brakeman::Report::Table < Brakeman::Report::Base
|
|
126
126
|
render_warnings controller_warnings,
|
127
127
|
:controller,
|
128
128
|
'controller_warnings',
|
129
|
-
['Confidence', 'Controller', 'Warning Type', 'Message'],
|
129
|
+
['Confidence', 'Controller', 'Warning Type', "CWE ID", 'Message'],
|
130
130
|
'Controller'
|
131
131
|
end
|
132
132
|
|
@@ -134,7 +134,7 @@ class Brakeman::Report::Table < Brakeman::Report::Base
|
|
134
134
|
render_warnings ignored_warnings,
|
135
135
|
:ignored,
|
136
136
|
'ignored_warnings',
|
137
|
-
['Confidence', 'Warning Type', 'File', 'Message'],
|
137
|
+
['Confidence', 'Warning Type', "CWE ID", 'File', 'Message'],
|
138
138
|
'Warning Type'
|
139
139
|
end
|
140
140
|
|
@@ -159,6 +159,8 @@ class Brakeman::Report::Text < Brakeman::Report::Base
|
|
159
159
|
label('Confidence', confidence(w.confidence))
|
160
160
|
when :category
|
161
161
|
label('Category', w.warning_type.to_s)
|
162
|
+
when :cwe
|
163
|
+
label('CWE', w.cwe_id.join(', '))
|
162
164
|
when :check
|
163
165
|
label('Check', w.check_name)
|
164
166
|
when :message
|
@@ -5,6 +5,7 @@
|
|
5
5
|
<th>Confidence</th>
|
6
6
|
<th>Controller</th>
|
7
7
|
<th>Warning Type</th>
|
8
|
+
<th>CWE ID</th>
|
8
9
|
<th>Message</th>
|
9
10
|
</tr>
|
10
11
|
</thead>
|
@@ -14,6 +15,7 @@
|
|
14
15
|
<td><%= warning['Confidence']%></td>
|
15
16
|
<td><%= warning['Controller']%></td>
|
16
17
|
<td><%= warning['Warning Type']%></td>
|
18
|
+
<td><%= warning['CWE ID']%></td>
|
17
19
|
<td><%= warning['Message']%></td>
|
18
20
|
</tr>
|
19
21
|
<% end %>
|
@@ -6,6 +6,7 @@
|
|
6
6
|
<th>Confidence</th>
|
7
7
|
<th>File</th>
|
8
8
|
<th>Warning Type</th>
|
9
|
+
<th>CWE ID</th>
|
9
10
|
<th>Message</th>
|
10
11
|
<th>Note</th>
|
11
12
|
</tr>
|
@@ -16,6 +17,7 @@
|
|
16
17
|
<td><%= warning['Confidence']%></td>
|
17
18
|
<td><%= warning['File']%></td>
|
18
19
|
<td><%= warning['Warning Type']%></td>
|
20
|
+
<td><%= warning['CWE ID']%></td>
|
19
21
|
<td><%= warning['Message']%></td>
|
20
22
|
<td><%= warning['Note']%></td>
|
21
23
|
</tr>
|
@@ -5,6 +5,7 @@
|
|
5
5
|
<th>Confidence</th>
|
6
6
|
<th>Model</th>
|
7
7
|
<th>Warning Type</th>
|
8
|
+
<th>CWE ID</th>
|
8
9
|
<th>Message</th>
|
9
10
|
</tr>
|
10
11
|
</thead>
|
@@ -14,6 +15,7 @@
|
|
14
15
|
<td><%= warning['Confidence']%></td>
|
15
16
|
<td><%= warning['Model']%></td>
|
16
17
|
<td><%= warning['Warning Type']%></td>
|
18
|
+
<td><%= warning['CWE ID']%></td>
|
17
19
|
<td><%= warning['Message']%></td>
|
18
20
|
</tr>
|
19
21
|
<% end %>
|
@@ -6,6 +6,7 @@
|
|
6
6
|
<th>Class</th>
|
7
7
|
<th>Method</th>
|
8
8
|
<th>Warning Type</th>
|
9
|
+
<th>CWE ID</th>
|
9
10
|
<th>Message</th>
|
10
11
|
</tr>
|
11
12
|
</thead>
|
@@ -16,6 +17,7 @@
|
|
16
17
|
<td><%= warning['Class']%></td>
|
17
18
|
<td><%= warning['Method']%></td>
|
18
19
|
<td><%= warning['Warning Type']%></td>
|
20
|
+
<td><%= warning['CWE ID']%></td>
|
19
21
|
<td><%= warning['Message']%></td>
|
20
22
|
</tr>
|
21
23
|
<% end %>
|
@@ -5,6 +5,7 @@
|
|
5
5
|
<th>Confidence</th>
|
6
6
|
<th>Template</th>
|
7
7
|
<th>Warning Type</th>
|
8
|
+
<th>CWE ID</th>
|
8
9
|
<th>Message</th>
|
9
10
|
</tr>
|
10
11
|
</thead>
|
@@ -27,6 +28,7 @@
|
|
27
28
|
<% end %>
|
28
29
|
</td>
|
29
30
|
<td><%= warning['Warning Type']%></td>
|
31
|
+
<td><%= warning['CWE ID']%></td>
|
30
32
|
<td><%= warning['Message']%></td>
|
31
33
|
</tr>
|
32
34
|
<% end %>
|
data/lib/brakeman/version.rb
CHANGED
data/lib/brakeman/warning.rb
CHANGED
@@ -5,7 +5,7 @@ require 'brakeman/messages'
|
|
5
5
|
|
6
6
|
#The Warning class stores information about warnings
|
7
7
|
class Brakeman::Warning
|
8
|
-
attr_reader :called_from, :check, :class, :confidence, :controller,
|
8
|
+
attr_reader :called_from, :check, :class, :confidence, :controller, :cwe_id,
|
9
9
|
:line, :method, :model, :template, :user_input, :user_input_type,
|
10
10
|
:warning_code, :warning_set, :warning_type
|
11
11
|
|
@@ -31,6 +31,7 @@ class Brakeman::Warning
|
|
31
31
|
:class => :@class,
|
32
32
|
:code => :@code,
|
33
33
|
:controller => :@controller,
|
34
|
+
:cwe_id => :@cwe_id,
|
34
35
|
:file => :@file,
|
35
36
|
:gem_info => :@gem_info,
|
36
37
|
:line => :@line,
|
@@ -219,6 +220,7 @@ class Brakeman::Warning
|
|
219
220
|
def to_row type = :warning
|
220
221
|
@row = { "Confidence" => TEXT_CONFIDENCE[self.confidence],
|
221
222
|
"Warning Type" => self.warning_type.to_s,
|
223
|
+
"CWE ID" => self.cwe_id,
|
222
224
|
"Message" => self.message }
|
223
225
|
|
224
226
|
case type
|
@@ -302,7 +304,8 @@ class Brakeman::Warning
|
|
302
304
|
:render_path => render_path,
|
303
305
|
:location => self.location(false),
|
304
306
|
:user_input => (@user_input && self.format_user_input(false)),
|
305
|
-
:confidence => self.confidence_name
|
307
|
+
:confidence => self.confidence_name,
|
308
|
+
:cwe_id => cwe_id
|
306
309
|
}
|
307
310
|
end
|
308
311
|
|