dradis-html_export 3.13.0 → 3.18.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 +5 -5
- data/.github/issue_template.md +16 -0
- data/.github/pull_request_template.md +36 -0
- data/CHANGELOG.md +21 -0
- data/lib/dradis/plugins/html_export/exporter.rb +72 -53
- data/lib/dradis/plugins/html_export/gem_version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 44a40f1bc271b8211123ed58ea69212e1bc4c8837da97d76194ebaa1485f29be
|
|
4
|
+
data.tar.gz: f58b4edfa716c6c77b3a7e264684777705cc46da2cf87f9bb02eb660ee6fa70e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e39c16ea0cdd301e70c106bc815372ff53fb8de163f6d6a5278869532988b6cb50ec6c0ad18f63786f5b6fc4655f1cbb008c1d75dd0f87e2d63cf4304c18d3a
|
|
7
|
+
data.tar.gz: 45a5b725f445b9849d2844124bbdc16604e77169e198eaed1c7e2b29cbb82119246c0026796c7e5091a0d129de4f8f6eccdff605ef21662f8676a591a9527b9d
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
### Steps to reproduce
|
|
2
|
+
|
|
3
|
+
Help us help you, how can we reproduce the problem?
|
|
4
|
+
|
|
5
|
+
### Expected behavior
|
|
6
|
+
Tell us what should happen
|
|
7
|
+
|
|
8
|
+
### Actual behavior
|
|
9
|
+
Tell us what happens instead
|
|
10
|
+
|
|
11
|
+
### System configuration
|
|
12
|
+
**Dradis version**:
|
|
13
|
+
|
|
14
|
+
**Ruby version**:
|
|
15
|
+
|
|
16
|
+
**OS version**:
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
### Summary
|
|
2
|
+
|
|
3
|
+
Provide a general description of the code changes in your pull
|
|
4
|
+
request... were there any bugs you had fixed? If so, mention them. If
|
|
5
|
+
these bugs have open GitHub issues, be sure to tag them here as well,
|
|
6
|
+
to keep the conversation linked together.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Other Information
|
|
10
|
+
|
|
11
|
+
If there's anything else that's important and relevant to your pull
|
|
12
|
+
request, mention that information here. This could include
|
|
13
|
+
benchmarks, or other information.
|
|
14
|
+
|
|
15
|
+
Thanks for contributing to Dradis!
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Copyright assignment
|
|
19
|
+
|
|
20
|
+
Collaboration is difficult with commercial closed source but we want
|
|
21
|
+
to keep as much of the OSS ethos as possible available to users
|
|
22
|
+
who want to fix it themselves.
|
|
23
|
+
|
|
24
|
+
In order to unambiguously own and sell Dradis Framework commercial
|
|
25
|
+
products, we must have the copyright associated with the entire
|
|
26
|
+
codebase. Any code you create which is merged must be owned by us.
|
|
27
|
+
That's not us trying to be a jerks, that's just the way it works.
|
|
28
|
+
|
|
29
|
+
Please review the [CONTRIBUTING.md](https://github.com/dradis/dradis-ce/blob/master/CONTRIBUTING.md)
|
|
30
|
+
file for the details.
|
|
31
|
+
|
|
32
|
+
You can delete this section, but the following sentence needs to
|
|
33
|
+
remain in the PR's description:
|
|
34
|
+
|
|
35
|
+
> I assign all rights, including copyright, to any future Dradis
|
|
36
|
+
> work by myself to Security Roots.
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## Dradis Framework 3.18 (July, 2020) ##
|
|
2
|
+
|
|
3
|
+
* No changes.
|
|
4
|
+
|
|
5
|
+
## Dradis Framework 3.17 (May, 2020) ##
|
|
6
|
+
|
|
7
|
+
* Render report using main app's ApplicationController#render.
|
|
8
|
+
|
|
9
|
+
## Dradis Framework 3.16 (February, 2020) ##
|
|
10
|
+
|
|
11
|
+
* No changes.
|
|
12
|
+
|
|
13
|
+
## Dradis Framework 3.15 (November, 2019) ##
|
|
14
|
+
|
|
15
|
+
* No changes.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Dradis Framework 3.14 (August, 2019) ##
|
|
19
|
+
|
|
20
|
+
* No changes.
|
|
21
|
+
|
|
1
22
|
## Dradis Framework 3.13 (June, 2019) ##
|
|
2
23
|
|
|
3
24
|
* No changes.
|
|
@@ -3,75 +3,94 @@ module Dradis
|
|
|
3
3
|
module HtmlExport
|
|
4
4
|
|
|
5
5
|
class Exporter < Dradis::Plugins::Export::Base
|
|
6
|
-
# Add auto_link support to the ERB processor (see rails_autolink)
|
|
7
|
-
include ::ActionView::Helpers::TextHelper
|
|
8
|
-
# For auto_link feature (requires #mail_to)
|
|
9
|
-
include ::ActionView::Helpers::UrlHelper
|
|
10
6
|
|
|
11
7
|
def export(args = {})
|
|
12
|
-
|
|
13
|
-
template_properties = ::ReportTemplateProperties.find_by_template_file(File.basename(template_path)) rescue nil
|
|
8
|
+
log_report
|
|
14
9
|
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
sort_by = template_properties.sort_field
|
|
10
|
+
# Render template
|
|
11
|
+
ApplicationController.render(
|
|
12
|
+
file: options.fetch(:template),
|
|
13
|
+
layout: false,
|
|
14
|
+
locals: {
|
|
15
|
+
categorized_issues: categorized_issues,
|
|
16
|
+
content_service: content_service,
|
|
17
|
+
issues: issues,
|
|
18
|
+
nodes: nodes,
|
|
19
|
+
notes: notes,
|
|
20
|
+
project: project,
|
|
21
|
+
reporting_cat: content_service.report_category,
|
|
22
|
+
tags: tags,
|
|
23
|
+
title: title,
|
|
24
|
+
user: options[:user]
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
end
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
private
|
|
30
|
+
def log_report
|
|
31
|
+
logger.debug { "Report title: #{title}" }
|
|
32
|
+
logger.debug { "Template properties define a sort field: #{sort_field}" }
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
if issues&.any?
|
|
35
|
+
logger.debug { "Found #{issues.count} issues affecting #{nodes.count} nodes" }
|
|
36
|
+
else
|
|
37
|
+
logger.warn { 'No issue library node found in this project' }
|
|
38
|
+
end
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
logger.debug { "Found #{notes.count} notes assigned to the reporting category." }
|
|
41
|
+
end
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
def nodes
|
|
44
|
+
# FIXME: This is an ugly piece of code and the list of nodes should
|
|
45
|
+
# come from the ContentService.
|
|
46
|
+
@nodes ||= issues.map(&:evidence).flatten.map(&:node).uniq
|
|
47
|
+
end
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
end
|
|
49
|
+
def notes
|
|
50
|
+
@notes ||= content_service.all_notes
|
|
51
|
+
end
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
erb.result( binding )
|
|
53
|
+
def issues
|
|
54
|
+
@issues ||= sort_issues content_service.all_issues.includes(:tags)
|
|
57
55
|
end
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
def categorized_issues
|
|
58
|
+
@categorized_issues ||= tags
|
|
59
|
+
.each_with_object({}) do |tag, hash|
|
|
60
|
+
hash[tag.id] = issues.select { |issue| issue.tags.include?(tag) }
|
|
61
|
+
end
|
|
62
|
+
.tap do |hash|
|
|
63
|
+
hash[:untagged] = issues.select { |issue| issue.tags.empty? }
|
|
64
|
+
end
|
|
65
|
+
end
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
def sort_field
|
|
68
|
+
@sort_field ||= begin
|
|
69
|
+
template_path = options.fetch(:template)
|
|
70
|
+
properties = ::ReportTemplateProperties.find_by_template_file(File.basename(template_path)) rescue nil
|
|
71
|
+
properties&.sort_field
|
|
72
|
+
end
|
|
73
|
+
end
|
|
65
74
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
output = ERB::Util.html_escape(text.dup)
|
|
75
|
+
def sort_issues(unsorted_issues)
|
|
76
|
+
return unsorted_issues unless unsorted_issues.any? && sort_field
|
|
69
77
|
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
# FIXME: Assume the Field :type is :number, so cast .to_f and sort
|
|
79
|
+
unsorted_issues.sort do |a, b|
|
|
80
|
+
b.fields.fetch(sort_field, '0').to_f <=> a.fields.fetch(sort_field, '0').to_f
|
|
72
81
|
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def tags
|
|
85
|
+
@tags ||= project.tags
|
|
86
|
+
end
|
|
73
87
|
|
|
74
|
-
|
|
88
|
+
def title
|
|
89
|
+
@title ||= if Dradis.constants.include?(:Pro)
|
|
90
|
+
"Dradis Professional Edition v#{Dradis::Pro.version}"
|
|
91
|
+
else
|
|
92
|
+
"Dradis Community Edition v#{Dradis::CE.version}"
|
|
93
|
+
end
|
|
75
94
|
end
|
|
76
95
|
end
|
|
77
96
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dradis-html_export
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.18.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: 2020-07-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dradis-plugins
|
|
@@ -59,6 +59,8 @@ executables: []
|
|
|
59
59
|
extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
|
61
61
|
files:
|
|
62
|
+
- ".github/issue_template.md"
|
|
63
|
+
- ".github/pull_request_template.md"
|
|
62
64
|
- ".gitignore"
|
|
63
65
|
- ".rspec"
|
|
64
66
|
- ".travis.yml"
|
|
@@ -100,8 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
100
102
|
- !ruby/object:Gem::Version
|
|
101
103
|
version: '0'
|
|
102
104
|
requirements: []
|
|
103
|
-
|
|
104
|
-
rubygems_version: 2.6.12
|
|
105
|
+
rubygems_version: 3.1.2
|
|
105
106
|
signing_key:
|
|
106
107
|
specification_version: 4
|
|
107
108
|
summary: Dradis HTML export plugin
|