dradis-plugins 5.2.0 → 5.3.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 +3 -0
- data/app/controllers/concerns/dradis/plugins/mappings/ticketing/fields_and_sources.rb +43 -0
- data/lib/dradis/plugins/gem_version.rb +2 -2
- data/lib/dradis/plugins/mapping_service.rb +7 -14
- data/lib/dradis/plugins/mappings/base.rb +11 -0
- data/lib/dradis/plugins/mappings/ticketing/source.rb +30 -0
- data/lib/dradis/plugins/mappings.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac76cb676d1435a70bffb933f994cab055b305bc82f6b299d3f733123894ca47
|
|
4
|
+
data.tar.gz: 8488275c5d2f4bc919f99e8977db110c48553b8f5174686d541348f4fa60ef69
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de2e3063402c9cdb4f586281058c69f765a8de7698cf09ce4c20cdab82adce32bd7f3c9caa6e0955ae2084020e4c5693476412d3c6c6e20c4850795bf7673fbc
|
|
7
|
+
data.tar.gz: d4a1d1a9906e92d9f5113dc3b7f8549a4a1a5d298643fc827cb2cabb45cdb375c64ca29545da79c054ccd8e69c3544063c8e9ab5d316cbc20eb8a5ff995559ad
|
data/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Dradis
|
|
2
|
+
module Plugins
|
|
3
|
+
module Mappings
|
|
4
|
+
module Ticketing
|
|
5
|
+
# Shared by ticketing integrations' MappingsControllers (e.g. Jira,
|
|
6
|
+
# VSTS, ServiceNow) to list Dradis Report Templates as mapping
|
|
7
|
+
# sources. Distinct from Dradis::Plugins::Mappings::Base, which
|
|
8
|
+
# handles the opposite direction (mapping inbound upload data into
|
|
9
|
+
# Dradis fields).
|
|
10
|
+
module FieldsAndSources
|
|
11
|
+
extend ActiveSupport::Concern
|
|
12
|
+
|
|
13
|
+
def set_rtp_fields_and_sources
|
|
14
|
+
set_rtp_fields
|
|
15
|
+
set_sources
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def set_rtp_fields
|
|
19
|
+
@rtp_fields = ReportTemplateProperties.all.filter_map do |rtp|
|
|
20
|
+
next if rtp.issue_fields.count == 0
|
|
21
|
+
[rtp.id, rtp.issue_fields.map(&:name)]
|
|
22
|
+
end.to_h
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def set_sources
|
|
26
|
+
@sources = ReportTemplateProperties.all.group_by(&:plugin_name).map do |plugin_name, rtps|
|
|
27
|
+
mapped_rtps = rtps.map do |rtp|
|
|
28
|
+
suffix = ''
|
|
29
|
+
options = {}
|
|
30
|
+
if rtp.issue_fields.count == 0
|
|
31
|
+
suffix = ' (no issue fields)'
|
|
32
|
+
options = { disabled: 'disabled' }
|
|
33
|
+
end
|
|
34
|
+
[rtp.title + suffix, rtp.id, options]
|
|
35
|
+
end
|
|
36
|
+
[plugin_name.titleize, mapped_rtps]
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -7,7 +7,6 @@ module Dradis
|
|
|
7
7
|
@destination = destination
|
|
8
8
|
@integration = integration
|
|
9
9
|
@component = @integration.meta[:name].to_s
|
|
10
|
-
@sample_dir = default_sample_dir
|
|
11
10
|
end
|
|
12
11
|
|
|
13
12
|
def apply_mapping(data:, source:, mapping_fields: nil)
|
|
@@ -31,21 +30,14 @@ module Dradis
|
|
|
31
30
|
# This returns a sample of valid entry for the Mappings Manager
|
|
32
31
|
def sample
|
|
33
32
|
@sample ||= {}
|
|
34
|
-
if valid_source?
|
|
35
|
-
@sample[source] ||= begin
|
|
36
|
-
sample_file = File.join(@sample_dir, "#{source}.sample")
|
|
37
|
-
File.read(sample_file)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
33
|
+
@sample[source] ||= integration.sample(source) if valid_source?
|
|
40
34
|
end
|
|
41
35
|
|
|
42
36
|
private
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@
|
|
47
|
-
File.join(Configuration.paths_templates_plugins, component)
|
|
48
|
-
end
|
|
38
|
+
def source_fields
|
|
39
|
+
@source_fields ||= {}
|
|
40
|
+
@source_fields[source] ||= integration.source_fields(source)
|
|
49
41
|
end
|
|
50
42
|
|
|
51
43
|
def get_mapping_fields
|
|
@@ -61,7 +53,7 @@ module Dradis
|
|
|
61
53
|
content.gsub(/{{\s?#{component}\[(\S*?)\]\s?}}/) do |field|
|
|
62
54
|
name = field.split(/\[|\]/)[1]
|
|
63
55
|
|
|
64
|
-
if
|
|
56
|
+
if source_fields.include?(name)
|
|
65
57
|
field_processor.value(field: name)
|
|
66
58
|
else
|
|
67
59
|
"Field [#{field}] not recognized by the integration"
|
|
@@ -70,7 +62,8 @@ module Dradis
|
|
|
70
62
|
end
|
|
71
63
|
|
|
72
64
|
def valid_source?
|
|
73
|
-
|
|
65
|
+
valid_sources ||= integration.mapping_sources
|
|
66
|
+
@source = source if valid_sources.include?(source.to_sym)
|
|
74
67
|
end
|
|
75
68
|
end
|
|
76
69
|
end
|
|
@@ -72,6 +72,17 @@ module Dradis::Plugins::Mappings::Base
|
|
|
72
72
|
self::Mapping::SOURCE_FIELDS.keys
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
+
# The sample content for a source, used by the Mappings Manager to
|
|
76
|
+
# preview an integration's mapping fields applied to real-looking data.
|
|
77
|
+
# Static-source integrations ship a real .sample file in the gem (see
|
|
78
|
+
# Dradis::Plugins::Templates::Samples, copied into place at boot);
|
|
79
|
+
# integrations whose sources aren't known ahead of time (e.g. csv) can
|
|
80
|
+
# override this instead.
|
|
81
|
+
def sample(source)
|
|
82
|
+
sample_file = File.join(Configuration.paths_templates_plugins, component, "#{source}.sample")
|
|
83
|
+
File.read(sample_file)
|
|
84
|
+
end
|
|
85
|
+
|
|
75
86
|
def source_fields(source)
|
|
76
87
|
if mapping_sources.include?(source.to_sym)
|
|
77
88
|
self::Mapping::SOURCE_FIELDS[source.to_sym]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Dradis
|
|
2
|
+
module Plugins
|
|
3
|
+
module Mappings
|
|
4
|
+
module Ticketing
|
|
5
|
+
# Shared by ticketing integrations' Mapping::Source classes (e.g.
|
|
6
|
+
# Jira, VSTS, ServiceNow) to identify a Report Template as a mapping
|
|
7
|
+
# source. Distinct from Dradis::Plugins::Mappings::Base, which
|
|
8
|
+
# handles the opposite direction (mapping inbound upload data into
|
|
9
|
+
# Dradis fields).
|
|
10
|
+
class Source
|
|
11
|
+
attr_reader :rtp_id, :source
|
|
12
|
+
|
|
13
|
+
def initialize(args)
|
|
14
|
+
if args[:source]
|
|
15
|
+
@source = args[:source]
|
|
16
|
+
@rtp_id = args[:source][/rtp_(\d+)/, 1]
|
|
17
|
+
elsif args[:rtp_id]
|
|
18
|
+
@rtp_id = args[:rtp_id]
|
|
19
|
+
@source = "rtp_#{args[:rtp_id]}"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def to_s
|
|
24
|
+
source
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dradis-plugins
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Martin
|
|
@@ -82,6 +82,7 @@ files:
|
|
|
82
82
|
- README.md
|
|
83
83
|
- Rakefile
|
|
84
84
|
- app/controllers/concerns/dradis/plugins/exportable.rb
|
|
85
|
+
- app/controllers/concerns/dradis/plugins/mappings/ticketing/fields_and_sources.rb
|
|
85
86
|
- app/controllers/concerns/dradis/plugins/persistent_permissions.rb
|
|
86
87
|
- app/controllers/dradis/plugins/export/base_controller.rb
|
|
87
88
|
- dradis-plugins.gemspec
|
|
@@ -110,6 +111,7 @@ files:
|
|
|
110
111
|
- lib/dradis/plugins/mapping_service.rb
|
|
111
112
|
- lib/dradis/plugins/mappings.rb
|
|
112
113
|
- lib/dradis/plugins/mappings/base.rb
|
|
114
|
+
- lib/dradis/plugins/mappings/ticketing/source.rb
|
|
113
115
|
- lib/dradis/plugins/settings.rb
|
|
114
116
|
- lib/dradis/plugins/settings/adapters/db.rb
|
|
115
117
|
- lib/dradis/plugins/settings/adapters/encrypted_configuration.rb
|