ronin-db-activerecord 0.1.4 → 0.1.6

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: 33a8e923e83f3f3d8441d721b7840a370b230c6bb055c0eee04ddb87e380ecc0
4
- data.tar.gz: a54ff9c9fa40b79e4271122467f9335091943980ab488ed5ef2a3a0f7ba93d29
3
+ metadata.gz: 641f203f12ca2e88ac5de9f8a8c5fe6fbf5da527b7108102d55f0e65934ea641
4
+ data.tar.gz: a55081d93e685f8232ae74e54bd99a5f242b40834d5ea55792ec08f3dc184782
5
5
  SHA512:
6
- metadata.gz: f99534027f46f48308b13038a0d91c0dcb462903d662f37580bab90ca0b08c94a9354d9dfef63a138244f57e9e3c6fc2158a993cfbee12ee551244a22124b6ba
7
- data.tar.gz: 823b4b5a7efdcbdabeede52192e55bedcd4341c356d8679fa4a0782d7c4c686fd12a27b7c0ef8424175449a861c33caf7b3764de16e38a039ed7f8ee130cc9d3
6
+ metadata.gz: f090ebd86546fed4ba74bada319aaaf6c524360b4f48745042aa8d5b5118c50c3e5d3224143c6fa3901546b456dd853dd1fe97853e9c259b76f8ad284e8fec0b
7
+ data.tar.gz: 833ab9ec1142ba4363a42453c874bde62c2b049fb3662dfe3870c9d4eeed38948d0faff22dcdc85b9db71c8610dde8d0393e2ef51779f3df76ee4102c1957f39
@@ -12,6 +12,7 @@ jobs:
12
12
  - '3.0'
13
13
  - '3.1'
14
14
  - '3.2'
15
+ - '3.3'
15
16
  - jruby
16
17
  - truffleruby
17
18
  name: Ruby ${{ matrix.ruby }}
