brakeman 5.0.2 → 5.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/bundle/load.rb +0 -1
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby20_parser.rb +278 -273
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby20_parser.y +3 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby21_parser.rb +291 -286
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby21_parser.y +3 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby22_parser.rb +297 -292
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby22_parser.y +3 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby23_parser.rb +295 -290
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby23_parser.y +3 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby24_parser.rb +296 -291
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby24_parser.y +3 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby25_parser.rb +297 -292
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby25_parser.y +3 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby26_parser.rb +301 -296
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby26_parser.y +3 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby27_parser.rb +2528 -2480
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby27_parser.y +26 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby30_parser.rb +2528 -2480
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby30_parser.y +26 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby_parser.yy +30 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/tools/ripper.rb +1 -1
- data/lib/brakeman.rb +0 -4
- data/lib/brakeman/checks/check_detailed_exceptions.rb +1 -1
- data/lib/brakeman/checks/check_evaluation.rb +1 -1
- data/lib/brakeman/checks/check_sql.rb +2 -15
- data/lib/brakeman/checks/check_verb_confusion.rb +1 -1
- data/lib/brakeman/file_parser.rb +14 -36
- data/lib/brakeman/options.rb +1 -1
- data/lib/brakeman/processors/alias_processor.rb +7 -52
- data/lib/brakeman/processors/controller_alias_processor.rb +43 -6
- data/lib/brakeman/processors/lib/call_conversion_helper.rb +0 -10
- data/lib/brakeman/processors/library_processor.rb +0 -9
- data/lib/brakeman/report.rb +1 -4
- data/lib/brakeman/report/ignore/interactive.rb +1 -1
- data/lib/brakeman/scanner.rb +0 -3
- data/lib/brakeman/tracker.rb +4 -33
- data/lib/brakeman/tracker/collection.rb +5 -27
- data/lib/brakeman/util.rb +0 -8
- data/lib/brakeman/version.rb +1 -1
- metadata +2 -8
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/MIT-LICENSE.txt +0 -20
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel.rb +0 -523
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel/processor_count.rb +0 -42
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel/version.rb +0 -3
- data/lib/brakeman/report/report_github.rb +0 -31
- data/lib/brakeman/tracker/method_info.rb +0 -29
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'etc'
|
2
|
-
|
3
|
-
module Parallel
|
4
|
-
# TODO: inline this method into parallel.rb and kill physical_processor_count in next major release
|
5
|
-
module ProcessorCount
|
6
|
-
# Number of processors seen by the OS, used for process scheduling
|
7
|
-
def processor_count
|
8
|
-
@processor_count ||= Integer(ENV['PARALLEL_PROCESSOR_COUNT'] || Etc.nprocessors)
|
9
|
-
end
|
10
|
-
|
11
|
-
# Number of physical processor cores on the current system.
|
12
|
-
def physical_processor_count
|
13
|
-
@physical_processor_count ||= begin
|
14
|
-
ppc = case RbConfig::CONFIG["target_os"]
|
15
|
-
when /darwin1/
|
16
|
-
IO.popen("/usr/sbin/sysctl -n hw.physicalcpu").read.to_i
|
17
|
-
when /linux/
|
18
|
-
cores = {} # unique physical ID / core ID combinations
|
19
|
-
phy = 0
|
20
|
-
IO.read("/proc/cpuinfo").scan(/^physical id.*|^core id.*/) do |ln|
|
21
|
-
if ln.start_with?("physical")
|
22
|
-
phy = ln[/\d+/]
|
23
|
-
elsif ln.start_with?("core")
|
24
|
-
cid = phy + ":" + ln[/\d+/]
|
25
|
-
cores[cid] = true if not cores[cid]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
cores.count
|
29
|
-
when /mswin|mingw/
|
30
|
-
require 'win32ole'
|
31
|
-
result_set = WIN32OLE.connect("winmgmts://").ExecQuery(
|
32
|
-
"select NumberOfCores from Win32_Processor")
|
33
|
-
result_set.to_enum.collect(&:NumberOfCores).reduce(:+)
|
34
|
-
else
|
35
|
-
processor_count
|
36
|
-
end
|
37
|
-
# fall back to logical count if physical info is invalid
|
38
|
-
ppc > 0 ? ppc : processor_count
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# Github Actions Formatter
|
2
|
-
# Formats warnings as workflow commands to create annotations in GitHub UI
|
3
|
-
class Brakeman::Report::Github < Brakeman::Report::Base
|
4
|
-
def generate_report
|
5
|
-
# @see https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message
|
6
|
-
errors.concat(warnings).join("\n")
|
7
|
-
end
|
8
|
-
|
9
|
-
def warnings
|
10
|
-
all_warnings
|
11
|
-
.map { |warning| "::warning file=#{warning_file(warning)},line=#{warning.line}::#{warning.message}" }
|
12
|
-
end
|
13
|
-
|
14
|
-
def errors
|
15
|
-
tracker.errors.map do |error|
|
16
|
-
if error[:exception].is_a?(Racc::ParseError)
|
17
|
-
# app/services/balance.rb:4 :: parse error on value "..." (tDOT3)
|
18
|
-
file, line = error[:exception].message.split(':').map(&:strip)[0,2]
|
19
|
-
"::error file=#{file},line=#{line}::#{clean_message(error[:error])}"
|
20
|
-
else
|
21
|
-
"::error ::#{clean_message(error[:error])}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def clean_message(msg)
|
29
|
-
msg.gsub('::','').squeeze(' ')
|
30
|
-
end
|
31
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'brakeman/util'
|
2
|
-
|
3
|
-
module Brakeman
|
4
|
-
class MethodInfo
|
5
|
-
include Brakeman::Util
|
6
|
-
|
7
|
-
attr_reader :name, :src, :owner, :file, :type
|
8
|
-
|
9
|
-
def initialize name, src, owner, file
|
10
|
-
@name = name
|
11
|
-
@src = src
|
12
|
-
@owner = owner
|
13
|
-
@file = file
|
14
|
-
@type = case src.node_type
|
15
|
-
when :defn
|
16
|
-
:instance
|
17
|
-
when :defs
|
18
|
-
:class
|
19
|
-
else
|
20
|
-
raise "Expected sexp type: #{src.node_type}"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# To support legacy code that expected a Hash
|
25
|
-
def [] attr
|
26
|
-
self.send(attr)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|