dradis-plugins 3.9.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5accaba92677eb861a1305b6726d7c798267e882
4
- data.tar.gz: 9d0659edb3d5f647b01c76f63fb810764d6952c9
3
+ metadata.gz: 7672289735c03361bf9a838ad2983e10bf8cff5d
4
+ data.tar.gz: 12c9ba751065766757cdff3bc726117c03a3d9a1
5
5
  SHA512:
6
- metadata.gz: 54c4b1c04760f32268b2bdd41c197ad599b534ed617f57197f2a1fc13c3ac20ad8a84a5bbf5f5a1f039ba19c0cdb46b228d731207c0b83844a6c40169510aa22
7
- data.tar.gz: 73d4162512c945913534c30e0864273ef4bd36940dcbe64ae991a1f8327e532120322e07096e5877d7f589ce08dc177ab8a89e15dcbf5dd49152ffd6d7b4fb59
6
+ metadata.gz: 68399c15408ee09d91244c8b5081703e94154741c091afa637611fbbc1e8bb06b97a9de1470991ed7e01bc52ec90d8ec9ef88c87bcf22645322d82ba805e4f13
7
+ data.tar.gz: f6bf7cda772d6ebaf879188a641caa2ff7c90cfde1e47b098bae79f9474e54b0a24b073229013fae4fe0d8507e7c63b45e22d1259c628ece56cde5afe6bd1802
@@ -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_content_blocks
6
- ContentBlock.where(project_id: project.id)
6
+ project.content_blocks
7
7
  end
8
8
 
9
9
  def create_content_block(args={})
@@ -3,7 +3,7 @@ module Dradis::Plugins::ContentService
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  def all_issues
6
- Issue.where(category_id: default_issue_category.id)
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 = Issue.where(category_id: default_issue_category.id).map do |issue|
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(label: label, type_id: type_id)
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 ||= Node.plugin_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
- Node.user_nodes.where('properties IS NOT NULL AND properties != \'{}\'')
81
+ project.nodes.user_nodes.where('properties IS NOT NULL AND properties != \'{}\'')
78
82
  end
79
83
  end
80
84
  end
@@ -3,7 +3,7 @@ module Dradis::Plugins::ContentService
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  def all_notes
6
- Note.where(category: Category.report)
6
+ project.notes.where(category: Category.report)
7
7
  end
8
8
 
9
9
  def create_note(args={})
@@ -3,7 +3,7 @@ module Dradis::Plugins::ContentService
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  def all_properties
6
- Node.content_library.properties
6
+ project.content_library.properties
7
7
  end
8
8
  end
9
9
  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 ||= 'ProjectScopedController'
10
+ options.base_export_controller_class_name ||= 'AuthenticatedController'
11
11
  options.thor_helper_module ||= Dradis::Plugins::ThorHelper
12
12
  end
13
13
  end
@@ -7,7 +7,7 @@ module Dradis
7
7
 
8
8
  module VERSION
9
9
  MAJOR = 3
10
- MINOR = 9
10
+ MINOR = 10
11
11
  TINY = 0
12
12
  PRE = nil
13
13
 
@@ -5,7 +5,7 @@ module Dradis
5
5
  attr_accessor :task_options, :logger
6
6
 
7
7
  def detect_and_set_project_scope
8
- ;
8
+ task_options[:project_id] = Project.new.id
9
9
  end
10
10
 
11
11
  def task_options
@@ -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
- describe "Issues" do
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 "when the issue already exists in the cache" do
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 "returns the cached issue encapsulated in a finding" do
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 "returns the new Issue encapsulated in a Finding" do
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 "adds the new Finding to the cache" do
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.9.0
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-01-08 00:00:00.000000000 Z
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.4.5
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.