dradis-nipper 4.1.0 → 4.2.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 +3 -0
- data/lib/dradis/plugins/nipper/gem_version.rb +1 -1
- data/lib/nipper/issue.rb +19 -5
- data/spec/fixtures/files/sample_v2.5.xml +68 -0
- data/spec/fixtures/files/{sample.xml → sample_v2.8.xml} +0 -0
- data/spec/upload_v2.5_spec.rb +44 -0
- data/spec/{upload_spec.rb → upload_v2.8_spec.rb} +0 -0
- data/templates/issue.fields +4 -0
- data/templates/issue.sample +6 -0
- data/templates/issue.template +12 -0
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e588c2f6881c201f67ddd432f8969d8a9730f54f7778a033f1e1c48bb705c51f
|
4
|
+
data.tar.gz: 7ca0c0ea61c2483afa6684ae8a476ce2e12db8dff43fbca114c59a22c955da0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a308e7eb4970edcc5d0cc3e42076de676b76552523846528e2e78c3f9b189b3b8d6d92fdb8560c3e4cab9c05f8bc435106e5df2b2e2c1c02f535e003d16fbdc1
|
7
|
+
data.tar.gz: 6385cf130373ab8459afb0de2f677071cf33cc9b5fbb0c4bdf891995f480e6222aedd04758f76a6fc6a4a49f9d80fb16d452126972e0c09c67dbac6e8c0ba1e0
|
data/CHANGELOG.md
CHANGED
data/lib/nipper/issue.rb
CHANGED
@@ -9,8 +9,9 @@ module Nipper
|
|
9
9
|
:cvss_base, :cvss_base_vector,
|
10
10
|
:cvss_environmental, :cvss_environmental_vector,
|
11
11
|
:cvss_temporal, :cvss_temporal_vector,
|
12
|
-
:ease, :finding, :impact, :
|
13
|
-
:
|
12
|
+
:ease, :finding, :impact, :nipperv1_ease, :nipperv1_fix,
|
13
|
+
:nipperv1_impact, :nipperv1_rating,
|
14
|
+
:recommendation, :title
|
14
15
|
]
|
15
16
|
end
|
16
17
|
|
@@ -40,6 +41,8 @@ module Nipper
|
|
40
41
|
@xml.attr('title')
|
41
42
|
elsif method.to_s.starts_with?('cvss')
|
42
43
|
process_cvss_field(method)
|
44
|
+
elsif method.to_s.starts_with?('nipperv1')
|
45
|
+
process_nipperv1_field(method)
|
43
46
|
else
|
44
47
|
collect_text(@xml.xpath("./#{translations_table[method]}"))
|
45
48
|
end
|
@@ -47,9 +50,9 @@ module Nipper
|
|
47
50
|
|
48
51
|
def process_cvss_field(method)
|
49
52
|
translations_table = {
|
50
|
-
cvss_base: 'issuedetails/ratings/cvssv2-base',
|
51
|
-
cvss_temporal: 'issuedetails/ratings/cvssv2-temporal',
|
52
|
-
cvss_environmental: 'issuedetails/ratings/cvssv2-environmental'
|
53
|
+
cvss_base: 'issuedetails/ratings[@type="CVSSv2"]/cvssv2-base',
|
54
|
+
cvss_temporal: 'issuedetails/ratings[@type="CVSSv2"]/cvssv2-temporal',
|
55
|
+
cvss_environmental: 'issuedetails/ratings[@type="CVSSv2"]/cvssv2-environmental'
|
53
56
|
}
|
54
57
|
|
55
58
|
base_method = method.to_s.sub('_vector', '').to_sym
|
@@ -61,6 +64,17 @@ module Nipper
|
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
67
|
+
def process_nipperv1_field(method)
|
68
|
+
translations_table = {
|
69
|
+
nipperv1_ease: 'issuedetails/ratings[@type="Nipperv1"]/ease',
|
70
|
+
nipperv1_fix: 'issuedetails/ratings[@type="Nipperv1"]/fix',
|
71
|
+
nipperv1_impact: 'issuedetails/ratings[@type="Nipperv1"]/impact',
|
72
|
+
nipperv1_rating: 'issuedetails/ratings[@type="Nipperv1"]/rating'
|
73
|
+
}
|
74
|
+
|
75
|
+
@xml.xpath("./#{translations_table[method]}").text
|
76
|
+
end
|
77
|
+
|
64
78
|
private
|
65
79
|
|
66
80
|
def collect_text(xml_field)
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<document nipperstudio="2.5.5.5804" xmlrevision="3" xmlversion="2">
|
3
|
+
<information>
|
4
|
+
<title>Firewall Review Report</title>
|
5
|
+
<author>Compass IT Compliance</author>
|
6
|
+
<authorlogo>C:/Nipper Photos/CompassITC-logo-HiRes-TSP.png</authorlogo>
|
7
|
+
<date>Friday, September 11, 2020</date>
|
8
|
+
<generator>
|
9
|
+
<product>Nipper Studio</product>
|
10
|
+
<manufacturer>Titania</manufacturer>
|
11
|
+
<website>www.titania.com</website>
|
12
|
+
<version>2.8.0</version>
|
13
|
+
</generator>
|
14
|
+
<devices>
|
15
|
+
<device name="PA-200" os="PANOS" osversion="7.0.0" type="Palo Alto Firewall"/>
|
16
|
+
</devices>
|
17
|
+
</information>
|
18
|
+
<report>
|
19
|
+
<part index="2" title="Security Audit" ref="SECURITYAUDIT">
|
20
|
+
<section index="1.1" ref="INTRODUCTION" title="Introduction">
|
21
|
+
<issuedetails>
|
22
|
+
<devices>
|
23
|
+
<device name="PA-200" osversion="7.0.0" type="Palo Alto Firewall"/>
|
24
|
+
</devices>
|
25
|
+
<ratings type="Nipperv1">
|
26
|
+
<rating>High</rating>
|
27
|
+
<impact>Critical</impact>
|
28
|
+
<ease>Moderate</ease>
|
29
|
+
<fix>Quick</fix>
|
30
|
+
</ratings>
|
31
|
+
</issuedetails>
|
32
|
+
<section index="2.2.1" ref="FINDING" title="Finding">
|
33
|
+
<table index="10" ref="AUTHENTICATION.USERS.WEAKPASSWORD.1" title="Table Title">
|
34
|
+
<headings>
|
35
|
+
<heading>Heading 1</heading>
|
36
|
+
<heading>Heading 2</heading>
|
37
|
+
<heading>Heading 3</heading>
|
38
|
+
</headings>
|
39
|
+
<tablebody>
|
40
|
+
<tablerow>
|
41
|
+
<tablecell>
|
42
|
+
<item>Row 1A</item>
|
43
|
+
</tablecell>
|
44
|
+
<tablecell>
|
45
|
+
<item>Row 1B</item>
|
46
|
+
</tablecell>
|
47
|
+
<tablecell>
|
48
|
+
<item>Row 1C</item>
|
49
|
+
</tablecell>
|
50
|
+
</tablerow>
|
51
|
+
<tablerow>
|
52
|
+
<tablecell>
|
53
|
+
<item>Row 2A</item>
|
54
|
+
</tablecell>
|
55
|
+
<tablecell>
|
56
|
+
<item>Row 2B</item>
|
57
|
+
</tablecell>
|
58
|
+
<tablecell>
|
59
|
+
<item>Row 2C</item>
|
60
|
+
</tablecell>
|
61
|
+
</tablerow>
|
62
|
+
</tablebody>
|
63
|
+
</table>
|
64
|
+
</section>
|
65
|
+
</section>
|
66
|
+
</part>
|
67
|
+
</report>
|
68
|
+
</document>
|
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe 'Nipper upload plugin' do
|
4
|
+
describe 'importer' do
|
5
|
+
before(:each) do
|
6
|
+
# Stub template service
|
7
|
+
templates_dir = File.expand_path('../../templates', __FILE__)
|
8
|
+
expect_any_instance_of(Dradis::Plugins::TemplateService)
|
9
|
+
.to receive(:default_templates_dir).and_return(templates_dir)
|
10
|
+
|
11
|
+
plugin = Dradis::Plugins::Nipper
|
12
|
+
|
13
|
+
@content_service = Dradis::Plugins::ContentService::Base.new(plugin: plugin)
|
14
|
+
|
15
|
+
@importer = plugin::Importer.new(
|
16
|
+
content_service: @content_service
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'nipper v2.5 output' do
|
21
|
+
it 'imports Nipperv1 fields and findings table' do
|
22
|
+
expect(@content_service).to receive(:create_node) do |args|
|
23
|
+
expect(args[:label]).to eq('PA-200')
|
24
|
+
expect(args[:type]).to eq(:host)
|
25
|
+
@node = Node.create(label: args[:label])
|
26
|
+
end.once
|
27
|
+
expect(@content_service).to receive(:create_issue) do |args|
|
28
|
+
OpenStruct.new(args)
|
29
|
+
@issue = Issue.create(text: args[:text])
|
30
|
+
end.exactly(1).times
|
31
|
+
expect(@content_service).to receive(:create_evidence) do |args|
|
32
|
+
OpenStruct.new(args)
|
33
|
+
end.exactly(1).times
|
34
|
+
|
35
|
+
@importer.import(file: File.expand_path('../spec/fixtures/files/sample_v2.5.xml', __dir__))
|
36
|
+
|
37
|
+
expect(@issue.fields['Nipperv1.Ease']).to eq('Moderate')
|
38
|
+
expect(@issue.fields['Nipperv1.Fix']).to eq('Quick')
|
39
|
+
expect(@issue.fields['Nipperv1.Impact']).to eq('Critical')
|
40
|
+
expect(@issue.fields['Nipperv1.Rating']).to eq('High')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
File without changes
|
data/templates/issue.fields
CHANGED
data/templates/issue.sample
CHANGED
@@ -10,6 +10,12 @@
|
|
10
10
|
<cvssv2-environmental score="5.6">CDP:ND/TD:ND/CR:ND/IR:ND/AR:ND</cvssv2-environmental>
|
11
11
|
<FindingID>TEST-ISSUE</FindingID>
|
12
12
|
</ratings>
|
13
|
+
<ratings type="Nipperv1">
|
14
|
+
<rating>Test Nipperv1 Rating</rating>
|
15
|
+
<impact>Test Nipperv1 Impact</impact>
|
16
|
+
<ease>Test Nipperv1 Ease</ease>
|
17
|
+
<fix>Test Nipperv1 Fix</fix>
|
18
|
+
</ratings>
|
13
19
|
</issuedetails>
|
14
20
|
<section index="2.3.1" title="Finding" ref="FINDING">
|
15
21
|
<text>Test Finding</text>
|
data/templates/issue.template
CHANGED
@@ -19,5 +19,17 @@
|
|
19
19
|
#[Ease]#
|
20
20
|
%issue.ease%
|
21
21
|
|
22
|
+
#[Nipperv1.Ease]#
|
23
|
+
%issue.nipperv1_ease%
|
24
|
+
|
25
|
+
#[Nipperv1.Fix]#
|
26
|
+
%issue.nipperv1_fix%
|
27
|
+
|
28
|
+
#[Nipperv1.Impact]#
|
29
|
+
%issue.nipperv1_impact%
|
30
|
+
|
31
|
+
#[Nipperv1.Rating]#
|
32
|
+
%issue.nipperv1_rating%
|
33
|
+
|
22
34
|
#[Recommendation]#
|
23
35
|
%issue.recommendation%
|
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: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dradis Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dradis-plugins
|
@@ -107,9 +107,11 @@ files:
|
|
107
107
|
- lib/nipper/issue.rb
|
108
108
|
- lib/tasks/thorfile.rb
|
109
109
|
- spec/fixtures/files/invalid.xml
|
110
|
-
- spec/fixtures/files/
|
110
|
+
- spec/fixtures/files/sample_v2.5.xml
|
111
|
+
- spec/fixtures/files/sample_v2.8.xml
|
111
112
|
- spec/spec_helper.rb
|
112
|
-
- spec/
|
113
|
+
- spec/upload_v2.5_spec.rb
|
114
|
+
- spec/upload_v2.8_spec.rb
|
113
115
|
- templates/evidence.fields
|
114
116
|
- templates/evidence.sample
|
115
117
|
- templates/evidence.template
|
@@ -135,12 +137,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
137
|
- !ruby/object:Gem::Version
|
136
138
|
version: '0'
|
137
139
|
requirements: []
|
138
|
-
rubygems_version: 3.1.
|
140
|
+
rubygems_version: 3.1.4
|
139
141
|
signing_key:
|
140
142
|
specification_version: 4
|
141
143
|
summary: Nipper upload add-on for Dradis Framework.
|
142
144
|
test_files:
|
143
145
|
- spec/fixtures/files/invalid.xml
|
144
|
-
- spec/fixtures/files/
|
146
|
+
- spec/fixtures/files/sample_v2.5.xml
|
147
|
+
- spec/fixtures/files/sample_v2.8.xml
|
145
148
|
- spec/spec_helper.rb
|
146
|
-
- spec/
|
149
|
+
- spec/upload_v2.5_spec.rb
|
150
|
+
- spec/upload_v2.8_spec.rb
|