dradis-projects 3.8.0 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/dradis/plugins/projects/gem_version.rb +1 -1
- data/lib/dradis/plugins/projects/upload/v1/template.rb +30 -26
- 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: 0b132456fc52c60a49be0e8fcb92b42d05874c1d
|
4
|
+
data.tar.gz: d240988d1166f96509d3c483a6cc2179dad5d86c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ac336d9eb5203fd73f23b3ccc2ef60d78c3f401fc4d8401b3e5c4cbd88090893fefea25fced73dcf08dcccd5a57ce43a83ef8e4a7f11cd24c404a4b2be241b4
|
7
|
+
data.tar.gz: b6da1f393598f2cac694b55955c17117b4d7cccb2e2a2de1f8bc6a3c786604119fc8f692c2c64c8a7e2d1c7465f41906b848a025b8bff343b12fd415a9a03ce9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## Dradis Framework 3.9 (January, 2018) ##
|
2
|
+
|
3
|
+
* Fix nodes upload
|
4
|
+
|
5
|
+
* Add default user id as fallback for activity user when importing
|
6
|
+
|
1
7
|
## Dradis Framework 3.8 (September, 2017) ##
|
2
8
|
|
3
9
|
* Add version attribute to exported methodologies
|
@@ -8,7 +14,7 @@
|
|
8
14
|
|
9
15
|
* Skip closing the logger in thorfile
|
10
16
|
|
11
|
-
## Dradis Framework 3.6 (March
|
17
|
+
## Dradis Framework 3.6 (March, 2017) ##
|
12
18
|
|
13
19
|
* Include file version in project template export.
|
14
20
|
|
@@ -58,8 +58,8 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
58
58
|
def finalize(template)
|
59
59
|
logger.info { 'Wrapping up...' }
|
60
60
|
|
61
|
-
finalize_evidence()
|
62
61
|
finalize_nodes()
|
62
|
+
finalize_evidence()
|
63
63
|
finalize_attachments()
|
64
64
|
|
65
65
|
logger.info { 'Done.' }
|
@@ -67,17 +67,18 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
67
67
|
|
68
68
|
def finalize_attachments
|
69
69
|
# Adjust attachment URLs for new Node IDs
|
70
|
-
pending_changes[:attachment_notes].each do |
|
70
|
+
pending_changes[:attachment_notes].each do |item|
|
71
|
+
text_attr = item.is_a?(ContentBlock) ? :content : :text
|
71
72
|
|
72
|
-
logger.info { "Adjusting screenshot URLs:
|
73
|
+
logger.info { "Adjusting screenshot URLs: #{item.class.name} ##{item.id}" }
|
73
74
|
|
74
|
-
new_text =
|
75
|
+
new_text = item.send(text_attr).gsub(%r{^!(.*)/nodes/(\d+)/attachments/(.+)!$}) do |_|
|
75
76
|
"!%s/nodes/%d/attachments/%s!" % [$1, lookup_table[:nodes][$2], $3]
|
76
77
|
end
|
77
78
|
|
78
|
-
|
79
|
+
item.send(text_attr.to_s + "=", new_text)
|
79
80
|
|
80
|
-
raise "Couldn't save note attachment URL for
|
81
|
+
raise "Couldn't save note attachment URL for #{item.class.name} ##{item.id}" unless validate_and_save(item)
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
@@ -199,7 +200,7 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
199
200
|
type_id = element.text.nil? ? nil : element.text.strip
|
200
201
|
label = xml_node.at_xpath('label').text.strip
|
201
202
|
element = xml_node.at_xpath('parent-id')
|
202
|
-
parent_id = element.text.
|
203
|
+
parent_id = element.text.blank? ? nil : element.text.strip
|
203
204
|
|
204
205
|
# Node positions
|
205
206
|
element = xml_node.at_xpath('position')
|
@@ -218,28 +219,36 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
218
219
|
# more than one of this nodes, in any given tree:
|
219
220
|
# - the Configuration.uploadsNode node (detected by its label)
|
220
221
|
# - any nodes with type different from DEFAULT or HOST
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
222
|
+
if label == Configuration.plugin_uploads_node
|
223
|
+
node = Node.create_with(type_id: type_id, parent_id: parent_id)
|
224
|
+
.find_or_create_by!(label: label)
|
225
|
+
elsif Node::Types::USER_TYPES.exclude?(type_id.to_i)
|
226
|
+
node = Node.create_with(label: label)
|
227
|
+
.find_or_create_by!(type_id: type_id)
|
228
|
+
else
|
229
|
+
# We don't want to validate child nodes here yet since they always
|
230
|
+
# have invalid parent id's. They'll eventually be validated in the
|
231
|
+
# finalize_nodes method.
|
232
|
+
has_nil_parent = !parent_id
|
233
|
+
node =
|
234
|
+
Node.new(
|
230
235
|
type_id: type_id,
|
231
236
|
label: label,
|
232
237
|
parent_id: parent_id,
|
233
238
|
position: position
|
234
239
|
)
|
235
|
-
|
240
|
+
node.save!(validate: has_nil_parent)
|
241
|
+
pending_changes[:orphan_nodes] << node if parent_id
|
242
|
+
end
|
236
243
|
|
237
|
-
|
244
|
+
if properties
|
245
|
+
node.raw_properties = properties
|
246
|
+
node.save!(validate: has_nil_parent)
|
247
|
+
end
|
238
248
|
|
239
249
|
node.update_attribute(:created_at, created_at.text.strip) if created_at
|
240
250
|
node.update_attribute(:updated_at, updated_at.text.strip) if updated_at
|
241
251
|
|
242
|
-
raise "Couldn't save Node" unless validate_and_save(node)
|
243
252
|
raise "Couldn't create activities for Node ##{node.id}" unless create_activities(node, xml_node)
|
244
253
|
|
245
254
|
parse_node_notes(node, xml_node)
|
@@ -258,11 +267,6 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
258
267
|
|
259
268
|
# keep track of reassigned ids
|
260
269
|
lookup_table[:nodes][xml_node.at_xpath('id').text.strip] = node.id
|
261
|
-
|
262
|
-
if node.parent_id != nil
|
263
|
-
# keep track of orphaned nodes
|
264
|
-
pending_changes[:orphan_nodes] << node
|
265
|
-
end
|
266
270
|
end
|
267
271
|
|
268
272
|
logger.info { 'Done.' }
|
@@ -365,13 +369,13 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
365
369
|
|
366
370
|
# Cache users to cut down on excess SQL requests
|
367
371
|
def user_id_for_email(email)
|
368
|
-
return
|
372
|
+
return @default_user_id if email.blank?
|
369
373
|
@users ||= begin
|
370
374
|
User.select([:id, :email]).all.each_with_object({}) do |user, hash|
|
371
375
|
hash[user.email] = user.id
|
372
376
|
end
|
373
377
|
end
|
374
|
-
@users[email] ||
|
378
|
+
@users[email] || @default_user_id
|
375
379
|
end
|
376
380
|
|
377
381
|
def validate_and_save(instance)
|
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: 3.
|
4
|
+
version: 3.9.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: 2018-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.4.5
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Project export/upload for the Dradis Framework.
|