dradis-html_export 4.9.0 → 4.10.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 +12 -1
- data/app/controllers/dradis/plugins/html_export/{base_controller.rb → reports_controller.rb} +4 -3
- data/app/views/dradis/plugins/html_export/export/_index-content.html.erb +22 -21
- data/app/views/dradis/plugins/html_export/export/_index-tabs.html.erb +1 -1
- data/config/routes.rb +3 -1
- data/dradis-html_export.gemspec +7 -7
- data/lib/dradis/plugins/html_export/engine.rb +10 -2
- data/lib/dradis/plugins/html_export/exporter.rb +2 -0
- data/lib/dradis/plugins/html_export/gem_version.rb +2 -2
- data/spec/lib/dradis/plugins/html_export/exporter_spec.rb +43 -1
- data/templates/basic.html.erb +3 -3
- data/templates/default_dradis_template_v3.0.html.erb +4 -4
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27d99c716d170d2268e97a1b0889729ce6e653f4b8e9ab2cfb41c34527b2747a
|
4
|
+
data.tar.gz: ec40e7c9bbb6239f3058b2b8cc223b445290952fb1762b4ac74b22029dbc0391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7d68a975f8517af01b889567140163cdaa42b4a7ce786a3b68d06cc07f72310e8e8dac35b1cebe151a23e123f9c909065fd4e6db95d9eb9b8c0e2e56d2919aa
|
7
|
+
data.tar.gz: a8b48338691dbedcf04abb428fee667389c5a90ac0a015341c1c101581cd25260a09654715f3f757a0fa04ca79c0ba93c29eecde277da1d896d57a094657ee6b
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,20 @@
|
|
1
|
+
v4.10.0 (September 2023)
|
2
|
+
- Add support for enabling/disabling
|
3
|
+
- Prevent exporting reports without any HTML templates
|
4
|
+
- Fix the default templates
|
5
|
+
- Implement handling of HTML exports directly from Tylium
|
6
|
+
- Update views for compatibility with Font Awesome 6
|
7
|
+
- Update gemspec links
|
8
|
+
|
9
|
+
v4.9.1 (June 2023)
|
10
|
+
- Show HTML export tab by default in CE's export view
|
11
|
+
|
1
12
|
v4.9.0 (June 2023)
|
2
13
|
- Update views for compatibility with Bootstrap 5
|
3
14
|
|
4
15
|
v4.8.0 (April 2023)
|
5
16
|
- Add feature to select published/all records for export
|
6
|
-
|
17
|
+
|
7
18
|
v4.7.0 (February 2023)
|
8
19
|
- No changes
|
9
20
|
|
data/app/controllers/dradis/plugins/html_export/{base_controller.rb → reports_controller.rb}
RENAMED
@@ -1,13 +1,14 @@
|
|
1
1
|
module Dradis
|
2
2
|
module Plugins
|
3
3
|
module HtmlExport
|
4
|
-
class
|
4
|
+
class ReportsController < Dradis::Plugins::Export::BaseController
|
5
5
|
# This method cycles throw the notes in the reporting category and creates
|
6
6
|
# a simple HTML report with them.
|
7
7
|
#
|
8
8
|
# It uses the template at: ./vendor/plugins/html_export/template.html.erb
|
9
|
-
def
|
10
|
-
|
9
|
+
def create
|
10
|
+
options = export_params.merge(template: @template_file)
|
11
|
+
exporter = Dradis::Plugins::HtmlExport::Exporter.new(options)
|
11
12
|
html = exporter.export
|
12
13
|
|
13
14
|
render html: html.html_safe
|
@@ -1,24 +1,25 @@
|
|
1
|
-
<%= content_tag :div, id: 'plugin-html_export', class: 'tab-pane fade' do %>
|
2
|
-
|
3
|
-
<%=
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
</div>
|
1
|
+
<%= content_tag :div, id: 'plugin-html_export', class: class_names('tab-pane', 'fade', 'active show': !defined?(Dradis::Pro)) do %>
|
2
|
+
<% if Dradis::Plugins::HtmlExport::TemplatePresenter.templates.any? %>
|
3
|
+
<%= form_tag html_export.project_report_path(current_project) do %>
|
4
|
+
<h4 class="header-underline">Choose a template</h4>
|
5
|
+
<p>Please choose one of the templates available for this plugin (find them in <code>.<%= Dradis::Plugins::HtmlExport::TemplatePresenter.templates_dir[Rails.root.to_s.length..-1] %></code>)</p>
|
6
|
+
|
7
|
+
<% Dradis::Plugins::HtmlExport::TemplatePresenter.each_template do |template| %>
|
8
|
+
<% present(template, Dradis::Plugins::HtmlExport::TemplatePresenter) do |template_presenter| %>
|
9
|
+
<div class="form-check">
|
10
|
+
<%= radio_button_tag :template, template_presenter.filename, Dradis::Plugins::HtmlExport::TemplatePresenter.templates.first == template , class: 'form-check-input' %>
|
11
|
+
<label class="form-check-label" for="template_<%= template_presenter.filename %>">
|
12
|
+
<%= template_presenter.title %>
|
13
|
+
</label>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
17
16
|
<% end %>
|
18
|
-
<% end %>
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
<div class="mt-4">
|
19
|
+
<%= render partial: 'export/submit_button', locals: { plugin_name: Dradis::Plugins::HtmlExport::Engine.plugin_name } %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
<% else %>
|
23
|
+
<%= render partial: 'export/no_templates', locals: { plugin_name: Dradis::Plugins::HtmlExport::Engine.plugin_name } %>
|
23
24
|
<% end %>
|
24
|
-
<% end%>
|
25
|
+
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<li class='nav-item'>
|
2
|
-
<a href='#plugin-html_export' class='nav-link' data-bs-toggle='tab'>HTML</a>
|
2
|
+
<a href='#plugin-html_export' class="<%= class_names('nav-link', active: !defined?(Dradis::Pro)) %>" data-bs-toggle='tab'><i class="fa-solid fa-file-code fa-fw"></i>HTML</a>
|
3
3
|
</li>
|
data/config/routes.rb
CHANGED
data/dradis-html_export.gemspec
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
|
2
3
|
require File.expand_path('../lib/dradis/plugins/html_export/version', __FILE__)
|
3
4
|
version = Dradis::Plugins::HtmlExport::version
|
4
5
|
|
5
6
|
Gem::Specification.new do |spec|
|
6
7
|
spec.platform = Gem::Platform::RUBY
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'dradis-html_export'
|
8
9
|
spec.version = version
|
9
10
|
spec.required_ruby_version = '>= 1.9.3'
|
10
11
|
spec.license = 'GPL-2'
|
11
12
|
|
12
13
|
spec.authors = ['Daniel Martin']
|
13
|
-
spec.
|
14
|
-
spec.
|
15
|
-
spec.
|
16
|
-
spec.homepage = 'http://dradisframework.org'
|
14
|
+
spec.description = 'Export to HTML plugin for the Dradis Framework'
|
15
|
+
spec.summary = 'Dradis HTML export plugin'
|
16
|
+
spec.homepage = 'http://dradis.com'
|
17
17
|
|
18
18
|
spec.files = `git ls-files`.split($\)
|
19
|
-
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
-
spec.require_paths = [
|
21
|
+
spec.require_paths = ['lib']
|
22
22
|
|
23
23
|
# gem.add_dependency 'dradis_core', version
|
24
24
|
spec.add_dependency 'dradis-plugins', '>= 4.8.0'
|
@@ -18,13 +18,21 @@ module Dradis
|
|
18
18
|
provides :export, :rtp
|
19
19
|
description 'Generate advanced HTML reports'
|
20
20
|
|
21
|
+
addon_settings :html_export do
|
22
|
+
settings.default_enabled = false
|
23
|
+
end if defined?(Dradis::Pro)
|
24
|
+
|
21
25
|
initializer 'dradis-html_export.mount_engine' do
|
22
26
|
Rails.application.routes.append do
|
23
|
-
|
27
|
+
# Enabling/disabling integrations calls Rails.application.reload_routes! we need the enable
|
28
|
+
# check inside the block to ensure the routes can be re-enabled without a server restart
|
29
|
+
if Engine.enabled?
|
30
|
+
mount Engine => '/', as: :html_export
|
31
|
+
end
|
24
32
|
end
|
25
33
|
end
|
26
34
|
|
27
|
-
initializer '
|
35
|
+
initializer 'dradis-html_export.include_helper' do
|
28
36
|
ActiveSupport.on_load(:action_view) do
|
29
37
|
Dradis::Plugins::HtmlExport::Exporter.include(ApplicationHelper)
|
30
38
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
describe Dradis::Plugins::HtmlExport::Exporter do
|
4
|
+
before { Dradis::Plugins::HtmlExport::Exporter.include(ApplicationHelper) }
|
5
|
+
|
4
6
|
let!(:project) { create(:project, :with_team) }
|
5
7
|
|
6
8
|
let!(:content_blocks) { create_list(:content_block, 5, project: project) }
|
@@ -8,7 +10,7 @@ describe Dradis::Plugins::HtmlExport::Exporter do
|
|
8
10
|
let!(:nodes) { create_list(:node, 5, project: project) }
|
9
11
|
let!(:tags) { create_list(:tag, 5, project: project) }
|
10
12
|
|
11
|
-
let(:controller) { Dradis::Plugins::HtmlExport::
|
13
|
+
let(:controller) { Dradis::Plugins::HtmlExport::ExportController.new }
|
12
14
|
|
13
15
|
let(:exporter) { described_class.new(export_options) }
|
14
16
|
|
@@ -31,6 +33,46 @@ describe Dradis::Plugins::HtmlExport::Exporter do
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
36
|
+
context 'templates' do
|
37
|
+
describe 'basic template' do
|
38
|
+
let(:export_options) do
|
39
|
+
{
|
40
|
+
project_id: project.id,
|
41
|
+
template: Dradis::Plugins::HtmlExport::Engine.root.join(
|
42
|
+
'templates/basic.html.erb'
|
43
|
+
)
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'exports html' do
|
48
|
+
html = exporter.export
|
49
|
+
|
50
|
+
issues.each do |issue|
|
51
|
+
expect(html.include?(issue.title))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'default template' do
|
57
|
+
let(:export_options) do
|
58
|
+
{
|
59
|
+
project_id: project.id,
|
60
|
+
template: Dradis::Plugins::HtmlExport::Engine.root.join(
|
61
|
+
'templates/default_dradis_template_v3.0.html.erb'
|
62
|
+
)
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'exports html' do
|
67
|
+
html = exporter.export
|
68
|
+
|
69
|
+
issues.each do |issue|
|
70
|
+
expect(html.include?(issue.title))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
34
76
|
context 'liquid' do
|
35
77
|
let(:export_options) do
|
36
78
|
{
|
data/templates/basic.html.erb
CHANGED
@@ -26,14 +26,14 @@
|
|
26
26
|
<section>
|
27
27
|
<h2>Issues</h2>
|
28
28
|
<% issues.each do |issue| %>
|
29
|
-
<div class="note"><%= markup(issue.text) %></div>
|
29
|
+
<div class="note"><%= markup(issue.text, liquid: true) %></div>
|
30
30
|
<% end %>
|
31
31
|
</section>
|
32
32
|
|
33
33
|
<section>
|
34
|
-
<h2>Notes
|
34
|
+
<h2>Notes</h2>
|
35
35
|
<% notes.each do |note| %>
|
36
|
-
<div class="note"><%= markup(note.text) %></div>
|
36
|
+
<div class="note"><%= markup(note.text, liquid: true) %></div>
|
37
37
|
<% end %>
|
38
38
|
</section>
|
39
39
|
|
@@ -70,7 +70,7 @@
|
|
70
70
|
<% notes.each do |note| %>
|
71
71
|
<div class="panel panel-default">
|
72
72
|
<div class="panel-body">
|
73
|
-
<%= markup(note.text) %>
|
73
|
+
<%= markup(note.text, liquid: true) %>
|
74
74
|
</div>
|
75
75
|
</div>
|
76
76
|
<% end %>
|
@@ -81,7 +81,7 @@
|
|
81
81
|
<% issues.each do |issue| %>
|
82
82
|
<div class="panel panel-default">
|
83
83
|
<div class="panel-body">
|
84
|
-
<%= markup(issue.text) %>
|
84
|
+
<%= markup(issue.text, liquid: true) %>
|
85
85
|
|
86
86
|
<h3>Assets affected by this issue</h3>
|
87
87
|
<% if issue.affected.empty? %>
|
@@ -101,7 +101,7 @@
|
|
101
101
|
<section id="evidence_for_#{node.id}">
|
102
102
|
<% if instances.count == 1 %>
|
103
103
|
<div class="content-textile" id="node_<%= node.id %>_instance_0">
|
104
|
-
<%= markup(instances.first.content) %>
|
104
|
+
<%= markup(instances.first.content, liquid: true) %>
|
105
105
|
</div>
|
106
106
|
<% else %>
|
107
107
|
<ul class="nav nav-tabs">
|
@@ -113,7 +113,7 @@
|
|
113
113
|
<div class="tab-content">
|
114
114
|
<% instances.each_with_index do |evidence, i| %>
|
115
115
|
<div class="content-textile tab-pane<%= ' active' if i==0 %>" id="node_<%= node.id %>_instance_<%= i %>">
|
116
|
-
<%= markup(evidence.content) %>
|
116
|
+
<%= markup(evidence.content, liquid: true) %>
|
117
117
|
</div>
|
118
118
|
<% end %>
|
119
119
|
</div>
|
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: 4.
|
4
|
+
version: 4.10.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: 2023-
|
11
|
+
date: 2023-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dradis-plugins
|
@@ -53,8 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.3.2
|
55
55
|
description: Export to HTML plugin for the Dradis Framework
|
56
|
-
email:
|
57
|
-
- "<etd@nomejortu.com>"
|
56
|
+
email:
|
58
57
|
executables: []
|
59
58
|
extensions: []
|
60
59
|
extra_rdoc_files: []
|
@@ -69,7 +68,7 @@ files:
|
|
69
68
|
- Gemfile
|
70
69
|
- README.md
|
71
70
|
- Rakefile
|
72
|
-
- app/controllers/dradis/plugins/html_export/
|
71
|
+
- app/controllers/dradis/plugins/html_export/reports_controller.rb
|
73
72
|
- app/presenters/dradis/plugins/html_export/template_presenter.rb
|
74
73
|
- app/views/dradis/plugins/html_export/export/_index-content.html.erb
|
75
74
|
- app/views/dradis/plugins/html_export/export/_index-tabs.html.erb
|
@@ -90,7 +89,7 @@ files:
|
|
90
89
|
- spec/spec_helper.rb
|
91
90
|
- templates/basic.html.erb
|
92
91
|
- templates/default_dradis_template_v3.0.html.erb
|
93
|
-
homepage: http://
|
92
|
+
homepage: http://dradis.com
|
94
93
|
licenses:
|
95
94
|
- GPL-2
|
96
95
|
metadata: {}
|