Skip to content

Commit 0954f55

Browse files
committed
Rails 7.1 upgrade
1 parent b2c50f2 commit 0954f55

File tree

13 files changed

+97
-118
lines changed

13 files changed

+97
-118
lines changed

config/application.rb

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,9 @@ class Application < Rails::Application
4141
config.paths['config/database'] = [Metasploit::Framework::Database.configurations_pathname.try(:to_path)]
4242
config.autoloader = :zeitwerk
4343

44-
case Rails.env
45-
when "development"
46-
config.eager_load = false
47-
when "test"
48-
config.eager_load = false
49-
when "production"
50-
config.eager_load = false
51-
end
52-
53-
if ActiveRecord.respond_to?(:legacy_connection_handling=)
54-
ActiveRecord.legacy_connection_handling = false
55-
end
44+
config.load_defaults 7.1
45+
46+
config.eager_load = false
5647
end
5748
end
5849
end

lib/metasploit/framework/common_engine.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ module Metasploit::Framework::CommonEngine
4040

4141
config.active_support.deprecation = :stderr
4242

43-
if ActiveRecord.respond_to?(:legacy_connection_handling=)
44-
ActiveRecord.legacy_connection_handling = false
45-
end
46-
4743
# @see https://github.com/rapid7/metasploit_data_models/blob/54a17149d5ccd0830db742d14c4987b48399ceb7/lib/metasploit_data_models/yaml.rb#L10
4844
# @see https://github.com/rapid7/metasploit_data_models/blob/54a17149d5ccd0830db742d14c4987b48399ceb7/lib/metasploit_data_models/base64_serializer.rb#L28-L31
4945
ActiveRecord.yaml_column_permitted_classes = (ActiveRecord.yaml_column_permitted_classes + MetasploitDataModels::YAML::PERMITTED_CLASSES).uniq

lib/metasploit/framework/rails_version_constraint.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Metasploit
44
module Framework
55
module RailsVersionConstraint
6-
RAILS_VERSION = '~> 7.0.0'
6+
RAILS_VERSION = '~> 7.1.0'
77
end
88
end
99
end

lib/msf/core/db_manager/migration.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ def with_migration_context
6969
yield ActiveRecord::MigrationContext.new(gather_engine_migration_paths)
7070
end
7171

72-
# @return [ActiveRecord::MigrationContext]
73-
def default_migration_context
74-
ActiveRecord::MigrationContext.new(gather_engine_migration_paths, ActiveRecord::SchemaMigration)
75-
end
76-
7772
# Loads gathers migration paths from all loaded Rails engines.
7873
#
7974
# @return Array[String]

lib/msf/core/thread_manager.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,6 @@ def spawn(name, crit, *args, &block)
111111
error: e
112112
)
113113
raise e
114-
ensure
115-
if framework.db && framework.db.active && framework.db.is_local?
116-
# NOTE: despite the Deprecation Warning's advice, this should *NOT*
117-
# be ApplicationRecord.connection.close which causes unrelated
118-
# threads to raise ActiveRecord::StatementInvalid exceptions at
119-
# some point in the future, presumably due to the pool manager
120-
# believing that the connection is still usable and handing it out
121-
# to another thread.
122-
::ApplicationRecord.connection_pool.release_connection
123-
end
124114
end
125115
end
126116
else

metasploit-framework.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Gem::Specification.new do |spec|
6969
# Metasploit::Credential database models
7070
spec.add_runtime_dependency 'metasploit-credential'
7171
# Database models shared between framework and Pro.
72-
spec.add_runtime_dependency 'metasploit_data_models'
72+
spec.add_runtime_dependency 'metasploit_data_models', '>= 6.0.7'
7373
# Things that would normally be part of the database model, but which
7474
# are needed when there's no database
7575
spec.add_runtime_dependency 'metasploit-model'

spec/allure_config.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
require "allure-rspec"
2+
require "active_support"
3+
require "active_support/core_ext/object"
24

35
AllureRspec.configure do |config|
46
config.results_directory = "tmp/allure-raw-data"

spec/lib/msf/ui/console/command_dispatcher/db/klist_spec.rb

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ def as_ccache(data)
209209
==============
210210
id host principal sname enctype issued status path
211211
-- ---- --------- ----- ------- ------ ------ ----
212-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path}
213-
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path}
212+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path}
213+
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path}
214214
TABLE
215215
end
216216
end
@@ -223,7 +223,7 @@ def as_ccache(data)
223223
==============
224224
id host principal sname enctype issued status path
225225
-- ---- --------- ----- ------- ------ ------ ----
226-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path}
226+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path}
227227
TABLE
228228
end
229229
end
@@ -270,10 +270,10 @@ def as_ccache(data)
270270
Addresses: 0
271271
Authdatas: 0
272272
Times:
273-
Auth time: #{Time.parse('2022-11-28 15:51:29 +0000').to_time}
274-
Start time: #{Time.parse('2022-11-28 15:51:29 +0000').to_time}
275-
End time: #{Time.parse('2032-11-25 15:51:29 +0000').to_time}
276-
Renew Till: #{Time.parse('2032-11-25 15:51:29 +0000').to_time}
273+
Auth time: #{Time.parse('2022-11-28 15:51:29 +0000').localtime}
274+
Start time: #{Time.parse('2022-11-28 15:51:29 +0000').localtime}
275+
End time: #{Time.parse('2032-11-25 15:51:29 +0000').localtime}
276+
Renew Till: #{Time.parse('2032-11-25 15:51:29 +0000').localtime}
277277
Ticket:
278278
Ticket Version Number: 5
279279
Realm: WINDOMAIN.LOCAL
@@ -298,8 +298,8 @@ def as_ccache(data)
298298
==============
299299
id host principal sname enctype issued status path
300300
-- ---- --------- ----- ------- ------ ------ ----
301-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{old_valid_ccache_path}
302-
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{old_expired_ccache_path}
301+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{old_valid_ccache_path}
302+
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{old_expired_ccache_path}
303303
Deleted 2 entries
304304
TABLE
305305
expect(kerberos_ticket_storage.tickets.length).to eq(0)
@@ -314,7 +314,7 @@ def as_ccache(data)
314314
==============
315315
id host principal sname enctype issued status path
316316
-- ---- --------- ----- ------- ------ ------ ----
317-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path}
317+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path}
318318
TABLE
319319
end
320320
end
@@ -327,8 +327,8 @@ def as_ccache(data)
327327
==============
328328
id host principal sname enctype issued status path
329329
-- ---- --------- ----- ------- ------ ------ ----
330-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path}
331-
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path}
330+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path}
331+
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path}
332332
TABLE
333333
end
334334
end
@@ -341,8 +341,8 @@ def as_ccache(data)
341341
==============
342342
id host principal sname enctype issued status path
343343
-- ---- --------- ----- ------- ------ ------ ----
344-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path}
345-
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path}
344+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path}
345+
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path}
346346
TABLE
347347
end
348348
end
@@ -355,8 +355,8 @@ def as_ccache(data)
355355
==============
356356
id host principal sname enctype issued status path
357357
-- ---- --------- ----- ------- ------ ------ ----
358-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path}
359-
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path}
358+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path}
359+
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path}
360360
TABLE
361361
end
362362
end
@@ -369,8 +369,8 @@ def as_ccache(data)
369369
==============
370370
id host principal sname enctype issued status path
371371
-- ---- --------- ----- ------- ------ ------ ----
372-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path}
373-
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path}
372+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path}
373+
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path}
374374
TABLE
375375
end
376376
end
@@ -420,8 +420,8 @@ def as_ccache(data)
420420
==============
421421
id host principal sname enctype issued status path
422422
-- ---- --------- ----- ------- ------ ------ ----
423-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} inactive #{valid_ccache_path}
424-
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path}
423+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} inactive #{valid_ccache_path}
424+
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path}
425425
Deactivated 2 entries
426426
TABLE
427427
end
@@ -441,8 +441,8 @@ def as_ccache(data)
441441
==============
442442
id host principal sname enctype issued status path
443443
-- ---- --------- ----- ------- ------ ------ ----
444-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{valid_ccache_path}
445-
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').to_time} >>expired<< #{expired_ccache_path}
444+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{valid_ccache_path}
445+
[id] 192.0.2.24 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-12-16 12:05:05 +0000').localtime} >>expired<< #{expired_ccache_path}
446446
Activated 2 entries
447447
TABLE
448448
end
@@ -459,7 +459,7 @@ def as_ccache(data)
459459
==============
460460
id host principal sname enctype issued status path
461461
-- ---- --------- ----- ------- ------ ------ ----
462-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} active #{old_valid_ccache_path}
462+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} active #{old_valid_ccache_path}
463463
Deleted 1 entry
464464
TABLE
465465
expect(kerberos_ticket_storage.tickets.length).to eq(1)
@@ -474,7 +474,7 @@ def as_ccache(data)
474474
==============
475475
id host principal sname enctype issued status path
476476
-- ---- --------- ----- ------- ------ ------ ----
477-
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').to_time} inactive #{valid_ccache_path}
477+
[id] 192.0.2.2 [email protected] krbtgt/[email protected] AES256 #{Time.parse('2022-11-28 15:51:29 +0000').localtime} inactive #{valid_ccache_path}
478478
Deactivated 1 entry
479479
TABLE
480480
end

