dradis-plugins 4.19.0 → 5.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/dradis/plugins/base.rb +8 -1
- data/lib/dradis/plugins/gem_version.rb +2 -2
- data/lib/dradis/plugins/settings/adapters/db.rb +2 -6
- data/lib/dradis/plugins/settings/adapters/encrypted_configuration.rb +5 -5
- data/lib/dradis/plugins.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c0f03b4fe267f990094ae155369fc8d7eb667ad36dffb3cb2359126731f6bf2
|
|
4
|
+
data.tar.gz: fd98735eab3125c8145b49968dca0de2a80a46f3a8769ca02bdf06b71b0168cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab7cafa1f6a2c963990e4e8162e6e7232f9ec8e918588ca5767a268fd0e0aabe861da5dbc4d1a2db206f5c720f4054149a898c42b151f8597a6a3d125ae49191
|
|
7
|
+
data.tar.gz: a6557601dde763a45b2f760e1f0b2315c6d126cce2919909093f89a2b0037b11e874decee2ad281951131f9b509909540b215a00d1ce15b0a35a8b118c6af1a4
|
data/CHANGELOG.md
CHANGED
data/lib/dradis/plugins/base.rb
CHANGED
|
@@ -43,19 +43,26 @@ module Dradis
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def enabled?
|
|
46
|
-
|
|
46
|
+
# if db is ready, answer truthfully. If not, return false
|
|
47
|
+
db_ready? && ActiveRecord::Type::Boolean.new.cast(self.settings.enabled)
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def enable!
|
|
51
|
+
return unless db_ready?
|
|
50
52
|
self.settings.update_settings(enabled: true)
|
|
51
53
|
Dradis::Plugins::clear_enabled_list
|
|
52
54
|
end
|
|
53
55
|
|
|
54
56
|
def disable!
|
|
57
|
+
return unless db_ready?
|
|
55
58
|
self.settings.update_settings(enabled: false)
|
|
56
59
|
Dradis::Plugins::clear_enabled_list
|
|
57
60
|
end
|
|
58
61
|
end
|
|
62
|
+
|
|
63
|
+
def db_ready?
|
|
64
|
+
(ActiveRecord::Base.connection.verify! rescue false) && ::Configuration.table_exists?
|
|
65
|
+
end
|
|
59
66
|
end
|
|
60
67
|
end
|
|
61
68
|
end
|
|
@@ -9,11 +9,11 @@ module Dradis::Plugins::Settings::Adapters
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def exists?(key)
|
|
12
|
-
|
|
12
|
+
Configuration.exists?(name: namespaced_key(key))
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def read(key)
|
|
16
|
-
|
|
16
|
+
Configuration.find_by(name: namespaced_key(key))&.value
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def write(key, value)
|
|
@@ -26,9 +26,5 @@ module Dradis::Plugins::Settings::Adapters
|
|
|
26
26
|
def namespaced_key(key)
|
|
27
27
|
[@namespace, key.to_s.underscore].join(':')
|
|
28
28
|
end
|
|
29
|
-
|
|
30
|
-
def db_ready?
|
|
31
|
-
(ActiveRecord::Base.connection.verify! rescue false) && Configuration.table_exists?
|
|
32
|
-
end
|
|
33
29
|
end
|
|
34
30
|
end
|
|
@@ -32,17 +32,17 @@ module Dradis::Plugins::Settings::Adapters
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
private
|
|
35
|
+
|
|
35
36
|
def config_path
|
|
36
|
-
@config_path ||= Rails.root.join('config', '
|
|
37
|
+
@config_path ||= Rails.root.join('config', 'credentials', 'dradis-plugins.yml.enc')
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def configuration
|
|
40
41
|
@configuration ||= begin
|
|
41
42
|
create_key unless key_path.exist?
|
|
42
|
-
|
|
43
|
+
# env_key is a no-op since we're always providing a key_path, but it is required by the initializer and we don't want to re-use RAILS_MASTER_KEY
|
|
43
44
|
ActiveSupport::EncryptedConfiguration.new(
|
|
44
|
-
config_path: config_path, key_path: key_path,
|
|
45
|
-
env_key: 'RAILS_MASTER_KEY', raise_if_missing_key: true
|
|
45
|
+
config_path: config_path, key_path: key_path, env_key: 'DRADIS_PLUGINS_KEY', raise_if_missing_key: true
|
|
46
46
|
)
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -52,7 +52,7 @@ module Dradis::Plugins::Settings::Adapters
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def key_path
|
|
55
|
-
@key_path ||= Rails.root.join('config', '
|
|
55
|
+
@key_path ||= Rails.root.join('config', 'credentials', 'dradis-plugins.key')
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
end
|
data/lib/dradis/plugins.rb
CHANGED
|
@@ -22,8 +22,9 @@ module Dradis
|
|
|
22
22
|
|
|
23
23
|
# Filters the list of plugins and only returns those that provide the
|
|
24
24
|
# requested feature and enabled
|
|
25
|
-
def with_feature(feature)
|
|
26
|
-
|
|
25
|
+
def with_feature(feature, include_disabled: false)
|
|
26
|
+
integrations_list = include_disabled ? list : enabled_list
|
|
27
|
+
integrations_list.select do |plugin|
|
|
27
28
|
# engine = "#{plugin}::Engine".constantize
|
|
28
29
|
plugin.provides?(feature)
|
|
29
30
|
end
|