brakeman-lib 8.1.0 → 8.1.1
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.md +5 -0
- data/lib/brakeman/app_tree.rb +6 -3
- data/lib/brakeman/checks/base_check.rb +1 -1
- data/lib/brakeman/checks/check_ruby2shell.rb +31 -0
- data/lib/brakeman/checks/check_unscoped_find.rb +9 -8
- data/lib/brakeman/tracker/config.rb +2 -1
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning_codes.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b4ff198d245bd30c8124d8b854b3226040deba7678d85e677614409378875849
|
|
4
|
+
data.tar.gz: c2a23bb1cb6025654ac8c89da281ac05bb1d541c58b26570222b0eda76ab79c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78f5702f794e3af777b76669ce712bfec9c8371bad9161b62fc9e1106fd94c0c3c5959facc67423f33c00fcb5a2c505191f884cbafe4e1f92db397aaa2985910
|
|
7
|
+
data.tar.gz: 6faec03ff212744d9948eeb4fc51f321331b2540598e2248ae5b93614cf577e27cab5610e9b20bca2598dbad97f0e99d6fdb09cc30a024d53b8649738090d317
|
data/CHANGES.md
CHANGED
data/lib/brakeman/app_tree.rb
CHANGED
|
@@ -196,12 +196,15 @@ module Brakeman
|
|
|
196
196
|
files.uniq.lazy
|
|
197
197
|
else
|
|
198
198
|
if directory == '.'
|
|
199
|
-
pattern = File.join(top_directories_pattern, '**',
|
|
199
|
+
pattern = File.join(top_directories_pattern, '**', '*')
|
|
200
200
|
else
|
|
201
|
-
pattern = "#{root_search_pattern}#{directory}
|
|
201
|
+
pattern = "#{root_search_pattern}#{directory}/**/*"
|
|
202
202
|
end
|
|
203
203
|
|
|
204
|
-
Dir.glob
|
|
204
|
+
# Dir.glob walks the tree again for each alternative in braces,
|
|
205
|
+
# so walk it once and match the extensions on each file name
|
|
206
|
+
file_pattern = "#{name}#{extensions}"
|
|
207
|
+
Dir.glob(pattern).select { |path| File.fnmatch?(file_pattern, File.basename(path), File::FNM_EXTGLOB) }.lazy
|
|
205
208
|
end
|
|
206
209
|
end
|
|
207
210
|
|
|
@@ -470,7 +470,7 @@ class Brakeman::BaseCheck < Brakeman::SexpProcessor
|
|
|
470
470
|
version_between? version, "2.3.18.99", tracker.config.gem_version(:'railslts-version')
|
|
471
471
|
end
|
|
472
472
|
|
|
473
|
-
def version_between? low_version, high_version, current_version =
|
|
473
|
+
def version_between? low_version, high_version, current_version = false
|
|
474
474
|
tracker.config.version_between? low_version, high_version, current_version
|
|
475
475
|
end
|
|
476
476
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'brakeman/checks/base_check'
|
|
2
|
+
|
|
3
|
+
class Brakeman::CheckRuby2Shell < Brakeman::BaseCheck
|
|
4
|
+
Brakeman::Checks.add self
|
|
5
|
+
|
|
6
|
+
@description = 'Check for versions of Ruby vulnerable to Ruby2Shell'
|
|
7
|
+
|
|
8
|
+
def run_check
|
|
9
|
+
ruby_version = tracker.config.ruby_version
|
|
10
|
+
return unless ruby_version
|
|
11
|
+
|
|
12
|
+
fix_version = case
|
|
13
|
+
when version_between?('2.4.0', '3.3.13', ruby_version)
|
|
14
|
+
'3.3.14'
|
|
15
|
+
when version_between?('3.4.0', '3.4.12', ruby_version)
|
|
16
|
+
'3.4.13'
|
|
17
|
+
when version_between?('4.0.0', '4.0.9', ruby_version)
|
|
18
|
+
'4.0.10'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
if fix_version
|
|
22
|
+
warn warning_type: 'Remote Code Execution',
|
|
23
|
+
warning_code: :ruby2shell,
|
|
24
|
+
message: msg(msg_version(ruby_version, 'Ruby'), ' has a critical remote code execution vulnerability ', msg_cve('CVE-2026-132825'), '. Upgrade to ', msg_version(fix_version, 'Ruby'), ' or later'),
|
|
25
|
+
confidence: :high,
|
|
26
|
+
gem_info: gemfile_or_environment('ruby'),
|
|
27
|
+
link: 'https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/',
|
|
28
|
+
cwe_id: [122, 125, 787]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -11,7 +11,7 @@ class Brakeman::CheckUnscopedFind < Brakeman::BaseCheck
|
|
|
11
11
|
|
|
12
12
|
associated_model_names = active_record_models.keys.select do |name|
|
|
13
13
|
if belongs_to = active_record_models[name].associations[:belongs_to]
|
|
14
|
-
not
|
|
14
|
+
not all_optional_belongs_to? belongs_to
|
|
15
15
|
else
|
|
16
16
|
false
|
|
17
17
|
end
|
|
@@ -52,15 +52,16 @@ class Brakeman::CheckUnscopedFind < Brakeman::BaseCheck
|
|
|
52
52
|
:cwe_id => [285]
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
def
|
|
55
|
+
def all_optional_belongs_to? exp
|
|
56
56
|
return false unless exp.is_a? Array
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return true
|
|
61
|
-
end
|
|
62
|
-
end
|
|
58
|
+
# Arguments from all belongs_to calls are in one array, so split on association names
|
|
59
|
+
associations = exp.slice_before { |e| symbol? e }.select { |args| symbol? args.first }
|
|
63
60
|
|
|
64
|
-
false
|
|
61
|
+
return false if associations.empty?
|
|
62
|
+
|
|
63
|
+
associations.all? do |args|
|
|
64
|
+
args.any? { |e| hash? e and true? hash_access(e, :optional) }
|
|
65
|
+
end
|
|
65
66
|
end
|
|
66
67
|
end
|
|
@@ -149,7 +149,8 @@ module Brakeman
|
|
|
149
149
|
#Returns true if low_version <= RAILS_VERSION <= high_version
|
|
150
150
|
#
|
|
151
151
|
#If the Rails version is unknown, returns false.
|
|
152
|
-
def version_between? low_version, high_version, current_version =
|
|
152
|
+
def version_between? low_version, high_version, current_version = false
|
|
153
|
+
return false if current_version.nil? # protect against accidents
|
|
153
154
|
current_version ||= rails_version
|
|
154
155
|
return false unless current_version
|
|
155
156
|
|
data/lib/brakeman/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brakeman-lib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.1.
|
|
4
|
+
version: 8.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Collins
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -340,6 +340,7 @@ files:
|
|
|
340
340
|
- lib/brakeman/checks/check_response_splitting.rb
|
|
341
341
|
- lib/brakeman/checks/check_reverse_tabnabbing.rb
|
|
342
342
|
- lib/brakeman/checks/check_route_dos.rb
|
|
343
|
+
- lib/brakeman/checks/check_ruby2shell.rb
|
|
343
344
|
- lib/brakeman/checks/check_safe_buffer_manipulation.rb
|
|
344
345
|
- lib/brakeman/checks/check_sanitize_config_cve.rb
|
|
345
346
|
- lib/brakeman/checks/check_sanitize_methods.rb
|
|
@@ -497,7 +498,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
497
498
|
- !ruby/object:Gem::Version
|
|
498
499
|
version: '0'
|
|
499
500
|
requirements: []
|
|
500
|
-
rubygems_version: 3.
|
|
501
|
+
rubygems_version: 3.4.19
|
|
501
502
|
signing_key:
|
|
502
503
|
specification_version: 4
|
|
503
504
|
summary: Security vulnerability scanner for Ruby on Rails.
|