spec/modules/auxiliary/admin/kerberos/forge_ticket_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@
5656
Addresses: 0
5757
Authdatas: 0
5858
Times:
59-
Auth time: #{Time.parse('2022-07-15 13:33:40 +0100').to_time}
60-
Start time: #{Time.parse('2022-07-15 13:33:40 +0100').to_time}
61-
End time: #{Time.parse('2032-07-12 13:33:40 +0100').to_time}
62-
Renew Till: #{Time.parse('2032-07-12 13:33:40 +0100').to_time}
59+
Auth time: #{Time.parse('2022-07-15 13:33:40 +0100').localtime}
60+
Start time: #{Time.parse('2022-07-15 13:33:40 +0100').localtime}
61+
End time: #{Time.parse('2032-07-12 13:33:40 +0100').localtime}
62+
Renew Till: #{Time.parse('2032-07-12 13:33:40 +0100').localtime}
6363
Ticket:
6464
Ticket Version Number: 5
6565
Realm: DEMO.LOCAL
@@ -69,10 +69,10 @@
6969
Key Version Number: 2
7070
Decrypted (with key: 767400b2c71afa35a5dca216f2389cd9):
7171
Times:
72-
Auth time: #{Time.parse('2022-07-15 12:33:40 UTC').to_time}
73-
Start time: #{Time.parse('2022-07-15 12:33:40 UTC').to_time}
74-
End time: #{Time.parse('2032-07-12 12:33:40 UTC').to_time}
75-
Renew Till: #{Time.parse('2032-07-12 12:33:40 UTC').to_time}
72+
Auth time: #{Time.parse('2022-07-15 12:33:40 UTC').localtime}
73+
Start time: #{Time.parse('2022-07-15 12:33:40 UTC').localtime}
74+
End time: #{Time.parse('2032-07-12 12:33:40 UTC').localtime}
75+
Renew Till: #{Time.parse('2032-07-12 12:33:40 UTC').localtime}
7676
Client Addresses: 0
7777
Transited: tr_type: 0, Contents: ""
7878
Client Name: 'Administrator'
@@ -82,7 +82,7 @@
8282
Flags: 0x50e00000 (FORWARDABLE, PROXIABLE, RENEWABLE, INITIAL, PRE_AUTHENT)
8383
PAC:
8484
Validation Info:
85-
Logon Time: #{Time.parse('2022-07-15 13:33:40 +0100').to_time}
85+
Logon Time: #{Time.parse('2022-07-15 13:33:40 +0100').localtime}
8686
Logoff Time: Never Expires (inf)
8787
Kick Off Time: Never Expires (inf)
8888
Password Last Set: No Time Set (0)
@@ -185,7 +185,7 @@
185185
Logon Domain Name: 'DEMO.LOCAL'
186186
Client Info:
187187
Name: 'Administrator'
188-
Client ID: #{Time.parse('2022-07-15 13:33:40 +0100').to_time}
188+
Client ID: #{Time.parse('2022-07-15 13:33:40 +0100').localtime}
189189
Pac Requestor:
190190
SID: S-1-5-21-1266190811-2419310613-1856291569-500
191191
Pac Attributes:

0 commit comments

Comments
 (0)