dradis-projects 3.16.0 → 3.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +24 -3
- data/app/views/dradis/plugins/projects/export/_index-content.html.erb +19 -0
- data/app/views/dradis/plugins/projects/export/_index-tabs.html.erb +3 -0
- data/lib/dradis/plugins/projects.rb +5 -3
- data/lib/dradis/plugins/projects/export/v2/template.rb +1 -1
- data/lib/dradis/plugins/projects/gem_version.rb +1 -1
- data/lib/dradis/plugins/projects/upload/v1/template.rb +6 -4
- data/lib/dradis/plugins/projects/upload/v2/template.rb +6 -3
- data/spec/fixtures/files/with_comments.xml +1 -1
- data/spec/lib/dradis/plugins/projects/export/v2/template_spec.rb +17 -5
- data/spec/lib/dradis/plugins/projects/upload/v2/template_spec.rb +12 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d19a3cf6f2164c69c08fd2fa151849338f50cd2756c85a004caee2b304a34019
|
4
|
+
data.tar.gz: ae3b507fa0d58612cdd148237e2bf5d3d61430ce83e6e4ae43efa40cc21c64d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab39dd0a946b71c978443de7f921c30edcba47e4485459247b4cd4565998066fd53b5511747e0723faf4773aebe5ee37e9ec4c5b632aa47d35c04d08e37c8f23
|
7
|
+
data.tar.gz: 4e6527f380b9baaf70d974eb6b54ced56e471d02874a77ca6b23a6c0a5b6f9fa3cb44ac56bbd5b0be00cc24189a279c7601014cf9ec2637fe0a3f6979be7fd09
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
## Dradis Framework 3.21 (February, 2021) ##
|
2
|
+
|
3
|
+
* No changes
|
4
|
+
|
5
|
+
## Dradis Framework 3.20 (Jan, 2020) ##
|
6
|
+
|
7
|
+
* Add views for the export view.
|
8
|
+
* Fix exporting projects with comments by deleted users.
|
9
|
+
|
10
|
+
## Dradis Framework 3.19 (September, 2020) ##
|
11
|
+
|
12
|
+
* No changes
|
13
|
+
|
14
|
+
## Dradis Framework 3.18 (July, 2020) ##
|
15
|
+
|
16
|
+
* No changes
|
17
|
+
|
18
|
+
## Dradis Framework 3.17 (May, 2020) ##
|
19
|
+
|
20
|
+
* No changes
|
21
|
+
|
1
22
|
## Dradis Framework 3.16 (February, 2020) ##
|
2
23
|
|
3
24
|
* No changes
|
@@ -39,19 +60,19 @@
|
|
39
60
|
|
40
61
|
## Dradis Framework 3.9 (January, 2018) ##
|
41
62
|
|
42
|
-
* Fix nodes upload
|
63
|
+
* Fix nodes upload
|
43
64
|
|
44
65
|
* Add default user id as fallback for activity user when importing
|
45
66
|
|
46
67
|
## Dradis Framework 3.8 (September, 2017) ##
|
47
68
|
|
48
|
-
* Add version attribute to exported methodologies
|
69
|
+
* Add version attribute to exported methodologies
|
49
70
|
|
50
71
|
* Add parse_report_content placeholders to import/export.
|
51
72
|
|
52
73
|
## Dradis Framework 3.7 (July, 2017) ##
|
53
74
|
|
54
|
-
* Skip closing the logger in thorfile
|
75
|
+
* Skip closing the logger in thorfile
|
55
76
|
|
56
77
|
## Dradis Framework 3.6 (March, 2017) ##
|
57
78
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= content_tag :div, id: 'plugin-projects', class: 'tab-pane fade' do %>
|
2
|
+
<%= form_tag project_export_manager_path(current_project), target: '_blank' do %>
|
3
|
+
<%= hidden_field_tag :plugin, 'projects' %>
|
4
|
+
|
5
|
+
<h4 class="header-underline">Choose an export option</h4>
|
6
|
+
|
7
|
+
<div class="custom-control custom-radio">
|
8
|
+
<%= radio_button_tag :route, :package, true, :class => 'custom-control-input' %>
|
9
|
+
<label class="custom-control-label" for='route_package'>Package</label>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="custom-control custom-radio">
|
13
|
+
<%= radio_button_tag :route, :template, false, :class => 'custom-control-input' %>
|
14
|
+
<label class="custom-control-label" for='route_template'>Template</label>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<button id="export-button" class="btn btn-lg btn-primary mt-4">Export</button>
|
18
|
+
<% end %>
|
19
|
+
<% end%>
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Dradis
|
2
2
|
module Plugins
|
3
3
|
module Projects
|
4
|
-
module Export
|
5
|
-
|
4
|
+
module Export
|
5
|
+
end
|
6
|
+
module Upload
|
7
|
+
end
|
6
8
|
end
|
7
9
|
end
|
8
10
|
end
|
@@ -16,4 +18,4 @@ require 'dradis/plugins/projects/version'
|
|
16
18
|
|
17
19
|
module Dradis::Plugins::Projects
|
18
20
|
ActiveSupport.run_load_hooks(:dradis_projects, self)
|
19
|
-
end
|
21
|
+
end
|
@@ -11,7 +11,7 @@ module Dradis::Plugins::Projects::Export::V2
|
|
11
11
|
comment_builder.content do
|
12
12
|
comment_builder.cdata!(comment.content)
|
13
13
|
end
|
14
|
-
comment_builder.author(comment.user
|
14
|
+
comment_builder.author(comment.user&.email)
|
15
15
|
comment_builder.created_at(comment.created_at.to_i)
|
16
16
|
end
|
17
17
|
end
|
@@ -3,7 +3,7 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
3
3
|
|
4
4
|
class Importer < Dradis::Plugins::Projects::Upload::Template::Importer
|
5
5
|
|
6
|
-
attr_accessor :attachment_notes, :logger, :pending_changes
|
6
|
+
attr_accessor :attachment_notes, :logger, :pending_changes, :users
|
7
7
|
|
8
8
|
ATTACHMENT_URL = %r{^!(/[a-z]+)?/(?:projects/\d+/)?nodes/(\d+)/attachments/(.+)!$}
|
9
9
|
|
@@ -394,15 +394,17 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
394
394
|
end
|
395
395
|
end
|
396
396
|
|
397
|
-
# Cache users to cut down on excess SQL requests
|
398
397
|
def user_id_for_email(email)
|
399
|
-
|
398
|
+
users[email] || @default_user_id
|
399
|
+
end
|
400
|
+
|
401
|
+
# Cache users to cut down on excess SQL requests
|
402
|
+
def users
|
400
403
|
@users ||= begin
|
401
404
|
User.select([:id, :email]).all.each_with_object({}) do |user, hash|
|
402
405
|
hash[user.email] = user.id
|
403
406
|
end
|
404
407
|
end
|
405
|
-
@users[email] || @default_user_id
|
406
408
|
end
|
407
409
|
|
408
410
|
def validate_and_save(instance)
|
@@ -13,16 +13,19 @@ module Dradis::Plugins::Projects::Upload::V2
|
|
13
13
|
commentable_type: commentable.class.to_s,
|
14
14
|
content: xml_comment.at_xpath('content').text,
|
15
15
|
created_at: Time.at(xml_comment.at_xpath('created_at').text.to_i),
|
16
|
-
user_id:
|
16
|
+
user_id: users[author_email]
|
17
17
|
)
|
18
18
|
|
19
|
-
if comment.user.
|
19
|
+
if comment.user.nil?
|
20
20
|
comment.content = comment.content +
|
21
21
|
"\n\nOriginal author not available in this Dradis instance: "\
|
22
22
|
"#{author_email}."
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
unless validate_and_save(comment)
|
26
|
+
logger.info { "comment errors: #{comment.inspect}" }
|
27
|
+
return false
|
28
|
+
end
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
@@ -13,13 +13,13 @@ describe Dradis::Plugins::Projects::Export::V2::Template do
|
|
13
13
|
|
14
14
|
context 'exporting a project' do
|
15
15
|
before do
|
16
|
-
node = create(:node, project: project)
|
17
|
-
issue = create(:issue, text: 'Issue 1', node: project.issue_library)
|
16
|
+
@node = create(:node, project: project)
|
17
|
+
@issue = create(:issue, text: 'Issue 1', node: project.issue_library)
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'with comments in an issue' do
|
21
21
|
before do
|
22
|
-
create(:comment, content: 'A comment on an issue', commentable: issue)
|
22
|
+
create(:comment, content: 'A comment on an issue', commentable: @issue)
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'exports comments in the issue' do
|
@@ -29,7 +29,7 @@ describe Dradis::Plugins::Projects::Export::V2::Template do
|
|
29
29
|
|
30
30
|
context 'with comments in a note' do
|
31
31
|
before do
|
32
|
-
note = create(:note, text: 'Note 1', node: node)
|
32
|
+
note = create(:note, text: 'Note 1', node: @node)
|
33
33
|
create(:comment, content: 'A comment on a note', commentable: note)
|
34
34
|
end
|
35
35
|
|
@@ -40,7 +40,7 @@ describe Dradis::Plugins::Projects::Export::V2::Template do
|
|
40
40
|
|
41
41
|
context 'with comments in an evidence' do
|
42
42
|
before do
|
43
|
-
evidence = create(:evidence,
|
43
|
+
evidence = create(:evidence, content: 'Test evidence', node: @node, issue: @issue)
|
44
44
|
create(:comment, content: 'A comment on an evidence', commentable: evidence)
|
45
45
|
end
|
46
46
|
|
@@ -48,5 +48,17 @@ describe Dradis::Plugins::Projects::Export::V2::Template do
|
|
48
48
|
expect(export).to include('A comment on an evidence')
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
context 'with comments with a deleted author' do
|
53
|
+
before do
|
54
|
+
note = create(:note, text: 'Note 1', node: @node)
|
55
|
+
comment = create(:comment, content: 'Deleted user', commentable: note)
|
56
|
+
comment.update_attribute :user, nil
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'exports the comment without errors' do
|
60
|
+
expect(export).to include('Deleted user')
|
61
|
+
end
|
62
|
+
end
|
51
63
|
end
|
52
64
|
end
|
@@ -41,5 +41,17 @@ describe Dradis::Plugins::Projects::Upload::V2::Template::Importer do
|
|
41
41
|
evidence = node.evidence.first
|
42
42
|
expect(evidence.comments.first.content).to include('A comment on an evidence')
|
43
43
|
end
|
44
|
+
|
45
|
+
it 'imports comments without user' do
|
46
|
+
issue = project.issues.first
|
47
|
+
note = node.notes.first
|
48
|
+
evidence = node.evidence.first
|
49
|
+
|
50
|
+
aggregate_failures do
|
51
|
+
expect(issue.comments.first.user).to be_nil
|
52
|
+
expect(note.comments.first.user).to be_nil
|
53
|
+
expect(evidence.comments.first.user).to be_nil
|
54
|
+
end
|
55
|
+
end
|
44
56
|
end
|
45
57
|
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: 3.
|
4
|
+
version: 3.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Martin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,6 +112,8 @@ files:
|
|
112
112
|
- Rakefile
|
113
113
|
- app/controllers/dradis/plugins/projects/packages_controller.rb
|
114
114
|
- app/controllers/dradis/plugins/projects/templates_controller.rb
|
115
|
+
- app/views/dradis/plugins/projects/export/_index-content.html.erb
|
116
|
+
- app/views/dradis/plugins/projects/export/_index-tabs.html.erb
|
115
117
|
- config/routes.rb
|
116
118
|
- dradis-projects.gemspec
|
117
119
|
- lib/dradis-projects.rb
|
@@ -139,7 +141,7 @@ homepage: http://dradisframework.org
|
|
139
141
|
licenses:
|
140
142
|
- GPL-2
|
141
143
|
metadata: {}
|
142
|
-
post_install_message:
|
144
|
+
post_install_message:
|
143
145
|
rdoc_options: []
|
144
146
|
require_paths:
|
145
147
|
- lib
|
@@ -154,8 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
156
|
- !ruby/object:Gem::Version
|
155
157
|
version: '0'
|
156
158
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
158
|
-
signing_key:
|
159
|
+
rubygems_version: 3.2.4
|
160
|
+
signing_key:
|
159
161
|
specification_version: 4
|
160
162
|
summary: Project export/upload for the Dradis Framework.
|
161
163
|
test_files:
|