brakeman 5.0.0 → 5.1.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 +46 -0
- data/README.md +10 -1
- data/bundle/load.rb +4 -3
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/MIT-LICENSE.txt +20 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel.rb +523 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel/processor_count.rb +42 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel/version.rb +3 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/LICENSE.txt +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/NEWS.md +37 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/README.md +2 -14
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/attlistdecl.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/attribute.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/cdata.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/child.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/comment.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/doctype.rb +55 -31
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/document.rb +194 -34
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/dtd/attlistdecl.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/dtd/dtd.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/dtd/elementdecl.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/dtd/entitydecl.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/dtd/notationdecl.rb +0 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/encoding.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/entity.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/formatters/default.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/formatters/pretty.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/formatters/transitive.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/functions.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/instruction.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/light/node.rb +0 -8
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/namespace.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/node.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/output.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parent.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parseexception.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parsers/baseparser.rb +139 -39
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parsers/lightparser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parsers/pullparser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parsers/sax2parser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parsers/streamparser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parsers/treeparser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parsers/ultralightparser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/parsers/xpathparser.rb +25 -11
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/quickpath.rb +0 -0
- data/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/sax2listener.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/security.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/source.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/streamlistener.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/text.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/undefinednamespaceexception.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/validation/relaxng.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/validation/validation.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/validation/validationexception.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/xmldecl.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/xmltokens.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/xpath.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{rexml-3.2.4 → rexml-3.2.5}/lib/rexml/xpath_parser.rb +36 -30
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/History.rdoc +19 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/Manifest.txt +2 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/README.rdoc +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/compare/normalize.rb +2 -2
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/debugging.md +190 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/rp_extensions.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/rp_stringscanner.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby20_parser.rb +2550 -2537
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby20_parser.y +9 -1
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby21_parser.rb +7148 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby21_parser.y +9 -1
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby22_parser.rb +7185 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby22_parser.y +9 -1
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby23_parser.rb +2585 -2561
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby23_parser.y +9 -1
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby24_parser.rb +2622 -2607
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby24_parser.y +9 -1
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby25_parser.rb +2612 -2598
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby25_parser.y +9 -1
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby26_parser.rb +2610 -2594
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby26_parser.y +10 -1
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby27_parser.rb +7358 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby27_parser.y +47 -1
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby30_parser.rb +7358 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby30_parser.y +2703 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby_lexer.rb +19 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby_lexer.rex +1 -1
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby_lexer.rex.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby_parser.rb +2 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby_parser.yy +57 -1
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby_parser_extras.rb +2 -2
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/tools/munge.rb +2 -2
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/tools/ripper.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/History.rdoc +6 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/Manifest.txt +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/README.rdoc +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/composite_sexp_processor.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/pt_testcase.rb +2 -2
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/sexp.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/sexp_matcher.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/strict_sexp.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/unique.rb +0 -0
- data/lib/brakeman.rb +23 -8
- data/lib/brakeman/checks/check_detailed_exceptions.rb +1 -1
- data/lib/brakeman/checks/check_evaluation.rb +1 -1
- data/lib/brakeman/checks/check_execute.rb +10 -0
- data/lib/brakeman/checks/check_mass_assignment.rb +4 -6
- data/lib/brakeman/checks/check_render.rb +15 -1
- data/lib/brakeman/checks/check_sanitize_methods.rb +2 -1
- data/lib/brakeman/checks/check_sql.rb +58 -8
- data/lib/brakeman/checks/check_verb_confusion.rb +1 -1
- data/lib/brakeman/commandline.rb +1 -1
- data/lib/brakeman/file_parser.rb +45 -15
- data/lib/brakeman/options.rb +7 -2
- data/lib/brakeman/parsers/template_parser.rb +24 -0
- data/lib/brakeman/processors/alias_processor.rb +105 -18
- data/lib/brakeman/processors/base_processor.rb +4 -4
- data/lib/brakeman/processors/controller_alias_processor.rb +6 -43
- data/lib/brakeman/processors/lib/call_conversion_helper.rb +10 -6
- data/lib/brakeman/processors/lib/rails4_config_processor.rb +2 -1
- data/lib/brakeman/processors/library_processor.rb +9 -0
- data/lib/brakeman/processors/model_processor.rb +31 -0
- data/lib/brakeman/report.rb +4 -1
- data/lib/brakeman/report/ignore/config.rb +4 -4
- data/lib/brakeman/report/ignore/interactive.rb +1 -1
- data/lib/brakeman/report/report_github.rb +31 -0
- data/lib/brakeman/report/report_sarif.rb +21 -2
- data/lib/brakeman/rescanner.rb +1 -1
- data/lib/brakeman/scanner.rb +4 -1
- data/lib/brakeman/tracker.rb +33 -4
- data/lib/brakeman/tracker/collection.rb +57 -7
- data/lib/brakeman/tracker/method_info.rb +70 -0
- data/lib/brakeman/util.rb +34 -18
- data/lib/brakeman/version.rb +1 -1
- data/lib/ruby_parser/bm_sexp.rb +14 -0
- metadata +104 -97
- data/bundle/ruby/2.7.0/gems/rexml-3.2.4/Gemfile +0 -6
- data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/element.rb +0 -1269
- data/bundle/ruby/2.7.0/gems/rexml-3.2.4/lib/rexml/rexml.rb +0 -32
- data/bundle/ruby/2.7.0/gems/rexml-3.2.4/rexml.gemspec +0 -84
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/debugging.md +0 -57
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby21_parser.rb +0 -7140
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby22_parser.rb +0 -7160
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.15.1/lib/ruby27_parser.rb +0 -7224
@@ -25,6 +25,11 @@ class RubyLexer
|
|
25
25
|
|
26
26
|
HAS_ENC = "".respond_to? :encoding
|
27
27
|
|
28
|
+
BTOKENS = {
|
29
|
+
".." => :tBDOT2,
|
30
|
+
"..." => :tBDOT3,
|
31
|
+
}
|
32
|
+
|
28
33
|
TOKENS = {
|
29
34
|
"!" => :tBANG,
|
30
35
|
"!=" => :tNEQ,
|
@@ -131,6 +136,10 @@ class RubyLexer
|
|
131
136
|
ss.eos?
|
132
137
|
end
|
133
138
|
|
139
|
+
def expr_beg?
|
140
|
+
lex_state =~ EXPR_BEG
|
141
|
+
end
|
142
|
+
|
134
143
|
def expr_dot?
|
135
144
|
lex_state =~ EXPR_DOT
|
136
145
|
end
|
@@ -580,6 +589,12 @@ class RubyLexer
|
|
580
589
|
end
|
581
590
|
end
|
582
591
|
|
592
|
+
def process_dots text
|
593
|
+
tokens = ruby27plus? && expr_beg? ? BTOKENS : TOKENS
|
594
|
+
|
595
|
+
result EXPR_BEG, tokens[text], text
|
596
|
+
end
|
597
|
+
|
583
598
|
def process_float text
|
584
599
|
rb_compile_error "Invalid numeric format" if text =~ /__/
|
585
600
|
|
@@ -1136,6 +1151,10 @@ class RubyLexer
|
|
1136
1151
|
parser.class.version <= 24
|
1137
1152
|
end
|
1138
1153
|
|
1154
|
+
def ruby27plus?
|
1155
|
+
parser.class.version >= 27
|
1156
|
+
end
|
1157
|
+
|
1139
1158
|
def scan re
|
1140
1159
|
ss.scan re
|
1141
1160
|
end
|
@@ -48,7 +48,7 @@ rule
|
|
48
48
|
| /\![=~]?/ { result :arg_state, TOKENS[text], text }
|
49
49
|
|
50
50
|
: /\./
|
51
|
-
| /\.\.\.?/
|
51
|
+
| /\.\.\.?/ process_dots
|
52
52
|
| /\.\d/ { rb_compile_error "no .<digit> floating literal anymore put 0 before dot" }
|
53
53
|
| /\./ { self.lex_state = EXPR_BEG; result EXPR_DOT, :tDOT, "." }
|
54
54
|
|
@@ -138,7 +138,7 @@ class RubyLexer
|
|
138
138
|
when ss.match?(/\./) then
|
139
139
|
case
|
140
140
|
when text = ss.scan(/\.\.\.?/) then
|
141
|
-
|
141
|
+
process_dots text
|
142
142
|
when ss.skip(/\.\d/) then
|
143
143
|
action { rb_compile_error "no .<digit> floating literal anymore put 0 before dot" }
|
144
144
|
when ss.skip(/\./) then
|
@@ -79,10 +79,12 @@ require "ruby24_parser"
|
|
79
79
|
require "ruby25_parser"
|
80
80
|
require "ruby26_parser"
|
81
81
|
require "ruby27_parser"
|
82
|
+
require "ruby30_parser"
|
82
83
|
|
83
84
|
class RubyParser # HACK
|
84
85
|
VERSIONS.clear # also a HACK caused by racc namespace issues
|
85
86
|
|
87
|
+
class V30 < ::Ruby30Parser; end
|
86
88
|
class V27 < ::Ruby27Parser; end
|
87
89
|
class V26 < ::Ruby26Parser; end
|
88
90
|
class V25 < ::Ruby25Parser; end
|
@@ -16,6 +16,8 @@ class Ruby25Parser
|
|
16
16
|
class Ruby26Parser
|
17
17
|
#elif V == 27
|
18
18
|
class Ruby27Parser
|
19
|
+
#elif V == 30
|
20
|
+
class Ruby30Parser
|
19
21
|
#else
|
20
22
|
fail "version not specified or supported on code generation"
|
21
23
|
#endif
|
@@ -46,6 +48,9 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
|
|
46
48
|
#if V >= 23
|
47
49
|
tLONELY
|
48
50
|
#endif
|
51
|
+
#if V >= 26
|
52
|
+
tBDOT2 tBDOT3
|
53
|
+
#endif
|
49
54
|
|
50
55
|
preclow
|
51
56
|
nonassoc tLOWEST
|
@@ -57,7 +62,7 @@ preclow
|
|
57
62
|
right tEQL tOP_ASGN
|
58
63
|
left kRESCUE_MOD
|
59
64
|
right tEH tCOLON
|
60
|
-
nonassoc tDOT2 tDOT3
|
65
|
+
nonassoc tDOT2 tDOT3 tBDOT2 tBDOT3
|
61
66
|
left tOROP
|
62
67
|
left tANDOP
|
63
68
|
nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
|
@@ -80,6 +85,9 @@ rule
|
|
80
85
|
top_compstmt
|
81
86
|
{
|
82
87
|
result = new_compstmt val
|
88
|
+
|
89
|
+
lexer.cond.pop # local_pop
|
90
|
+
lexer.cmdarg.pop
|
83
91
|
}
|
84
92
|
|
85
93
|
top_compstmt: top_stmts opt_terms
|
@@ -856,6 +864,24 @@ rule
|
|
856
864
|
result = s(:dot3, v1, v2).line v1.line
|
857
865
|
}
|
858
866
|
#endif
|
867
|
+
|
868
|
+
#if V >= 27
|
869
|
+
| tBDOT2 arg
|
870
|
+
{
|
871
|
+
_, v2, = val
|
872
|
+
v1 = nil
|
873
|
+
|
874
|
+
result = s(:dot2, v1, v2).line v2.line
|
875
|
+
}
|
876
|
+
| tBDOT3 arg
|
877
|
+
{
|
878
|
+
_, v2 = val
|
879
|
+
v1 = nil
|
880
|
+
|
881
|
+
result = s(:dot3, v1, v2).line v2.line
|
882
|
+
}
|
883
|
+
#endif
|
884
|
+
|
859
885
|
| arg tPLUS arg
|
860
886
|
{
|
861
887
|
result = new_call val[0], :+, argl(val[2])
|
@@ -1040,6 +1066,18 @@ rule
|
|
1040
1066
|
_, args, _ = val
|
1041
1067
|
result = args
|
1042
1068
|
}
|
1069
|
+
#if V >= 27
|
1070
|
+
| tLPAREN2 args_forward rparen
|
1071
|
+
{
|
1072
|
+
if (!self.lexer.is_local_id(:"*") ||
|
1073
|
+
!self.lexer.is_local_id(:"**") ||
|
1074
|
+
!self.lexer.is_local_id(:"&")) then
|
1075
|
+
|
1076
|
+
yyerror("Invalid argument forwarding")
|
1077
|
+
end
|
1078
|
+
result = call_args [s(:forward_args).line(lexer.lineno)]
|
1079
|
+
}
|
1080
|
+
#endif
|
1043
1081
|
|
1044
1082
|
opt_paren_args: none
|
1045
1083
|
| paren_args
|
@@ -2340,6 +2378,21 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2340
2378
|
self.lexer.lex_state = EXPR_BEG
|
2341
2379
|
self.lexer.command_start = true
|
2342
2380
|
}
|
2381
|
+
#if V >= 27
|
2382
|
+
| tLPAREN2 args_forward rparen
|
2383
|
+
{
|
2384
|
+
args_rest = :"*"
|
2385
|
+
kwargs_rest = :"**"
|
2386
|
+
block_fwd = :"&"
|
2387
|
+
self.env[args_rest] = :lvar
|
2388
|
+
self.env[kwargs_rest] = :lvar
|
2389
|
+
self.env[block_fwd] = :lvar
|
2390
|
+
|
2391
|
+
result = s(:args, s(:forward_args)).line lexer.lineno
|
2392
|
+
self.lexer.lex_state = EXPR_BEG
|
2393
|
+
self.lexer.command_start = true
|
2394
|
+
}
|
2395
|
+
#endif
|
2343
2396
|
| {
|
2344
2397
|
result = self.in_kwarg
|
2345
2398
|
self.in_kwarg = true
|
@@ -2439,6 +2492,8 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2439
2492
|
result = args val
|
2440
2493
|
}
|
2441
2494
|
|
2495
|
+
args_forward: tBDOT3
|
2496
|
+
|
2442
2497
|
f_bad_arg: tCONSTANT
|
2443
2498
|
{
|
2444
2499
|
yyerror "formal argument cannot be a constant"
|
@@ -2587,6 +2642,7 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
2587
2642
|
| kwrest_mark
|
2588
2643
|
{
|
2589
2644
|
result = :"**"
|
2645
|
+
self.env[result] = :lvar
|
2590
2646
|
}
|
2591
2647
|
|
2592
2648
|
#if V == 20
|
data/bundle/ruby/2.7.0/gems/{ruby_parser-3.15.1 → ruby_parser-3.16.0}/lib/ruby_parser_extras.rb
RENAMED
@@ -29,7 +29,7 @@ class Sexp
|
|
29
29
|
end
|
30
30
|
|
31
31
|
module RubyParserStuff
|
32
|
-
VERSION = "3.
|
32
|
+
VERSION = "3.16.0"
|
33
33
|
|
34
34
|
attr_accessor :lexer, :in_def, :in_single, :file
|
35
35
|
attr_accessor :in_kwarg
|
@@ -115,7 +115,7 @@ module RubyParserStuff
|
|
115
115
|
def initialize(options = {})
|
116
116
|
super()
|
117
117
|
|
118
|
-
v = self.class.name[/
|
118
|
+
v = self.class.name[/[23]\d/]
|
119
119
|
raise "Bad Class name #{self.class}" unless v
|
120
120
|
|
121
121
|
self.lexer = RubyLexer.new v && v.to_i
|
@@ -197,8 +197,8 @@ ARGF.each_line do |line|
|
|
197
197
|
puts line.gsub("true", "1").gsub("false", "0")
|
198
198
|
when /^lex_state: :?([\w|]+) -> :?([\w|]+)(?: (?:at|from) (.*))?/ then
|
199
199
|
a, b, c = $1.upcase, $2.upcase, $3
|
200
|
-
a.gsub!
|
201
|
-
b.gsub!
|
200
|
+
a.gsub!(/EXPR_/, "")
|
201
|
+
b.gsub!(/EXPR_/, "")
|
202
202
|
if c && $v then
|
203
203
|
puts "lex_state: #{a} -> #{b} at #{c}"
|
204
204
|
else
|
File without changes
|
File without changes
|
File without changes
|
data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/pt_testcase.rb
RENAMED
@@ -77,7 +77,7 @@ class ParseTreeTestCase < Minitest::Test
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def self.add_19tests name, hash
|
80
|
-
add_tests "#{name}
|
80
|
+
add_tests "#{name}__19_20_21_22_23_24_25_26_27_30", hash # HACK?
|
81
81
|
end
|
82
82
|
|
83
83
|
def self.add_19edgecases ruby, sexp, cases
|
@@ -102,7 +102,7 @@ class ParseTreeTestCase < Minitest::Test
|
|
102
102
|
testcases[verbose][klass] = testcases[nonverbose][klass]
|
103
103
|
end
|
104
104
|
|
105
|
-
VER_RE = "(1[89]|2[01234567])"
|
105
|
+
VER_RE = "(1[89]|2[01234567]|3[0])"
|
106
106
|
|
107
107
|
def self.generate_test klass, node, data, input_name, output_name
|
108
108
|
klass.send :define_method, "test_#{node}" do
|
File without changes
|
data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/sexp_matcher.rb
RENAMED
File without changes
|
data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.2 → sexp_processor-4.15.3}/lib/strict_sexp.rb
RENAMED
File without changes
|
File without changes
|
data/lib/brakeman.rb
CHANGED
@@ -65,6 +65,7 @@ module Brakeman
|
|
65
65
|
# * :report_routes - show found routes on controllers (default: false)
|
66
66
|
# * :run_checks - array of checks to run (run all if not specified)
|
67
67
|
# * :safe_methods - array of methods to consider safe
|
68
|
+
# * :sql_safe_methods - array of sql sanitization methods to consider safe
|
68
69
|
# * :skip_libs - do not process lib/ directory (default: false)
|
69
70
|
# * :skip_vendor - do not process vendor/ directory (default: true)
|
70
71
|
# * :skip_checks - checks not to run (run all if not specified)
|
@@ -157,10 +158,17 @@ module Brakeman
|
|
157
158
|
end
|
158
159
|
end
|
159
160
|
|
160
|
-
CONFIG_FILES =
|
161
|
-
|
162
|
-
|
163
|
-
|
161
|
+
CONFIG_FILES = begin
|
162
|
+
[
|
163
|
+
File.expand_path("~/.brakeman/config.yml"),
|
164
|
+
File.expand_path("/etc/brakeman/config.yml")
|
165
|
+
]
|
166
|
+
rescue ArgumentError
|
167
|
+
# In case $HOME or $USER aren't defined for use of `~`
|
168
|
+
[
|
169
|
+
File.expand_path("/etc/brakeman/config.yml")
|
170
|
+
]
|
171
|
+
end
|
164
172
|
|
165
173
|
def self.config_file custom_location, app_path
|
166
174
|
app_config = File.expand_path(File.join(app_path, "config", "brakeman.yml"))
|
@@ -191,6 +199,7 @@ module Brakeman
|
|
191
199
|
:relative_path => false,
|
192
200
|
:report_progress => true,
|
193
201
|
:safe_methods => Set.new,
|
202
|
+
:sql_safe_methods => Set.new,
|
194
203
|
:skip_checks => Set.new,
|
195
204
|
:skip_vendor => true,
|
196
205
|
}
|
@@ -243,6 +252,8 @@ module Brakeman
|
|
243
252
|
[:to_sarif]
|
244
253
|
when :sonar, :to_sonar
|
245
254
|
[:to_sonar]
|
255
|
+
when :github, :to_github
|
256
|
+
[:to_github]
|
246
257
|
else
|
247
258
|
[:to_text]
|
248
259
|
end
|
@@ -276,6 +287,8 @@ module Brakeman
|
|
276
287
|
:to_sarif
|
277
288
|
when /\.sonar$/i
|
278
289
|
:to_sonar
|
290
|
+
when /\.github$/i
|
291
|
+
:to_github
|
279
292
|
else
|
280
293
|
:to_text
|
281
294
|
end
|
@@ -514,12 +527,14 @@ module Brakeman
|
|
514
527
|
|
515
528
|
# Returns an array of alert fingerprints for any ignored warnings without
|
516
529
|
# notes found in the specified ignore file (if it exists).
|
517
|
-
def self.ignore_file_entries_with_empty_notes file
|
530
|
+
def self.ignore_file_entries_with_empty_notes file, options
|
518
531
|
return [] unless file
|
519
532
|
|
520
533
|
require 'brakeman/report/ignore/config'
|
521
534
|
|
522
|
-
|
535
|
+
app_tree = Brakeman::AppTree.from_options(options)
|
536
|
+
|
537
|
+
config = IgnoreConfig.new(Brakeman::FilePath.from_app_tree(app_tree, file), nil)
|
523
538
|
config.read_from_file
|
524
539
|
config.already_ignored_entries_with_empty_notes.map { |i| i[:fingerprint] }
|
525
540
|
end
|
@@ -530,9 +545,9 @@ module Brakeman
|
|
530
545
|
app_tree = Brakeman::AppTree.from_options(options)
|
531
546
|
|
532
547
|
if options[:ignore_file]
|
533
|
-
file = options[:ignore_file]
|
548
|
+
file = Brakeman::FilePath.from_app_tree(app_tree, options[:ignore_file])
|
534
549
|
elsif app_tree.exists? "config/brakeman.ignore"
|
535
|
-
file =
|
550
|
+
file = Brakeman::FilePath.from_app_tree(app_tree, "config/brakeman.ignore")
|
536
551
|
elsif not options[:interactive_ignore]
|
537
552
|
return
|
538
553
|
end
|
@@ -26,7 +26,7 @@ class Brakeman::CheckDetailedExceptions < Brakeman::BaseCheck
|
|
26
26
|
def check_detailed_exceptions
|
27
27
|
tracker.controllers.each do |_name, controller|
|
28
28
|
controller.methods_public.each do |method_name, definition|
|
29
|
-
src = definition
|
29
|
+
src = definition.src
|
30
30
|
body = src.body.last
|
31
31
|
next unless body
|
32
32
|
|
@@ -10,7 +10,7 @@ class Brakeman::CheckEvaluation < Brakeman::BaseCheck
|
|
10
10
|
#Process calls
|
11
11
|
def run_check
|
12
12
|
Brakeman.debug "Finding eval-like calls"
|
13
|
-
calls = tracker.find_call :
|
13
|
+
calls = tracker.find_call methods: [:eval, :instance_eval, :class_eval, :module_eval], nested: true
|
14
14
|
|
15
15
|
Brakeman.debug "Processing eval-like calls"
|
16
16
|
calls.each do |call|
|
@@ -87,6 +87,16 @@ class Brakeman::CheckExecute < Brakeman::BaseCheck
|
|
87
87
|
dangerous_interp?(first_arg) ||
|
88
88
|
dangerous_string_building?(first_arg)
|
89
89
|
end
|
90
|
+
when :capture2, :capture2e, :capture3
|
91
|
+
# Open3 capture methods can take a :stdin_data argument which is used as the
|
92
|
+
# the input to the called command so it is not succeptable to command injection.
|
93
|
+
# As such if the last argument is a hash (and therefore execution options) it
|
94
|
+
# should be ignored
|
95
|
+
|
96
|
+
args.pop if hash?(args.last) && args.length > 2
|
97
|
+
failure = include_user_input?(args) ||
|
98
|
+
dangerous_interp?(args) ||
|
99
|
+
dangerous_string_building?(args)
|
90
100
|
else
|
91
101
|
failure = include_user_input?(args) ||
|
92
102
|
dangerous_interp?(args) ||
|
@@ -69,17 +69,15 @@ class Brakeman::CheckMassAssignment < Brakeman::BaseCheck
|
|
69
69
|
if check and original? res
|
70
70
|
|
71
71
|
model = tracker.models[res[:chain].first]
|
72
|
-
|
73
72
|
attr_protected = (model and model.attr_protected)
|
73
|
+
first_arg = call.first_arg
|
74
74
|
|
75
75
|
if attr_protected and tracker.options[:ignore_attr_protected]
|
76
76
|
return
|
77
|
+
elsif call? first_arg and (first_arg.method == :slice or first_arg.method == :only)
|
78
|
+
return
|
77
79
|
elsif input = include_user_input?(call.arglist)
|
78
|
-
|
79
|
-
|
80
|
-
if call? first_arg and (first_arg.method == :slice or first_arg.method == :only)
|
81
|
-
return
|
82
|
-
elsif not node_type? first_arg, :hash
|
80
|
+
if not node_type? first_arg, :hash
|
83
81
|
if attr_protected
|
84
82
|
confidence = :medium
|
85
83
|
else
|
@@ -33,6 +33,7 @@ class Brakeman::CheckRender < Brakeman::BaseCheck
|
|
33
33
|
view = result[:call][2]
|
34
34
|
|
35
35
|
if sexp? view and original? result
|
36
|
+
return if renderable?(view)
|
36
37
|
|
37
38
|
if input = has_immediate_user_input?(view)
|
38
39
|
if string_interp? view
|
@@ -94,4 +95,17 @@ class Brakeman::CheckRender < Brakeman::BaseCheck
|
|
94
95
|
end
|
95
96
|
end
|
96
97
|
end
|
97
|
-
|
98
|
+
|
99
|
+
def renderable? exp
|
100
|
+
return false unless call?(exp) and constant?(exp.target)
|
101
|
+
|
102
|
+
target_class_name = class_name(exp.target)
|
103
|
+
known_renderable_class?(target_class_name) or tracker.find_method(:render_in, target_class_name)
|
104
|
+
end
|
105
|
+
|
106
|
+
def known_renderable_class? class_name
|
107
|
+
klass = tracker.find_class(class_name)
|
108
|
+
return false if klass.nil?
|
109
|
+
klass.ancestor? :"ViewComponent::Base"
|
110
|
+
end
|
111
|
+
end
|