dradis-plugins 3.9.0 → 3.10.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 +7 -0
- data/lib/dradis/plugins/content_service/content_blocks.rb +1 -1
- data/lib/dradis/plugins/content_service/issues.rb +3 -8
- data/lib/dradis/plugins/content_service/nodes.rb +7 -3
- data/lib/dradis/plugins/content_service/notes.rb +1 -1
- data/lib/dradis/plugins/content_service/properties.rb +1 -1
- data/lib/dradis/plugins/engine.rb +1 -1
- data/lib/dradis/plugins/gem_version.rb +1 -1
- data/lib/dradis/plugins/thor_helper.rb +1 -1
- data/spec/lib/dradis/plugins/content_service_spec.rb +17 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7672289735c03361bf9a838ad2983e10bf8cff5d
|
4
|
+
data.tar.gz: 12c9ba751065766757cdff3bc726117c03a3d9a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68399c15408ee09d91244c8b5081703e94154741c091afa637611fbbc1e8bb06b97a9de1470991ed7e01bc52ec90d8ec9ef88c87bcf22645322d82ba805e4f13
|
7
|
+
data.tar.gz: f6bf7cda772d6ebaf879188a641caa2ff7c90cfde1e47b098bae79f9474e54b0a24b073229013fae4fe0d8507e7c63b45e22d1259c628ece56cde5afe6bd1802
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## Dradis Framework 3.10 (August, 2018) ##
|
2
|
+
|
3
|
+
* Add default project to task options
|
4
|
+
* Use AuthenticatedController as export base
|
5
|
+
* Default title sorting for content blocks
|
6
|
+
* Avoid requiring the caller to use `set_project_scope`
|
7
|
+
|
1
8
|
## Dradis Framework 3.9 (January, 2018) ##
|
2
9
|
|
3
10
|
* No changes
|
@@ -3,7 +3,7 @@ module Dradis::Plugins::ContentService
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
def all_issues
|
6
|
-
|
6
|
+
project.issues.where(category_id: default_issue_category.id)
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_issue(args={})
|
@@ -26,7 +26,7 @@ module Dradis::Plugins::ContentService
|
|
26
26
|
|
27
27
|
issue = Issue.new(text: text) do |i|
|
28
28
|
i.author = default_author
|
29
|
-
i.node = issue_library
|
29
|
+
i.node = project.issue_library
|
30
30
|
i.category = default_issue_category
|
31
31
|
end
|
32
32
|
|
@@ -64,7 +64,7 @@ module Dradis::Plugins::ContentService
|
|
64
64
|
# the issue library cache has been initialized.
|
65
65
|
def issue_cache
|
66
66
|
@issue_cache ||= begin
|
67
|
-
issues_map =
|
67
|
+
issues_map = all_issues.map do |issue|
|
68
68
|
cache_key = [
|
69
69
|
issue.fields['plugin'],
|
70
70
|
issue.fields['plugin_id']
|
@@ -90,10 +90,5 @@ module Dradis::Plugins::ContentService
|
|
90
90
|
def default_issue_text
|
91
91
|
"create_issue() invoked by #{plugin} without a :text parameter"
|
92
92
|
end
|
93
|
-
|
94
|
-
def issue_library
|
95
|
-
@issue_library ||= Node.issue_library
|
96
|
-
end
|
97
|
-
|
98
93
|
end
|
99
94
|
end
|
@@ -34,7 +34,11 @@ module Dradis::Plugins::ContentService
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
parent.children.find_or_create_by(
|
37
|
+
parent.children.find_or_create_by(
|
38
|
+
label: label,
|
39
|
+
type_id: type_id,
|
40
|
+
project_id: parent.project_id
|
41
|
+
)
|
38
42
|
end
|
39
43
|
|
40
44
|
private
|
@@ -44,7 +48,7 @@ module Dradis::Plugins::ContentService
|
|
44
48
|
end
|
45
49
|
|
46
50
|
def default_node_parent
|
47
|
-
@default_parent_node ||=
|
51
|
+
@default_parent_node ||= project.plugin_parent_node
|
48
52
|
end
|
49
53
|
|
50
54
|
def default_node_type
|
@@ -74,7 +78,7 @@ module Dradis::Plugins::ContentService
|
|
74
78
|
#
|
75
79
|
# Returns and Array with a unique collection of Nodes.
|
76
80
|
def nodes_from_properties
|
77
|
-
|
81
|
+
project.nodes.user_nodes.where('properties IS NOT NULL AND properties != \'{}\'')
|
78
82
|
end
|
79
83
|
end
|
80
84
|
end
|
@@ -7,7 +7,7 @@ module Dradis
|
|
7
7
|
|
8
8
|
initializer "dradis-plugins.set_configs" do |app|
|
9
9
|
options = app.config.dradis
|
10
|
-
options.base_export_controller_class_name ||= '
|
10
|
+
options.base_export_controller_class_name ||= 'AuthenticatedController'
|
11
11
|
options.thor_helper_module ||= Dradis::Plugins::ThorHelper
|
12
12
|
end
|
13
13
|
end
|
@@ -1,9 +1,21 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
# These specs are coming from engines/dradispro-rules/spec/content_service_spec.rb
|
4
|
+
# To run, execute from Dradis main app folder:
|
5
|
+
# bin/rspec [dradis-plugins path]/spec/lib/dradis/plugins/content_service_spec.rb
|
4
6
|
|
5
7
|
describe Dradis::Plugins::ContentService::Base do
|
6
|
-
|
8
|
+
let(:plugin) { Dradis::Plugins::Nessus }
|
9
|
+
let(:project) { create(:project) }
|
10
|
+
let(:service) do
|
11
|
+
Dradis::Plugins::ContentService::Base.new(
|
12
|
+
plugin: plugin,
|
13
|
+
logger: Rails.logger,
|
14
|
+
project: project
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'Issues' do
|
7
19
|
let(:create_issue) do
|
8
20
|
service.create_issue_without_callback(id: plugin_id)
|
9
21
|
end
|
@@ -14,7 +26,7 @@ describe Dradis::Plugins::ContentService::Base do
|
|
14
26
|
# it's being stored within an instance of FindingCache, which
|
15
27
|
# automatically wraps Issues in Findings.
|
16
28
|
|
17
|
-
describe
|
29
|
+
describe 'when the issue already exists in the cache' do
|
18
30
|
let(:existing_issue) { create(:issue, text: cached_issue_text) }
|
19
31
|
before { cache.store(existing_issue) }
|
20
32
|
|
@@ -22,7 +34,7 @@ describe Dradis::Plugins::ContentService::Base do
|
|
22
34
|
expect{create_issue}.not_to change{Issue.count}
|
23
35
|
end
|
24
36
|
|
25
|
-
it
|
37
|
+
it 'returns the cached issue encapsulated in a finding' do
|
26
38
|
finding = create_issue
|
27
39
|
expect(finding).to be_a(Finding)
|
28
40
|
expect(finding).to eq Finding.from_issue(existing_issue)
|
@@ -37,13 +49,13 @@ describe Dradis::Plugins::ContentService::Base do
|
|
37
49
|
expect(new_issue.body).to match(/#\[plugin_id\]#\n*#{plugin_id}/)
|
38
50
|
end
|
39
51
|
|
40
|
-
it
|
52
|
+
it 'returns the new Issue encapsulated in a Finding' do
|
41
53
|
finding = create_issue
|
42
54
|
expect(finding).to be_a(Finding)
|
43
55
|
expect(finding).to eq Finding.from_issue(Issue.last)
|
44
56
|
end
|
45
57
|
|
46
|
-
it
|
58
|
+
it 'adds the new Finding to the cache' do
|
47
59
|
finding = create_issue
|
48
60
|
expect(cache[cache_key]).to eq finding
|
49
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dradis-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.6.8
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Plugin manager for the Dradis Framework project.
|