dradis-projects 4.14.0 → 4.16.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 +6 -0
- data/lib/dradis/plugins/projects/gem_version.rb +1 -1
- data/lib/dradis/plugins/projects/upload/v4/template.rb +4 -1
- data/spec/fixtures/files/attachments_url.xml +1 -1
- data/spec/fixtures/files/with_tags.xml +64 -0
- data/spec/lib/dradis/plugins/projects/upload/v4/template_spec.rb +36 -29
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 190b2974ea89987ce0bd6f61292f0cb9f6fa6d1e667f30f78a7242e3c66c4ebf
|
4
|
+
data.tar.gz: 7d229b7f4a3bc5ba44d0d404abe3f00e5761c75c692e5887a50bfecf2eaa6c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 213a1ae826f13998bc30c53f59f06cd3e8da11d6540e402b1839fa7af8d5d55956787b7cf83241da8e78dc5f0ac12759a1f2c11bb2fce4d3b873b403ccffcaba
|
7
|
+
data.tar.gz: eb451183b34171baf0d9056f81a90bf535e84ec13316cc0b00e875d16c9fdb4fb6731d355660b5de2174cf5c7be900279a5c1c16492343ff97c5540c33e25a91
|
data/CHANGELOG.md
CHANGED
@@ -383,11 +383,14 @@ module Dradis::Plugins::Projects::Upload::V4
|
|
383
383
|
def parse_tags(template)
|
384
384
|
logger.info { 'Processing Tags...' }
|
385
385
|
|
386
|
-
template.xpath('dradis-template/tags/tag').each do |xml_tag|
|
386
|
+
template.xpath('dradis-template/tags/tag').each.with_index(1) do |xml_tag, index|
|
387
387
|
name = xml_tag.at_xpath('name').text()
|
388
388
|
tag_params = { name: name }
|
389
389
|
tag_params[:project_id] = project.id if Tag.has_attribute?(:project_id)
|
390
|
+
|
390
391
|
tag = Tag.where(tag_params).first_or_create
|
392
|
+
tag.update(position: index) unless tag.position == index
|
393
|
+
|
391
394
|
logger.info { "New tag detected: #{name}" }
|
392
395
|
|
393
396
|
xml_tag.xpath('./taggings/tagging').each do |xml_tagging|
|
@@ -12,4 +12,4 @@ Test Issue
|
|
12
12
|
!/nodes/5/attachments/hello.jpg!
|
13
13
|
|
14
14
|
]]></text><activities></activities><comments></comments></issue></issues><methodologies></methodologies><categories>
|
15
|
-
<category><id>2</id><name>Issue description</name></category></categories><tags
|
15
|
+
<category><id>2</id><name>Issue description</name></category></categories><tags/></dradis-template>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<dradis-template version="2">
|
3
|
+
<nodes>
|
4
|
+
<node>
|
5
|
+
<id>5</id>
|
6
|
+
<label>Uploaded files</label>
|
7
|
+
<parent-id />
|
8
|
+
<position>0</position>
|
9
|
+
<properties><![CDATA[{
|
10
|
+
}]]></properties>
|
11
|
+
<type-id>0</type-id>
|
12
|
+
<notes></notes>
|
13
|
+
<evidence></evidence>
|
14
|
+
<activities></activities>
|
15
|
+
</node>
|
16
|
+
</nodes>
|
17
|
+
<issues>
|
18
|
+
<issue>
|
19
|
+
<id>2</id>
|
20
|
+
<author>admin@securityroots.com</author>
|
21
|
+
<text><![CDATA[#[Title]#
|
22
|
+
Test Issue
|
23
|
+
#[Description]#
|
24
|
+
hello world]]>
|
25
|
+
</text>
|
26
|
+
<activities></activities>
|
27
|
+
<comments></comments>
|
28
|
+
</issue>
|
29
|
+
</issues>
|
30
|
+
<methodologies></methodologies>
|
31
|
+
<categories>
|
32
|
+
<category>
|
33
|
+
<id>2</id>
|
34
|
+
<name>Issue description</name>
|
35
|
+
</category>
|
36
|
+
</categories>
|
37
|
+
<tags>
|
38
|
+
<tag>
|
39
|
+
<id>1</id>
|
40
|
+
<name>!2ca02c_info</name>
|
41
|
+
<taggings></taggings>
|
42
|
+
</tag>
|
43
|
+
<tag>
|
44
|
+
<id>2</id>
|
45
|
+
<name>!ff7f0e_medium</name>
|
46
|
+
<taggings></taggings>
|
47
|
+
</tag>
|
48
|
+
<tag>
|
49
|
+
<id>3</id>
|
50
|
+
<name>!d62728_high</name>
|
51
|
+
<taggings></taggings>
|
52
|
+
</tag>
|
53
|
+
<tag>
|
54
|
+
<id>4</id>
|
55
|
+
<name>!6baed6_low</name>
|
56
|
+
<taggings></taggings>
|
57
|
+
</tag>
|
58
|
+
<tag>
|
59
|
+
<id>5</id>
|
60
|
+
<name>!9467bd_critical</name>
|
61
|
+
<taggings></taggings>
|
62
|
+
</tag>
|
63
|
+
</tags>
|
64
|
+
</dradis-template>
|
@@ -7,6 +7,13 @@ describe 'Dradis::Plugins::Projects::Upload::V4::Template::Importer' do
|
|
7
7
|
let(:project) { create(:project) }
|
8
8
|
let(:user) { create(:user) }
|
9
9
|
let(:importer_class) { Dradis::Plugins::Projects::Upload::Template }
|
10
|
+
let(:importer) do
|
11
|
+
importer_class::Importer.new(
|
12
|
+
default_user_id: user.id,
|
13
|
+
plugin: importer_class,
|
14
|
+
project_id: project.id
|
15
|
+
)
|
16
|
+
end
|
10
17
|
|
11
18
|
context 'uploading a template with attachments url' do
|
12
19
|
let(:file_path) do
|
@@ -14,12 +21,6 @@ describe 'Dradis::Plugins::Projects::Upload::V4::Template::Importer' do
|
|
14
21
|
end
|
15
22
|
|
16
23
|
it 'converts the urls' do
|
17
|
-
importer = importer_class::Importer.new(
|
18
|
-
default_user_id: user.id,
|
19
|
-
plugin: importer_class,
|
20
|
-
project_id: project.id
|
21
|
-
)
|
22
|
-
|
23
24
|
importer.import(file: file_path)
|
24
25
|
|
25
26
|
p_id = project.id
|
@@ -40,12 +41,6 @@ describe 'Dradis::Plugins::Projects::Upload::V4::Template::Importer' do
|
|
40
41
|
end
|
41
42
|
|
42
43
|
it 'returns false' do
|
43
|
-
importer = importer_class::Importer.new(
|
44
|
-
default_user_id: user.id,
|
45
|
-
plugin: importer_class,
|
46
|
-
project_id: project.id
|
47
|
-
)
|
48
|
-
|
49
44
|
expect(importer.import(file: file_path)).to be false
|
50
45
|
end
|
51
46
|
end
|
@@ -87,12 +82,6 @@ describe 'Dradis::Plugins::Projects::Upload::V4::Template::Importer' do
|
|
87
82
|
end
|
88
83
|
|
89
84
|
before do
|
90
|
-
importer = importer_class::Importer.new(
|
91
|
-
default_user_id: user.id,
|
92
|
-
plugin: importer_class,
|
93
|
-
project_id: project.id
|
94
|
-
)
|
95
|
-
|
96
85
|
importer.import(file: file_path)
|
97
86
|
end
|
98
87
|
|
@@ -132,17 +121,9 @@ describe 'Dradis::Plugins::Projects::Upload::V4::Template::Importer' do
|
|
132
121
|
File.join(File.dirname(__FILE__), '../../../../../../', 'fixtures', 'files')
|
133
122
|
end
|
134
123
|
|
135
|
-
before do
|
136
|
-
@importer = importer_class::Importer.new(
|
137
|
-
default_user_id: user.id,
|
138
|
-
plugin: importer_class,
|
139
|
-
project_id: project.id
|
140
|
-
)
|
141
|
-
end
|
142
|
-
|
143
124
|
context 'uploading a template without states' do
|
144
125
|
it 'imports issues with the published state' do
|
145
|
-
|
126
|
+
importer.import(file: File.join(dir, 'with_comments.xml'))
|
146
127
|
issue = project.issues.first
|
147
128
|
expect(issue.state).to eq('published')
|
148
129
|
end
|
@@ -151,7 +132,7 @@ describe 'Dradis::Plugins::Projects::Upload::V4::Template::Importer' do
|
|
151
132
|
context 'uploading a template with states' do
|
152
133
|
context 'valid states' do
|
153
134
|
it 'imports issues with states from the template' do
|
154
|
-
|
135
|
+
importer.import(file: File.join(dir, 'with_states.xml'))
|
155
136
|
issue = project.issues.first
|
156
137
|
expect(issue.state).to eq('ready_for_review')
|
157
138
|
end
|
@@ -159,10 +140,36 @@ describe 'Dradis::Plugins::Projects::Upload::V4::Template::Importer' do
|
|
159
140
|
|
160
141
|
context 'invalid states' do
|
161
142
|
it 'does not import the issue' do
|
162
|
-
|
143
|
+
importer.import(file: File.join(dir, 'with_invalid_states.xml'))
|
163
144
|
expect(project.issues.count).to eq(0)
|
164
145
|
end
|
165
146
|
end
|
166
147
|
end
|
167
148
|
end
|
149
|
+
|
150
|
+
describe 'tags' do
|
151
|
+
let(:file_path) do
|
152
|
+
File.join(
|
153
|
+
File.dirname(__FILE__),
|
154
|
+
'../../../../../../',
|
155
|
+
'fixtures',
|
156
|
+
'files',
|
157
|
+
'with_tags.xml'
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'updates project tags according to the order in the template' do
|
162
|
+
importer.import(file: file_path)
|
163
|
+
|
164
|
+
tag_values = project.tags.pluck(:name, :position)
|
165
|
+
expected_values = [
|
166
|
+
["!2ca02c_info", 1],
|
167
|
+
["!ff7f0e_medium", 2],
|
168
|
+
["!d62728_high", 3],
|
169
|
+
["!6baed6_low", 4],
|
170
|
+
["!9467bd_critical", 5]
|
171
|
+
]
|
172
|
+
expect(tag_values).to eq(expected_values)
|
173
|
+
end
|
174
|
+
end
|
168
175
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dradis-projects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.16.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:
|
11
|
+
date: 2025-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- spec/fixtures/files/with_comments.xml
|
142
142
|
- spec/fixtures/files/with_invalid_states.xml
|
143
143
|
- spec/fixtures/files/with_states.xml
|
144
|
+
- spec/fixtures/files/with_tags.xml
|
144
145
|
- spec/lib/dradis/plugins/projects/export/v2/template_spec.rb
|
145
146
|
- spec/lib/dradis/plugins/projects/export/v4/template_spec.rb
|
146
147
|
- spec/lib/dradis/plugins/projects/upload/v1/template_spec.rb
|
@@ -176,6 +177,7 @@ test_files:
|
|
176
177
|
- spec/fixtures/files/with_comments.xml
|
177
178
|
- spec/fixtures/files/with_invalid_states.xml
|
178
179
|
- spec/fixtures/files/with_states.xml
|
180
|
+
- spec/fixtures/files/with_tags.xml
|
179
181
|
- spec/lib/dradis/plugins/projects/export/v2/template_spec.rb
|
180
182
|
- spec/lib/dradis/plugins/projects/export/v4/template_spec.rb
|
181
183
|
- spec/lib/dradis/plugins/projects/upload/v1/template_spec.rb
|