data/ChangeLog.md CHANGED
@@ -1,3 +1,20 @@
1
+ ### 0.1.6 / 2024-06-19
2
+
3
+ * Improve the validation of email addresses passed to
4
+ {Ronin::DB::EmailAddress.import}.
5
+ * Add missing `software_id` column to the `ronin_open_ports` table.
6
+ * Add missing `foreign_key` to {Ronin::DB::SoftwareVendor#software}.
7
+ * Add missing `class_name` to {Ronin::DB::Vulnerability#url}.
8
+ * Add missing `dependent: :destroy` to {Ronin::DB::HostName#urls}.
9
+ * Add missing `dependent: :destroy` to {Ronin::DB::HostName#email_addresses}.
10
+
11
+ ### 0.1.5 / 2023-12-13
12
+
13
+ * Corrected {Ronin::DB::HTTPRequest#request_method} to accept and store
14
+ uppercase HTTP verbs (ex: `GET`).
15
+ * Corrected {Ronin::DB::HTTPRequest#request_method} helper methods to use the
16
+ singular suffix of `_request?` (ex: `get_request?`).
17
+
1
18
  ### 0.1.4 / 2023-10-16
2
19
 
3
20
  * Require [activerecord] `~> 7.0`.
data/Gemfile CHANGED
@@ -8,7 +8,8 @@ gem 'sqlite3', '~> 1.0', platforms: [:mri, :truffleruby]
8
8
 
9
9
  platform :jruby do
10
10
  gem 'jruby-openssl', '~> 0.7'
11
- gem 'activerecord-jdbcsqlite3-adapter', '~> 70.0.pre'
11
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 70.0'
12
+ gem 'activerecord', '< 7.1.0'
12
13
  end
13
14
 
14
15
  group :development do
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
4
+ #
5
+ # Copyright (c) 2022-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # This file is part of ronin-db-activerecord.
8
+ #
9
+ # ronin-db-activerecord is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU Lesser General Public License as published
11
+ # by the Free Software Foundation, either version 3 of the License, or
12
+ # (at your option) any later version.
13
+ #
14
+ # ronin-db-activerecord is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU Lesser General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU Lesser General Public License
20
+ # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
21
+ #
22
+
23
+ #
24
+ # Adds the `software_id` column to the `ronin_open_ports` table.
25
+ #
26
+ class AddSoftwareIdColumnToOpenPortsTable < ActiveRecord::Migration[7.0]
27
+ def change
28
+ add_reference :ronin_open_ports, :software, null: true,
29
+ foreign_key: {
30
+ to_table: :ronin_softwares
31
+ }
32
+ end
33
+ end
data/gemspec.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: ronin-db-activerecord
2
- version: 0.1.4
2
+ version: 0.1.6
3
3
  summary: ActiveRecord backend for the Ronin Database
4
4
  description:
5
5
  ronin-db-activerecord contains ActiveRecord models and migrations for the
data/lib/ronin/db/arch.rb CHANGED
@@ -44,7 +44,7 @@ module Ronin
44
44
  # @!attribute [rw] endian
45
45
  # Endianness of the architecture.
46
46
  #
47
- # @return [:little, :big]
47
+ # @return ["little", "big"]
48
48
  enum :endian, {little: 'little', big: 'big'}
49
49
  validates :endian, presence: true
50
50
 
@@ -159,8 +159,8 @@ module Ronin
159
159
  # @api public
160
160
  #
161
161
  def self.import(email)
162
- if email =~ /\s/
163
- raise(ArgumentError,"email address #{email.inspect} must not contain spaces")
162
+ unless email =~ URI::MailTo::EMAIL_REGEXP
163
+ raise(ArgumentError,"invalid email address: #{email.inspect}")
164
164
  end
165
165
 
166
166
  normalized_email = email.downcase
@@ -92,13 +92,14 @@ module Ronin
92
92
  # The email addresses that are associated with the host-name.
93
93
  #
94
94
  # @return [Array<EmailAddress>]
95
- has_many :email_addresses
95
+ has_many :email_addresses, dependent: :destroy
96
96
 
97
97
  # @!attribute [rw] urls
98
98
  # The URLs that point to this host name.
99
99
  #
100
100
  # @return [Array<URL>]
101
- has_many :urls, class_name: 'URL'
101
+ has_many :urls, dependent: :destroy,
102
+ class_name: 'URL'
102
103
 
103
104
  #
104
105
  # Looks up the host name.
@@ -48,24 +48,24 @@ module Ronin
48
48
  # @!attribute [rw] request_method
49
49
  # The request method.
50
50
  #
51
- # @return [:copy, :delete, :get, :head, :lock, :mkcol, :move, :options, :patch, :post, :propfind, :proppatch, :put, :trace, :unlock]
52
- enum request_method: [
53
- :copy,
54
- :delete,
55
- :get,
56
- :head,
57
- :lock,
58
- :mkcol,
59
- :move,
60
- :options,
61
- :patch,
62
- :post,
63
- :propfind,
64
- :proppatch,
65
- :put,
66
- :trace,
67
- :unlock
68
- ], _suffix: :requests
51
+ # @return ["copy", "delete", "get", "head", "lock", "mkcol", "move", "options", "patch", "post", "propfind", "proppatch", "put", "trace", "unlock"]
52
+ enum request_method: {
53
+ copy: 'COPY',
54
+ delete: 'DELETE',
55
+ get: 'GET',
56
+ head: 'HEAD',
57
+ lock: 'LOCK',
58
+ mkcol: 'MKCOL',
59
+ move: 'MOVE',
60
+ options: 'OPTIONS',
61
+ patch: 'PATCH',
62
+ post: 'POST',
63
+ propfind: 'PROPFIND',
64
+ proppatch: 'PROPPATCH',
65
+ put: 'PUT',
66
+ trace: 'TRACE',
67
+ unlock: 'UNLOCK'
68
+ }, _suffix: :request
69
69
  validates :request_method, presence: true
70
70
 
71
71
  # @!attribute [rw] path
data/lib/ronin/db/os.rb CHANGED
@@ -43,7 +43,7 @@ module Ronin
43
43
  # @!attribute [rw] flavor
44
44
  # The flavor of the OS (Linux, BSD).
45
45
  #
46
- # @return [:linux, :bsd]
46
+ # @return ["linux", "bsd"]
47
47
  enum :flavor, {linux: 'Linux', bsd: 'BSD'}
48
48
 
49
49
  # @!attribute [rw] version
data/lib/ronin/db/port.rb CHANGED
@@ -40,7 +40,7 @@ module Ronin
40
40
  # @!attribute [rw] protocol
41
41
  # The protocol of the port (either `'tcp'` / `'udp'`).
42
42
  #
43
- # @return [:tcp, :udp]
43
+ # @return ["tcp", "udp"]
44
44
  enum :protocol, {tcp: 'tcp', udp: 'udp'}, default: :tcp
45
45
  validates :protocol, presence: true
46
46
 
@@ -31,11 +31,18 @@ module Ronin
31
31
  include Model
32
32
  include Model::HasUniqueName
33
33
 
34
- # The primary-key of the vendor
34
+ # @!attribute [rw] id
35
+ # The primary-key of the vendor
36
+ #
37
+ # @return [Integer]
35
38
  attribute :id, :integer
36
39
 
37
- # Products published by the vendor
38
- has_many :software, class_name: 'Software'
40
+ # @!attribute [rw] software
41
+ # Products published by the vendor
42
+ #
43
+ # @return [Array<Software>]
44
+ has_many :software, class_name: 'Software',
45
+ foreign_key: :vendor_id
39
46
 
40
47
  end
41
48
  end
@@ -72,7 +72,8 @@ module Ronin
72
72
  # The URL that is vulnerable.
73
73
  #
74
74
  # @return [URL, nil]
75
- belongs_to :url, optional: true
75
+ belongs_to :url, optional: true,
76
+ class_name: 'URL'
76
77
 
77
78
  # @!attribute [rw] advisory
78
79
  # The vulnerability advisory.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-db-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-17 00:00:00.000000000 Z
11
+ date: 2024-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uri-query_params
@@ -109,6 +109,7 @@ files:
109
109
  - db/migrate/0033_create_ronin_http_response_headers_table.rb
110
110
  - db/migrate/0034_create_ronin_service_credentials_table.rb
111
111
  - db/migrate/0035_create_ronin_web_credentials_table.rb
112
+ - db/migrate/0036_add_software_id_column_to_open_ports_table.rb
112
113
  - gemspec.yml
113
114
  - lib/ronin/db/address.rb
114
115
  - lib/ronin/db/advisory.rb
@@ -177,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  - !ruby/object:Gem::Version
178
179
  version: '0'
179
180
  requirements: []
180
- rubygems_version: 3.3.26
181
+ rubygems_version: 3.3.27
181
182
  signing_key:
182
183
  specification_version: 4
183
184
  summary: ActiveRecord backend for the Ronin Database