brakeman-min 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: 2c6fc69e16e5ca99c283f4d5459e6fc447d2959e77069bc90f976c5126939e94
|
|
4
|
+
data.tar.gz: 25292db3b47497c4ca2807dd6699b67eefe192f2b0ac65bb6eaeddf6971e551f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb73aababbe67072541dedd31899eb93fbfc453e4266a09e6eda8f407c0b0835465de2e26efcb58d62b00f7520ace2c49a6cc94fad7fbbb5cd9bcc8c9398b339
|
|
7
|
+
data.tar.gz: cba81456546eff33a9c9730eb9bc6d69d584a5800db5ee70337e4569a7bac7d47daced3b5ec9069c0e7967ab5b44726cbe9f3d6a04b4a35f0fe714d43feb3adb
|
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-min
|
|
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
|
|
@@ -208,6 +208,7 @@ files:
|
|
|
208
208
|
- lib/brakeman/checks/check_response_splitting.rb
|
|
209
209
|
- lib/brakeman/checks/check_reverse_tabnabbing.rb
|
|
210
210
|
- lib/brakeman/checks/check_route_dos.rb
|
|
211
|
+
- lib/brakeman/checks/check_ruby2shell.rb
|
|
211
212
|
- lib/brakeman/checks/check_safe_buffer_manipulation.rb
|
|
212
213
|
- lib/brakeman/checks/check_sanitize_config_cve.rb
|
|
213
214
|
- lib/brakeman/checks/check_sanitize_methods.rb
|
|
@@ -365,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
365
366
|
- !ruby/object:Gem::Version
|
|
366
367
|
version: '0'
|
|
367
368
|
requirements: []
|
|
368
|
-
rubygems_version: 3.
|
|
369
|
+
rubygems_version: 3.4.19
|
|
369
370
|
signing_key:
|
|
370
371
|
specification_version: 4
|
|
371
372
|
summary: Security vulnerability scanner for Ruby on Rails.
|