dradis-nipper 3.19.0 → 4.0.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
  SHA256:
3
- metadata.gz: 3d766139eb8dcced7115946cb795c3adde1e1d5ffb907a4568ed44477f04bcda
4
- data.tar.gz: 122e95b6dd0a3116d95f6fbc93a801b65584254c3c0743f67dcd1164b01195e0
3
+ metadata.gz: 94d905bbc8c8f66a9ba18750cf230611a87dc0ad6b754bfb7244212a59538063
4
+ data.tar.gz: 44cc3b043be1e58aa54671c1e85ed8e207a7dc67760aa8ed520436bd834214d0
5
5
  SHA512:
6
- metadata.gz: 48e3d12732fb8ea20fd40fa034dde7bdc9c83fda2e8bccde502360acaf8a35cb1be4c54d80552531856a2fef357f31218a1ce9b428c9e3d564ac3b995d51edb4
7
- data.tar.gz: 3da56d3c1dee84b70528354fbbc25ca224a8cdb5490f9c25b3170f9a659aedb7b39fb72d6f289212d35272cc54b7309aa46a31cd9ae04809d042109430da6db0
6
+ metadata.gz: eabbe29f7590cbb10324dc6bdcf7ff4b166c6da2a77e29b2358c3a9dba00ea758033dffec2c7b5d8bbfe726504272ec2a63894a219c5c2336188e022bba8bc98
7
+ data.tar.gz: d38b4f20a2a3fa9563d6215c73be02de1c9782bb7d918555fea88fcebacbbba0192fa4fbb2e9cba4dd6396b10168f2cfaad86ece558168af3878e25fd9c65dc3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
- ## Dradis Framework 3.XX (XXX, 2020) ##
1
+ ## Dradis Framework 4.0.0 (July, 2021) ##
2
+
3
+ * Include multiple paragraphs when importing fields.
4
+
5
+ ## Dradis Framework 3.22 (April, 2021) ##
6
+
7
+ * No changes.
8
+
9
+ ## Dradis Framework 3.21 (February, 2021) ##
10
+
11
+ * No changes.
12
+
13
+ ## Dradis Framework 3.20 (December, 2020) ##
2
14
 
3
15
  * Initial version.
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.files = `git ls-files`.split($\)
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
 
21
- spec.add_dependency 'dradis-plugins', '~> 3.8'
21
+ spec.add_dependency 'dradis-plugins', '~> 4.0.0'
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 2.1'
24
24
  spec.add_development_dependency 'rake', '~> 13.0'
@@ -1,13 +1,9 @@
1
- module Dradis
2
- module Plugins
3
- module Nipper
4
- class Engine < ::Rails::Engine
5
- isolate_namespace Dradis::Plugins::Nipper
1
+ module Dradis::Plugins::Nipper
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Dradis::Plugins::Nipper
6
4
 
7
- include ::Dradis::Plugins::Base
8
- description 'Processes Nipper XML format'
9
- provides :upload
10
- end
11
- end
5
+ include ::Dradis::Plugins::Base
6
+ description 'Processes Nipper XML format'
7
+ provides :upload
12
8
  end
13
9
  end
@@ -6,8 +6,8 @@ module Dradis
6
6
  end
7
7
 
8
8
  module VERSION
9
- MAJOR = 3
10
- MINOR = 19
9
+ MAJOR = 4
10
+ MINOR = 0
11
11
  TINY = 0
12
12
  PRE = nil
13
13
 
@@ -72,6 +72,12 @@ module Dradis::Plugins::Nipper
72
72
  label: host_xml.attr('name'),
73
73
  type: :host
74
74
  )
75
+
76
+ # Set device properties
77
+ @host_node.set_property(:device_name, host_xml.attr('name'))
78
+ @host_node.set_property(:device_type, host_xml.attr('type'))
79
+ @host_node.set_property(:os_version, host_xml.attr('osversion'))
80
+ @host_node.save
75
81
  end
