metasploit_data_models 5.0.5 → 6.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00bd68f8a0e9727e8a61a8ef62c77265a527b86c39e700e0244e9974e7db1039
4
- data.tar.gz: 323300caafddc850752818a075abd7fd998e16591f2d42f7d23ba5797bbae77d
3
+ metadata.gz: 34ebbe62c0392161c1ac0cc6fb78264eb1e9dcdfee1512e1951c8ac2ad7625cc
4
+ data.tar.gz: 7d10985f37643d1f87a2482072aa8b25920713f5ad4994789b7266c4d1aaac9a
5
5
  SHA512:
6
- metadata.gz: 15f22b13afb57fc18fad9a19f7ebb6b18bab95b13cb6f5f562dae9578fd411e81b3ff1692d2349ecad5991ee99183191730e5aa8f5a255957ec17901d31a64bf
7
- data.tar.gz: 0e43b630f2a3c3207795eb22de079c2fc0a09a36d70c71d0dc0b831dd22f1531d9f3f4fff22d83a0af2153de4392b4374c8168d25ca87482feb8fb7ede13d458
6
+ metadata.gz: 38e6e0252f557548c3803de5b17418795a8072842c707c2c1d2bea51769dd7b099ef1d57e6e260fde3a6ac9ddabfb7700765d99b8858b6da0a6110f52b542d5a
7
+ data.tar.gz: 7fc77506c277ea62abc873cd68d9945249617d92c74382f26ad4527e3b2788a227c94d1fcc1fa02a56de4a670b5157f45bb37547c4af34911c686008db226c33
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,5 +1,21 @@
1
1
  name: Verify
2
2
 
3
+ # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
4
+ permissions:
5
+ actions: none
6
+ checks: none
7
+ contents: none
8
+ deployments: none
9
+ id-token: none
10
+ issues: none
11
+ discussions: none
12
+ packages: none
13
+ pages: none
14
+ pull-requests: none
15
+ repository-projects: none
16
+ security-events: none
17
+ statuses: none
18
+
3
19
  on:
4
20
  push:
5
21
  branches:
@@ -10,7 +26,7 @@ on:
10
26
 
11
27
  jobs:
12
28
  test:
13
- runs-on: ubuntu-18.04
29
+ runs-on: ${{ matrix.os }}
14
30
  timeout-minutes: 40
15
31
 
16
32
  services:
@@ -30,15 +46,20 @@ jobs:
30
46
  fail-fast: true
31
47
  matrix:
32
48
  ruby:
33
- - 2.6
34
49
  - 2.7
35
50
  - 3.0
36
51
  - 3.1
52
+ os:
53
+ - ubuntu-20.04
54
+ - ubuntu-latest
55
+ exclude:
56
+ - { os: ubuntu-latest, ruby: 2.7 }
57
+ - { os: ubuntu-latest, ruby: 3.0 }
37
58
 
38
59
  env:
39
60
  RAILS_ENV: test
40
61
 
41
- name: Ruby ${{ matrix.ruby }}
62
+ name: ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
42
63
  steps:
43
64
  - name: Install system dependencies
44
65
  run: sudo apt-get install libpcap-dev graphviz
data/Gemfile CHANGED
@@ -3,7 +3,6 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in metasploit_data_models.gemspec
4
4
  gemspec
5
5
 
6
-
7
6
  group :development do
8
7
  #gem 'metasploit-erd'
9
8
  # embed ERDs on index, namespace Module and Class<ApplicationRecord> pages
@@ -13,14 +12,16 @@ end
13
12
  # used by dummy application
14
13
  group :development, :test do
15
14
  # Upload coverage reports to coveralls.io
16
- gem 'coveralls', require: false
15
+ gem 'coveralls', require: false
17
16
  # supplies factories for producing model instance for specs
18
17
  # Version 4.1.0 or newer is needed to support generate calls without the 'FactoryBot.' in factory definitions syntax.
19
18
  gem 'factory_bot'
20
19
  # auto-load factories from spec/factories
21
20
  gem 'factory_bot_rails'
22
21
 
23
- gem 'rails', '~> 6.0'
22
+ gem 'rails'
23
+ gem 'net-smtp', require: false
24
+
24
25
  # Used to create fake data
25
26
  gem "faker"
26
27
 
@@ -38,7 +38,9 @@ class Mdm::HostTag < ApplicationRecord
38
38
  # @see http://stackoverflow.com/a/11694704
39
39
  # @return [void]
40
40
  def destroy_orphan_tag
41
- tag.destroy_if_orphaned
41
+ # ensure fresh load of tag record
42
+ # in theory this will always return one result safe navigation is just "extra"
43
+ Mdm::Tag.where(id: tag.id).first&.destroy_if_orphaned
42
44
  end
43
45
 
44
46
  # switch back to public for load hooks
@@ -100,7 +100,8 @@ class Mdm::Tag < ApplicationRecord
100
100
  # @return [void]
101
101
  def destroy_if_orphaned
102
102
  self.class.transaction do
103
- if hosts_tags.empty?
103
+ # call `.count` to avoid serialization of any Mdm::HostTag that may exist
104
+ if hosts_tags.count == 0
104
105
  destroy
105
106
  end
106
107
  end
@@ -1,6 +1,6 @@
1
1
  # Web page requested from a {#web_site}.
2
2
  class Mdm::WebPage < ApplicationRecord
3
-
3
+
4
4
  #
5
5
  # Associations
6
6
  #
@@ -18,7 +18,7 @@ class Mdm::Workspace < ApplicationRecord
18
18
 
19
19
  # Automatic exploitation match sets generated against {#hosts} and {#services} in this workspace.
20
20
  has_many :automatic_exploitation_match_sets,
21
- class_name: 'MetasploitDataModels::AutomaticExploitation:MatchSet',
21
+ class_name: 'MetasploitDataModels::AutomaticExploitation::MatchSet',
22
22
  inverse_of: :workspace
23
23
 
24
24
 
@@ -27,7 +27,7 @@ class MetasploitDataModels::Base64Serializer
27
27
  },
28
28
  lambda { |serialized|
29
29
  # Support legacy YAML encoding for existing data
30
- YAML.load(serialized)
30
+ YAML.safe_load(serialized, permitted_classes: Rails.application.config.active_record.yaml_column_permitted_classes)
31
31
  },
32
32
  lambda { |serialized|
33
33
  # Fall back to string decoding
@@ -5,7 +5,6 @@ require 'rails'
5
5
  class MetasploitDataModels::Engine < Rails::Engine
6
6
  # @see http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
7
7
  config.generators do |g|
8
- g.assets false
9
8
  g.fixture_replacement :factory_bot, :dir => 'spec/factories'
10
9
  g.helper false
11
10
  g.test_framework :rspec, :fixture => false
@@ -24,4 +24,4 @@ module MetasploitDataModels::SerializedPrefs
24
24
  class_eval method_declarations, __FILE__, __LINE__
25
25
  end
26
26
  end
27
- end
27
+ end
@@ -1,6 +1,6 @@
1
1
  module MetasploitDataModels
2
2
  # VERSION is managed by GemRelease
3
- VERSION = '5.0.5'
3
+ VERSION = '6.0.0'
4
4
 
5
5
  # @return [String]
6
6
  #
@@ -0,0 +1,31 @@
1
+ # Namespace for YAML configuration
2
+ class MetasploitDataModels::YAML
3
+ #
4
+ # CONSTANTS
5
+ #
6
+
7
+ # List of supported classes when deserializing YAML classes
8
+ # See: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
9
+ #
10
+ PERMITTED_CLASSES = [
11
+ Range,
12
+ Set,
13
+ Symbol,
14
+ Time,
15
+ 'WEBrick::Cookie'.to_sym,
16
+ 'ActionController::Parameters'.to_sym,
17
+ 'ActiveModel::Attribute::FromDatabase'.to_sym,
18
+ 'ActiveModel::Attribute::FromUser'.to_sym,
19
+ 'ActiveModel::Attribute::WithCastValue'.to_sym,
20
+ 'ActiveModel::Type::Boolean'.to_sym,
21
+ 'ActiveModel::Type::Integer'.to_sym,
22
+ 'ActiveModel::Type::String'.to_sym,
23
+ 'ActiveRecord::Coders::JSON'.to_sym,
24
+ 'ActiveSupport::TimeWithZone'.to_sym,
25
+ 'ActiveSupport::TimeZone'.to_sym,
26
+ 'ActiveRecord::Type::Serialized'.to_sym,
27
+ 'ActiveRecord::Type::Text'.to_sym,
28
+ 'ActiveSupport::HashWithIndifferentAccess'.to_sym,
29
+ 'Mdm::Workspace'.to_sym
30
+ ].freeze
31
+ end
@@ -39,6 +39,7 @@ module MetasploitDataModels
39
39
  autoload :ModuleRun
40
40
  autoload :Search
41
41
  autoload :SerializedPrefs
42
+ autoload :YAML
42
43
 
43
44
  # The root directory of `metasploit_data_models` gem in both development and gem installs.
44
45
  #
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.require_paths = %w{app/models app/validators lib}
19
19
 
20
- s.required_ruby_version = '>= 2.4'
20
+ s.required_ruby_version = '>= 2.7'
21
21
 
22
22
  # ---- Dependencies ----
23
23
  # documentation
@@ -33,15 +33,15 @@ Gem::Specification.new do |s|
33
33
  s.add_development_dependency 'pry'
34
34
 
35
35
 
36
- s.add_runtime_dependency 'activerecord', '~>6.0'
37
- s.add_runtime_dependency 'activesupport', '~>6.0'
36
+ s.add_runtime_dependency 'activerecord', '~>7.0'
37
+ s.add_runtime_dependency 'activesupport', '~>7.0'
38
38
  s.add_runtime_dependency 'metasploit-concern'
39
39
  s.add_runtime_dependency 'metasploit-model', '>=3.1'
40
- s.add_runtime_dependency 'railties', '~>6.0'
40
+ s.add_runtime_dependency 'railties', '~>7.0'
41
41
  s.add_runtime_dependency 'webrick'
42
42
 
43
43
  # os fingerprinting
44
- s.add_runtime_dependency 'recog', '~> 2.0'
44
+ s.add_runtime_dependency 'recog'
45
45
 
46
46
  # arel-helpers: Useful tools to help construct database queries with ActiveRecord and Arel.
47
47
  s.add_runtime_dependency 'arel-helpers'
@@ -547,14 +547,14 @@ RSpec.describe Mdm::Host, type: :model do
547
547
  it "when the string contains 'ppc'" do
548
548
  expect(host.send(:get_arch_from_string, 'blahppcblah')).to eq('PowerPC')
549
549
  end
550
- end
551
550
 
552
- context 'should return nil' do
553
551
  it 'when PowerPC is cased incorrectly' do
554
- expect(host.send(:get_arch_from_string, 'powerPC')).to eq(nil)
555
- expect(host.send(:get_arch_from_string, 'Powerpc')).to eq(nil)
552
+ expect(host.send(:get_arch_from_string, 'powerPC')).to eq('PowerPC')
553
+ expect(host.send(:get_arch_from_string, 'Powerpc')).to eq('PowerPC')
556
554
  end
555
+ end
557
556
 
557
+ context 'should return nil' do
558
558
  it 'when no recognized arch string is present' do
559
559
  expect(host.send(:get_arch_from_string, 'blahblah')).to eq(nil)
560
560
  end
@@ -185,7 +185,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
185
185
  end
186
186
 
187
187
  context '#to_s' do
188
- subject(:to_s) {
188
+ subject(:to_s_result) {
189
189
  range.to_s
190
190
  }
191
191
 
@@ -195,7 +195,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
195
195
  }
196
196
 
197
197
  it 'equals the original formatted value' do
198
- expect(to_s).to eq(formatted_value)
198
+ expect(to_s_result).to eq(formatted_value)
199
199
  end
200
200
  end
201
201
 
@@ -295,4 +295,4 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
295
295
  it { is_expected.not_to be_a Range }
296
296
  end
297
297
  end
298
- end
298
+ end
@@ -135,7 +135,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
135
135
  end
136
136
 
137
137
  context '#to_s' do
138
- subject(:to_s) do
138
+ subject(:to_s_value) do
139
139
  nmap.to_s
140
140
  end
141
141
 
@@ -145,7 +145,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
145
145
  }
146
146
 
147
147
  it 'returns a string equal to the original formatted value' do
148
- expect(to_s).to eq(formatted_value)
148
+ expect(to_s_value).to eq(formatted_value)
149
149
  end
150
150
  end
151
151
 
@@ -155,7 +155,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
155
155
  }
156
156
 
157
157
  it 'returned the formatted value as a string' do
158
- expect(to_s).to eq(formatted_value.to_s)
158
+ expect(to_s_value).to eq(formatted_value.to_s)
159
159
  end
160
160
  end
161
161
  end
@@ -273,4 +273,4 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
273
273
  end
274
274
  end
275
275
  end
276
- end
276
+ end
@@ -185,7 +185,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
185
185
  end
186
186
 
187
187
  context '#to_s' do
188
- subject(:to_s) {
188
+ subject(:to_s_result) {
189
189
  range.to_s
190
190
  }
191
191
 
@@ -195,7 +195,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
195
195
  }
196
196
 
197
197
  it 'equals the original formatted value' do
198
- expect(to_s).to eq(formatted_value)
198
+ expect(to_s_result).to eq(formatted_value)
199
199
  end
200
200
  end
201
201
 
@@ -299,4 +299,4 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
299
299
  it { is_expected.not_to be_a Range }
300
300
  end
301
301
  end
302
- end
302
+ end
@@ -39,13 +39,15 @@ module Dummy
39
39
 
40
40
  # Configure sensitive parameters which will be filtered from the log file.
41
41
  config.filter_parameters += [:password]
42
-
42
+
43
43
  # Raise deprecations as errors
44
44
  config.active_support.deprecation = :raise
45
45
 
46
46
  # Enable escaping HTML in JSON.
47
47
  config.active_support.escape_html_entities_in_json = true
48
48
 
49
+ config.active_record.yaml_column_permitted_classes = MetasploitDataModels::YAML::PERMITTED_CLASSES
50
+
49
51
  # Use SQL instead of Active Record's schema dumper when creating the database.
50
52
  # This is necessary if your schema can't be completely dumped by the schema dumper,
51
53
  # like if you have constraints or database-specific column types
@@ -54,13 +56,9 @@ module Dummy
54
56
  # 5.x change to belongs_to
55
57
  config.active_record.belongs_to_required_by_default = true
56
58
 
57
- # Enable the asset pipeline
58
- config.assets.enabled = false
59
-
60
- # Version of your assets, change this if you want to expire all your assets
61
- config.assets.version = '1.0'
62
-
63
59
  config.autoloader = :zeitwerk
60
+
61
+ ActiveRecord.legacy_connection_handling = false
64
62
  end
65
63
  end
66
64
 
@@ -22,16 +22,6 @@ Rails.application.configure do
22
22
  # Raise an error on page load if there are pending migrations.
23
23
  config.active_record.migration_error = :page_load
24
24
 
25
- # Debug mode disables concatenation and preprocessing of assets.
26
- # This option may cause significant delays in view rendering with a large
27
- # number of complex assets.
28
- config.assets.debug = true
29
-
30
- # Adds additional error checking when serving assets at runtime.
31
- # Checks for improperly declared sprockets dependencies.
32
- # Raises helpful error messages.
33
- config.assets.raise_runtime_errors = true
34
-
35
25
  # Raises error for missing translations
36
26
  # config.action_view.raise_on_missing_translations = true
37
27
  end
@@ -22,18 +22,6 @@ Rails.application.configure do
22
22
  # Disable Rails's static asset server (Apache or nginx will already do this).
23
23
  config.serve_static_assets = false
24
24
 
25
- # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
27
- # config.assets.css_compressor = :sass
28
-
29
- # Do not fallback to assets pipeline if a precompiled asset is missed.
30
- config.assets.compile = false
31
-
32
- # Generate digests for assets URLs.
33
- config.assets.digest = true
34
-
35
- # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
36
-
37
25
  # Specifies the header that your server uses for sending files.
38
26
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
39
27
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -93,7 +93,7 @@ cert_chain:
93
93
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
94
94
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
95
95
  -----END CERTIFICATE-----
96
- date: 2022-04-07 00:00:00.000000000 Z
96
+ date: 2022-11-29 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: metasploit-yard
@@ -185,28 +185,28 @@ dependencies:
185
185
  requirements:
186
186
  - - "~>"
187
187
  - !ruby/object:Gem::Version
188
- version: '6.0'
188
+ version: '7.0'
189
189
  type: :runtime
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
193
  - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: '6.0'
195
+ version: '7.0'
196
196
  - !ruby/object:Gem::Dependency
197
197
  name: activesupport
198
198
  requirement: !ruby/object:Gem::Requirement
199
199
  requirements:
200
200
  - - "~>"
201
201
  - !ruby/object:Gem::Version
202
- version: '6.0'
202
+ version: '7.0'
203
203
  type: :runtime
204
204
  prerelease: false
205
205
  version_requirements: !ruby/object:Gem::Requirement
206
206
  requirements:
207
207
  - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: '6.0'
209
+ version: '7.0'
210
210
  - !ruby/object:Gem::Dependency
211
211
  name: metasploit-concern
212
212
  requirement: !ruby/object:Gem::Requirement
@@ -241,14 +241,14 @@ dependencies:
241
241
  requirements:
242
242
  - - "~>"
243
243
  - !ruby/object:Gem::Version
244
- version: '6.0'
244
+ version: '7.0'
245
245
  type: :runtime
246
246
  prerelease: false
247
247
  version_requirements: !ruby/object:Gem::Requirement
248
248
  requirements:
249
249
  - - "~>"
250
250
  - !ruby/object:Gem::Version
251
- version: '6.0'
251
+ version: '7.0'
252
252
  - !ruby/object:Gem::Dependency
253
253
  name: webrick
254
254
  requirement: !ruby/object:Gem::Requirement
@@ -267,16 +267,16 @@ dependencies:
267
267
  name: recog
268
268
  requirement: !ruby/object:Gem::Requirement
269
269
  requirements:
270
- - - "~>"
270
+ - - ">="
271
271
  - !ruby/object:Gem::Version
272
- version: '2.0'
272
+ version: '0'
273
273
  type: :runtime
274
274
  prerelease: false
275
275
  version_requirements: !ruby/object:Gem::Requirement
276
276
  requirements:
277
- - - "~>"
277
+ - - ">="
278
278
  - !ruby/object:Gem::Version
279
- version: '2.0'
279
+ version: '0'
280
280
  - !ruby/object:Gem::Dependency
281
281
  name: arel-helpers
282
282
  requirement: !ruby/object:Gem::Requirement
@@ -576,6 +576,7 @@ files:
576
576
  - lib/metasploit_data_models/search/visitor.rb
577
577
  - lib/metasploit_data_models/serialized_prefs.rb
578
578
  - lib/metasploit_data_models/version.rb
579
+ - lib/metasploit_data_models/yaml.rb
579
580
  - metasploit_data_models.gemspec
580
581
  - script/rails
581
582
  - spec/app/models/mdm/api_key_spec.rb
@@ -674,7 +675,6 @@ files:
674
675
  - spec/dummy/config/environments/production.rb
675
676
  - spec/dummy/config/environments/test.rb
676
677
  - spec/dummy/config/initializers/active_record_migrations.rb
677
- - spec/dummy/config/initializers/assets.rb
678
678
  - spec/dummy/config/initializers/backtrace_silencers.rb
679
679
  - spec/dummy/config/initializers/cookies_serializer.rb
680
680
  - spec/dummy/config/initializers/filter_parameter_logging.rb
@@ -778,7 +778,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
778
778
  requirements:
779
779
  - - ">="
780
780
  - !ruby/object:Gem::Version
781
- version: '2.4'
781
+ version: '2.7'
782
782
  required_rubygems_version: !ruby/object:Gem::Requirement
783
783
  requirements:
784
784
  - - ">="
metadata.gz.sig CHANGED
Binary file
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
5
-
6
- # Precompile additional assets.
7
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
8
- # Rails.application.config.assets.precompile += %w( search.js )