dradis-plugins 4.16.0 → 4.17.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/app/controllers/concerns/dradis/plugins/exportable.rb +50 -0
- data/app/controllers/concerns/dradis/plugins/persistent_permissions.rb +1 -1
- data/app/controllers/dradis/plugins/export/base_controller.rb +5 -25
- data/lib/dradis/plugins/gem_version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab80c138e39b3703d4f65fe3406c9aa876f2588b3bdbaa2f44a1f0fd7cae0e4b
|
4
|
+
data.tar.gz: 4a4ce3dc4c10a0ec9fb7d7206bbea7fe68c0775a34242657f578e15804922a77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9555248bb5697d70bcda15e6d7bc5e80281c611efe18a29b4dc3d75cf1f1afb09f369014a3eebce0afea2fc7246c02bad48e58bfd2cb01d3527bc508ebebaf5
|
7
|
+
data.tar.gz: 69d1ccd744a4af22b92e98eba0bff5b9a9d0b2bb304aa0b2ab0cdbea077a29354ad63c584cc706eae079fa12ea6e8480078ddaf2db0233779412e39556cdb42b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
v4.17.0 (July 2025)
|
2
|
+
- Add Exportable concern to house shared report export logic from Export::BaseController
|
3
|
+
- Only track report export when report is created
|
4
|
+
|
1
5
|
v4.16.0 (May 2025)
|
2
6
|
- Enable audit tracking for persistent permissions changes
|
3
7
|
- Default to draft state on tool upload
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Dradis
|
2
|
+
module Plugins
|
3
|
+
module Exportable
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
before_action :set_exporter, only: [:create]
|
8
|
+
before_action :validate_scope, only: [:create]
|
9
|
+
before_action :validate_template, only: [:create]
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def is_api?
|
15
|
+
controller_path.include?('api')
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_exporter
|
19
|
+
raise NotImplementedError
|
20
|
+
end
|
21
|
+
|
22
|
+
def templates_dir
|
23
|
+
@templates_dir ||= File.join(::Configuration::paths_templates_reports, @exporter)
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate_scope
|
27
|
+
unless Dradis::Plugins::ContentService::Base::VALID_SCOPES.include?(export_params[:scope])
|
28
|
+
if is_api?
|
29
|
+
render_json_error(Exception.new('Something fishy is going on...'), 422)
|
30
|
+
else
|
31
|
+
raise 'Something fishy is going on...'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def validate_template
|
37
|
+
@template_file =
|
38
|
+
File.expand_path(File.join(templates_dir, export_params[:template]))
|
39
|
+
|
40
|
+
unless @template_file.starts_with?(templates_dir) && File.exists?(@template_file)
|
41
|
+
if is_api?
|
42
|
+
render_json_error(Exception.new('Something fishy is going on...'), 422)
|
43
|
+
else
|
44
|
+
raise 'Something fishy is going on...'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -2,12 +2,11 @@ module Dradis
|
|
2
2
|
module Plugins
|
3
3
|
module Export
|
4
4
|
class BaseController < Rails.application.config.dradis.base_export_controller_class_name.to_s.constantize
|
5
|
+
include Exportable
|
5
6
|
include ProjectScoped
|
6
7
|
include UsageTracking if defined?(Dradis::Pro)
|
7
8
|
|
8
|
-
|
9
|
-
before_action :validate_template
|
10
|
-
after_action :track_export, if: -> { defined?(Dradis::Pro) }
|
9
|
+
after_action :track_export, only: [:create], if: -> { defined?(Dradis::Pro) }
|
11
10
|
|
12
11
|
protected
|
13
12
|
|
@@ -15,35 +14,16 @@ module Dradis
|
|
15
14
|
params.permit(:project_id, :scope, :template)
|
16
15
|
end
|
17
16
|
|
18
|
-
def validate_template
|
19
|
-
@template_file =
|
20
|
-
File.expand_path(File.join(templates_dir, export_params[:template]))
|
21
|
-
|
22
|
-
unless @template_file.starts_with?(templates_dir) && File.exists?(@template_file)
|
23
|
-
raise 'Something fishy is going on...'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def validate_scope
|
28
|
-
unless Dradis::Plugins::ContentService::Base::VALID_SCOPES.include?(export_params[:scope])
|
29
|
-
raise 'Something fishy is going on...'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
17
|
private
|
34
18
|
|
35
|
-
def
|
36
|
-
"#{self.class.to_s.deconstantize}::Engine".constantize.plugin_name.to_s
|
37
|
-
end
|
38
|
-
|
39
|
-
def templates_dir
|
40
|
-
@templates_dir ||= File.join(::Configuration::paths_templates_reports, engine_name)
|
19
|
+
def set_exporter
|
20
|
+
@exporter = "#{self.class.to_s.deconstantize}::Engine".constantize.plugin_name.to_s
|
41
21
|
end
|
42
22
|
|
43
23
|
def track_export
|
44
24
|
project = Project.includes(:evidence, :nodes).find(current_project.id)
|
45
25
|
track_usage('report.exported', {
|
46
|
-
exporter:
|
26
|
+
exporter: @exporter,
|
47
27
|
issue_count: project.issues.size,
|
48
28
|
evidence_count: project.evidence.size,
|
49
29
|
node_count: project.nodes.in_tree.size
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dradis-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.17.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: 2025-
|
11
|
+
date: 2025-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- LICENSE
|
69
69
|
- README.md
|
70
70
|
- Rakefile
|
71
|
+
- app/controllers/concerns/dradis/plugins/exportable.rb
|
71
72
|
- app/controllers/concerns/dradis/plugins/persistent_permissions.rb
|
72
73
|
- app/controllers/dradis/plugins/export/base_controller.rb
|
73
74
|
- dradis-plugins.gemspec
|