76
82
  end
77
83
  end
data/lib/nipper/issue.rb CHANGED
@@ -41,7 +41,7 @@ module Nipper
41
41
  elsif method.to_s.starts_with?('cvss')
42
42
  process_cvss_field(method)
43
43
  else
44
- @xml.xpath("./#{translations_table[method]}").first.try(:text)
44
+ collect_text(@xml.xpath("./#{translations_table[method]}"))
45
45
  end
46
46
  end
47
47
 
@@ -55,10 +55,16 @@ module Nipper
55
55
  base_method = method.to_s.sub('_vector', '').to_sym
56
56
 
57
57
  if method.to_s.ends_with?('vector')
58
- @xml.xpath("./#{translations_table[base_method]}").first.try(:text)
58
+ collect_text(@xml.xpath("./#{translations_table[base_method]}"))
59
59
  else
60
60
  @xml.xpath("./#{translations_table[base_method]}").attr('score')
61
61
  end
62
62
  end
63
+
64
+ private
65
+
66
+ def collect_text(xml_field)
67
+ xml_field.children.map { |xml_text| xml_text.text }.join("\n")
68
+ end
63
69
  end
64
70
  end
data/spec/upload_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe 'Nipper upload plugin' do
4
4
  describe 'importer' do
@@ -23,24 +23,35 @@ describe 'Nipper upload plugin' do
23
23
  OpenStruct.new(args)
24
24
  end.once
25
25
 
26
- @importer.import(file: 'spec/fixtures/files/invalid.xml')
26
+ @importer.import(file: File.expand_path('../spec/fixtures/files/invalid.xml', __dir__))
27
27
  end
28
28
 
29
29
  it 'creates nodes, issues, and evidences as needed' do
30
30
  expect(@content_service).to receive(:create_node) do |args|
31
31
  expect(args[:label]).to eq('PA-200')
32
32
  expect(args[:type]).to eq(:host)
33
- OpenStruct.new(args)
33
+ @node = Node.create(label: args[:label])
34
34
  end.once
35
35
  expect(@content_service).to receive(:create_issue) do |args|
36
36
  OpenStruct.new(args)
37
+ @issue = Issue.create(text: args[:text])
37
38
  end.exactly(2).times
38
39
  expect(@content_service).to receive(:create_evidence) do |args|
39
40
  OpenStruct.new(args)
40
41
  end.exactly(2).times
41
42
 
42
43
  # Run the import
43
- @importer.import(file: 'spec/fixtures/files/sample.xml')
44
+ @importer.import(file: File.expand_path('../spec/fixtures/files/sample.xml', __dir__))
45
+
46
+ expect(@node.properties).to eq(
47
+ {
48
+ 'device_name'=>'PA-200',
49
+ 'device_type'=>'Palo Alto Firewall',
50
+ 'os_version'=>'7.0.0'
51
+ }
52
+ )
53
+
54
+ expect(@issue.fields['Finding'].lines.count).to eq(2)
44
55
  end
45
56
  end
46
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dradis-nipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.19.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dradis Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dradis-plugins
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.8'
19
+ version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.8'
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -115,11 +115,11 @@ files:
115
115
  - templates/issue.fields
116
116
  - templates/issue.sample
117
117
  - templates/issue.template
118
- homepage:
118
+ homepage:
119
119
  licenses:
120
120
  - Commercial - Dradis Pro
121
121
  metadata: {}
122
- post_install_message:
122
+ post_install_message:
123
123
  rdoc_options: []
124
124
  require_paths:
125
125
  - lib
@@ -134,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
- rubygems_version: 3.0.1
138
- signing_key:
137
+ rubygems_version: 3.1.4
138
+ signing_key:
139
139
  specification_version: 4
140
140
  summary: Nipper upload add-on for Dradis Framework.
141
141
  test_files: