dradis-html_export 4.0.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e30ca0b3eebbe1ddc727fd0b9f9197b25490f545913c9e666282f40508bd858
4
- data.tar.gz: 46ab64967389ecd8687c5dbba547ca78b1446bc97ff965f2851983e3ccc168b6
3
+ metadata.gz: d0d9fc4de71f006fa98925432abe6ebc106be1412f0d16199679b71b1ddd2cb4
4
+ data.tar.gz: b97d97b658c813c94cfc62397bade68f4e5f466386768f1f6410f8819334fadd
5
5
  SHA512:
6
- metadata.gz: ff0405750e4525d3e9b2cfcaf434dabff1df3d3523fc398e2eaaf7764007e0b0b51c3c8a789e57bebb2f232e660e9ae3dad772985c3efe73ea0a5f8913bdafff
7
- data.tar.gz: d52abe89584e52491e3edee462d788ec7d52e14ff38657c1553b624902fe9435882dbba99d4ff2a9909d639a5f9fd76b5dbe758746f752f23c5dcb85df954b7b
6
+ metadata.gz: 0d42f27e5cbce3ca6087b213fdb3a47bf01193cdc87d2cee2d85781ab2d9a17866181c57f352c741127bc95605e6c787658760c9fcc44600ceb8cee6322dcf0c
7
+ data.tar.gz: 30807f3bda9b6c23aa8023df4446404b3701e4290160766601ede9cfc5df92402b59a4d6f6335bb8e61d12f06c2b6c87d99ce8aca6062087b90a5ba0835af55d
data/CHANGELOG.md CHANGED
@@ -1,75 +1,70 @@
1
- ## Dradis Framework 4.0.0 (July, 2021) ##
1
+ v4.3.0 (April 2022)
2
+ - Add the RTP report title on export page in DradisPro
2
3
 
3
- * No changes.
4
+ v4.2.0 (February 2022)
5
+ - No changes
4
6
 
5
- ## Dradis Framework 3.22 (April, 2021) ##
7
+ v4.1.1 (November 2021)
8
+ - Loosen dradis-plugins version requirement
6
9
 
7
- * No changes.
10
+ v4.1.0 (November 2021)
11
+ - No changes
8
12
 
9
- ## Dradis Framework 3.21 (February, 2021) ##
13
+ v4.0.0 (July 2021)
14
+ - No changes
10
15
 
11
- * Add a fix for Rails 6 not allowing HTML rendering outside the view directory.
16
+ v3.22.0 (April 2021)
17
+ - No changes
12
18
 
13
- ## Dradis Framework 3.20 (December, 2020) ##
19
+ v3.21.0 (February 2021)
20
+ - Add a fix for Rails 6 not allowing HTML rendering outside the view directory
14
21
 
15
- * Add an option in the exporter to pass a controller for rendering.
16
- * Add views for the export view.
17
- * Use NamingService to build export filename.
22
+ v3.20.0 (December 2020)
23
+ - Add an option in the exporter to pass a controller for rendering
24
+ - Add views for the export view
25
+ - Use NamingService to build export filename
18
26
 
19
- ## Dradis Framework 3.19 (September, 2020) ##
27
+ v3.19.0 (September 2020)
28
+ - No changes
20
29
 
21
- * No changes.
30
+ v3.18.0 (July 2020)
31
+ - No changes
22
32
 
23
- ## Dradis Framework 3.18 (July, 2020) ##
33
+ v3.17.0 (May 2020)
34
+ - Render report using main app's ApplicationController#render
24
35
 
25
- * No changes.
36
+ v3.16.0 (February 2020)
37
+ - No changes
26
38
 
27
- ## Dradis Framework 3.17 (May, 2020) ##
39
+ v3.15.0 (November 2019)
40
+ - No changes
28
41
 
29
- * Render report using main app's ApplicationController#render.
42
+ v3.14.0 (August 2019)
43
+ - No changes
30
44
 
31
- ## Dradis Framework 3.16 (February, 2020) ##
45
+ v3.13.0 (June 2019)
46
+ - No changes
32
47
 
33
- * No changes.
48
+ v3.12.0 (March 2019)
49
+ - No changes
34
50
 
35
- ## Dradis Framework 3.15 (November, 2019) ##
51
+ v3.11.0 (November 2018)
52
+ - No changes
36
53
 
37
- * No changes.
54
+ v3.10.0 (August 2018)
55
+ - Upgraded gems:
56
+ - RedCloth
57
+ - Bugs fixes:
58
+ - issue sorting
38
59
 
60
+ v3.9.0 (January 2018)
61
+ - Updated rendering html as in Rails 5.1 (`render html:`)
39
62
 
40
- ## Dradis Framework 3.14 (August, 2019) ##
63
+ v3.8.0 (September 2017)
64
+ - No changes
41
65
 
42
- * No changes.
66
+ v3.7.0 (July 2017)
67
+ - No changes
43
68
 
44
- ## Dradis Framework 3.13 (June, 2019) ##
45
-
46
- * No changes.
47
-
48
- ## Dradis Framework 3.12 (March, 2019) ##
49
-
50
- * No changes.
51
-
52
- ## Dradis Framework 3.11 (November, 2018) ##
53
-
54
- * No changes.
55
-
56
- ## Dradis Framework 3.10 (August, 2018) ##
57
-
58
- * Security fix: update RedCloth to 4.3.2
59
- * Fix issue sorting
60
-
61
- ## Dradis Framework 3.9 (January, 2018) ##
62
-
63
- * Updated rendering html as in Rails 5.1 (`render html:`)
64
-
65
- ## Dradis Framework 3.8 (September, 2017) ##
66
-
67
- * No changes.
68
-
69
- ## Dradis Framework 3.7 (July, 2017) ##
70
-
71
- * No changes.
72
-
73
- ## Dradis Framework 3.6 (March, 2017) ##
74
-
75
- * No changes.
69
+ v3.6.0 (March 2017)
70
+ - No changes
@@ -0,0 +1,12 @@
1
+ [v#.#.#] ([month] [YYYY])
2
+ - [future tense verb] [feature]
3
+ - Upgraded gems:
4
+ - [gem]
5
+ - Bugs fixes:
6
+ - [future tense verb] [bug fix]
7
+ - Bug tracker items:
8
+ - [item]
9
+ - Security Fixes:
10
+ - High: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
11
+ - Medium: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
12
+ - Low: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
@@ -0,0 +1,38 @@
1
+ module Dradis
2
+ module Plugins
3
+ module HtmlExport
4
+ class TemplatePresenter < BasePresenter
5
+ presents :template
6
+
7
+ def self.each_template(&block)
8
+ templates.each(&block)
9
+ end
10
+
11
+ def self.templates
12
+ if defined?(Dradis::Pro)
13
+ ReportTemplateProperties.all.where(plugin_name: :html_export).order(:title)
14
+ else
15
+ Dir["%s/*" % templates_dir].map { |t| File.basename(t) }.sort
16
+ end
17
+ end
18
+
19
+ def self.templates_dir
20
+ File.join(::Configuration::paths_templates_reports, 'html_export')
21
+ end
22
+
23
+ def title
24
+ return template if template.is_a?(String)
25
+
26
+ content_tag(:span, "#{template.title} - ") +
27
+ content_tag(:small, template.template_file)
28
+ end
29
+
30
+ def filename
31
+ return template if template.is_a?(String)
32
+
33
+ template.template_file
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,21 +1,20 @@
1
- <%
2
- templates_dir = File.join(::Configuration::paths_templates_reports, 'html_export')
3
- templates = Dir["%s/*" % templates_dir].map { |t| File.basename(t) }.sort
4
- %>
5
-
6
1
  <%= content_tag :div, id: 'plugin-html_export', class: 'tab-pane fade' do %>
7
2
  <%= form_tag project_export_manager_path(current_project), target: '_blank' do %>
8
3
  <%= hidden_field_tag :plugin, :html_export %>
9
4
  <%= hidden_field_tag :route, :root %>
10
5
 
11
6
  <h4 class="header-underline">Choose a template</h4>
12
- <p>Please choose one of the templates available for this plugin (find them in <code>.<%= templates_dir[Rails.root.to_s.length..-1] %></code>)</p>
7
+ <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>
13
8
 
14
- <% templates.each do |template| %>
15
- <div class="custom-control custom-radio">
16
- <%= radio_button_tag :template, template, template == templates.first, :class => 'custom-control-input' %>
17
- <label class="custom-control-label" for="template_<%= template %>"><%= template %></label>
18
- </div>
9
+ <% Dradis::Plugins::HtmlExport::TemplatePresenter.each_template do |template| %>
10
+ <% present(template, Dradis::Plugins::HtmlExport::TemplatePresenter) do |template_presenter| %>
11
+ <div class="custom-control custom-radio">
12
+ <%= radio_button_tag :template, template_presenter.filename, Dradis::Plugins::HtmlExport::TemplatePresenter.templates.first == template , class: 'custom-control-input' %>
13
+ <label class="custom-control-label" for="template_<%= template_presenter.filename %>">
14
+ <%= template_presenter.title %>
15
+ </label>
16
+ </div>
17
+ <% end %>
19
18
  <% end %>
20
19
 
21
20
  <button id="export-button" class="btn btn-lg btn-primary mt-4">Export</button>
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  # gem.add_dependency 'dradis_core', version
24
- spec.add_dependency 'dradis-plugins', '~> 4.0.0'
24
+ spec.add_dependency 'dradis-plugins', '~> 4.0'
25
25
 
26
26
  # Note markup
27
27
  spec.add_dependency 'rails_autolink', '~> 1.1'
@@ -8,7 +8,7 @@ module Dradis
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 4
11
- MINOR = 0
11
+ MINOR = 3
12
12
  TINY = 0
13
13
  PRE = nil
14
14
 
@@ -0,0 +1,47 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Dradis::Plugins::HtmlExport::TemplatePresenter do
4
+ class FakeView
5
+ include ActionView::Helpers::TextHelper
6
+ end
7
+
8
+ let(:template_presenter) { described_class.new(template, FakeView.new) }
9
+
10
+ describe '#title' do
11
+ context 'when template is a string' do
12
+ let(:template) { 'basic.html.erb' }
13
+
14
+ it 'returns the string' do
15
+ expect(template_presenter.title).to eq template
16
+ end
17
+ end
18
+
19
+ context 'when template is a RTP' do
20
+ let(:template) do
21
+ double(
22
+ 'ReportTemplateProperties',
23
+ title: 'Basic',
24
+ template_file: 'basic.html.erb'
25
+ )
26
+ end
27
+
28
+ it 'returns a formatted title' do
29
+ expect(template_presenter.title).to eq "<span>#{template.title} - </span><small>#{template.template_file}</small>"
30
+ end
31
+
32
+ context 'when title contains javascript' do
33
+ let(:template) do
34
+ double(
35
+ 'ReportTemplateProperties',
36
+ title: '<script>alert("hello world")</script>',
37
+ template_file: 'basic.html.erb'
38
+ )
39
+ end
40
+
41
+ it 'prevents cross site scriptiing' do
42
+ expect(template_presenter.title).to eq "<span>&lt;script&gt;alert(&quot;hello world&quot;)&lt;/script&gt; - </span><small>#{template.template_file}</small>"
43
+ end
44
+ end
45
+ end
46
+ end
47
+ 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: 4.0.0
4
+ version: 4.3.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: 2021-08-03 00:00:00.000000000 Z
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dradis-plugins
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails_autolink
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -63,13 +63,14 @@ files:
63
63
  - ".github/pull_request_template.md"
64
64
  - ".gitignore"
65
65
  - ".rspec"
66
- - ".travis.yml"
67
66
  - CHANGELOG.md
67
+ - CHANGELOG.template
68
68
  - CONTRIBUTING.md
69
69
  - Gemfile
70
70
  - README.md
71
71
  - Rakefile
72
72
  - app/controllers/dradis/plugins/html_export/base_controller.rb
73
+ - app/presenters/dradis/plugins/html_export/template_presenter.rb
73
74
  - app/views/dradis/plugins/html_export/export/_index-content.html.erb
74
75
  - app/views/dradis/plugins/html_export/export/_index-tabs.html.erb
75
76
  - config/routes.rb
@@ -83,6 +84,7 @@ files:
83
84
  - lib/tasks/thorfile.rb
84
85
  - spec/fixtures/files/template.html.erb
85
86
  - spec/lib/dradis/plugins/html_export/exporter_spec.rb
87
+ - spec/presenters/dradis/plugins/html_export/template_presenter_spec.rb
86
88
  - spec/requests/html_export_spec.rb
87
89
  - spec/spec_helper.rb
88
90
  - templates/basic.html.erb
@@ -113,5 +115,6 @@ summary: Dradis HTML export plugin
113
115
  test_files:
114
116
  - spec/fixtures/files/template.html.erb
115
117
  - spec/lib/dradis/plugins/html_export/exporter_spec.rb
118
+ - spec/presenters/dradis/plugins/html_export/template_presenter_spec.rb
116
119
  - spec/requests/html_export_spec.rb
117
120
  - spec/spec_helper.rb
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- rvm:
2
- - 1.9.3
3
- notifications:
4
- irc:
5
- on_success: change
6
- on_failure: always
7
- channels:
8
- - "irc.freenode.org#dradis"
9
-
10
- bundler_args: --path vendor/bundle
11
- script: "bundle exec rake spec"