Skip to content

Commit

Permalink
Land #204, Fix rails 7.2 errors and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 authored Feb 7, 2024
2 parents 3f1cb12 + d8fabc8 commit 54a1714
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ group :development, :test do
# auto-load factories from spec/factories
gem 'factory_bot_rails'

gem 'rails'
gem 'rails', '~> 7.0'
gem 'net-smtp', require: false

# Used to create fake data
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Mdm::Event < ApplicationRecord
# {#name}-specific information about this event.
#
# @return [Hash]
serialize :info, MetasploitDataModels::Base64Serializer.new
serialize :info, coder: MetasploitDataModels::Base64Serializer.new

#
# Validations
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Mdm::Listener < ApplicationRecord
# Options used to spawn this listener.
#
# @return [Hash]
serialize :options, MetasploitDataModels::Base64Serializer.new
serialize :options, coder: MetasploitDataModels::Base64Serializer.new

#
# Validations
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/loot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Mdm::Loot < ApplicationRecord
# Serializations
#

serialize :data, MetasploitDataModels::Base64Serializer.new
serialize :data, coder: MetasploitDataModels::Base64Serializer.new

private

Expand Down
4 changes: 2 additions & 2 deletions app/models/mdm/macro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class Mdm::Macro < ApplicationRecord
#
# @return [Array<Hash{Symbol=>Object}>] Array of action hashes. Each action hash is have key :module with value
# of an {Mdm::Module::Detail#fullname} and and key :options with value of options used to the run the module.
serialize :actions, MetasploitDataModels::Base64Serializer.new
serialize :actions, coder: MetasploitDataModels::Base64Serializer.new

# Preference for this macro, shared across all actions.
#
# @return [Hash]
serialize :prefs, MetasploitDataModels::Base64Serializer.new
serialize :prefs, coder: MetasploitDataModels::Base64Serializer.new

# The maximum number of seconds that this macro is allowed to run.
#
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/nexpose_console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Mdm::NexposeConsole < ApplicationRecord
# List of sites known to Nexpose.
#
# @return [Array<String>] Array of site names.
serialize :cached_sites, MetasploitDataModels::Base64Serializer.new
serialize :cached_sites, coder: MetasploitDataModels::Base64Serializer.new

#
# Validations
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class Mdm::Note < ApplicationRecord
# Serializations
#

serialize :data, ::MetasploitDataModels::Base64Serializer.new
serialize :data, coder: ::MetasploitDataModels::Base64Serializer.new

private

Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Mdm::Profile < ApplicationRecord
# Global settings.
#
# @return [Hash]
serialize :settings, MetasploitDataModels::Base64Serializer.new
serialize :settings, coder: MetasploitDataModels::Base64Serializer.new

Metasploit::Concern.run(self)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class Mdm::Session < ApplicationRecord
# Serializations
#

serialize :datastore, ::MetasploitDataModels::Base64Serializer.new
serialize :datastore, coder: ::MetasploitDataModels::Base64Serializer.new

# Returns whether the session can be upgraded to a meterpreter session from a shell session on Windows.
#
Expand Down
6 changes: 3 additions & 3 deletions app/models/mdm/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ class Mdm::Task < ApplicationRecord
# Options passed to `#module`.
#
# @return [Hash]
serialize :options, MetasploitDataModels::Base64Serializer.new
serialize :options, coder: MetasploitDataModels::Base64Serializer.new

# Result of task running.
#
# @return [Hash]
serialize :result, MetasploitDataModels::Base64Serializer.new
serialize :result, coder: MetasploitDataModels::Base64Serializer.new

# Settings used to configure this task outside of the {#options module options}.
#
# @return [Hash]
serialize :settings, MetasploitDataModels::Base64Serializer.new
serialize :settings, coder: MetasploitDataModels::Base64Serializer.new

#
# Instance Methods
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Mdm::User < ApplicationRecord
# Hash of user preferences
#
# @return [Hash]
serialize :prefs, MetasploitDataModels::Base64Serializer.new
serialize :prefs, coder: MetasploitDataModels::Base64Serializer.new

# @!attribute time_zone
# User's preferred time zone.
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/web_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Mdm::WebForm < ApplicationRecord
# Parameters submitted in this form.
#
# @return [Array<Array(String, String)>>]
serialize :params, MetasploitDataModels::Base64Serializer.new
serialize :params, coder: MetasploitDataModels::Base64Serializer.new

Metasploit::Concern.run(self)
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/mdm/web_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ class Mdm::WebPage < ApplicationRecord
# Headers sent from server.
#
# @return [Hash{String => String}]
serialize :headers, MetasploitDataModels::Base64Serializer.new
serialize :headers, coder: MetasploitDataModels::Base64Serializer.new

# Cookies sent from server.
#
# @return [Hash{String => String}]
serialize :cookie
serialize :cookie, coder: MetasploitDataModels::Base64Serializer.new
Metasploit::Concern.run(self)
end

2 changes: 1 addition & 1 deletion app/models/mdm/web_site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Mdm::WebSite < ApplicationRecord

# @!attribute [rw] options
# @todo Determine format and purpose of Mdm::WebSite#options.
serialize :options, ::MetasploitDataModels::Base64Serializer.new
serialize :options, coder: ::MetasploitDataModels::Base64Serializer.new

#
# Instance Methods
Expand Down
2 changes: 1 addition & 1 deletion app/models/mdm/web_vuln.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Mdm::WebVuln < ApplicationRecord
# Parameters sent as part of request
#
# @return [Array<Array(String, String)>] Array of parameter key value pairs
serialize :params, MetasploitDataModels::Base64Serializer.new(:default => DEFAULT_PARAMS)
serialize :params, coder: MetasploitDataModels::Base64Serializer.new(:default => DEFAULT_PARAMS)

#
# Methods
Expand Down
2 changes: 0 additions & 2 deletions spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class Application < Rails::Application
config.active_record.belongs_to_required_by_default = true

config.autoloader = :zeitwerk

ActiveRecord.legacy_connection_handling = false
end
end

0 comments on commit 54a1714

Please sign in to comment.