inspec-reporter-json-hdf 1.0.1 → 1.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/inspec-reporter-json-hdf.gemspec +2 -0
- data/lib/inspec-reporter-json-hdf/reporter.rb +39 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 375c586fb5019a374276cbd7e78369e8297b75db012ade31ca84dbb607eae39c
|
4
|
+
data.tar.gz: 5b63861c6c0304e4800f1e98b81c5e4b66c85f3ba0c7fcfdc42732c4c21f322b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37a2979dba233369c491e25404b21a5b1bcc8eae57c772f1125be4f4ac500fe43201334364b9f8f9b0501d1d590a13711e45c840635b8fe9ddba859e5d122675
|
7
|
+
data.tar.gz: 16b920add79bf353a0a4113f3af93cf701c449b5cdeabc35e0883e2ae14854c3c3eab83e0a0d82852b84a1742816061f53d3bb90df7a34c9b87ae25744e69910
|
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.required_ruby_version = '~> 2.5'
|
19
19
|
|
20
20
|
spec.add_runtime_dependency 'git-lite-version-bump', '~> 0.17', '>= 0.17.3'
|
21
|
+
spec.add_runtime_dependency 'roo', '~> 2.8.3'
|
22
|
+
|
21
23
|
spec.add_development_dependency 'bundler'
|
22
24
|
spec.add_development_dependency 'bundler-audit'
|
23
25
|
spec.add_development_dependency 'codeclimate-test-reporter'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'inspec/plugin/v2'
|
3
3
|
require 'json'
|
4
|
+
require 'roo'
|
4
5
|
|
5
6
|
VALID_FREQUENCY = %w[annually semiannually quarterly monthly every2weeks weekly every3days daily].freeze
|
6
7
|
|
@@ -123,7 +124,44 @@ module InspecPlugins::HdfReporter
|
|
123
124
|
|
124
125
|
def collect_attestations
|
125
126
|
plugin_config = Inspec::Config.cached.fetch_plugin_config('inspec-reporter-json-hdf')
|
126
|
-
attestations =
|
127
|
+
attestations = []
|
128
|
+
if plugin_config['include-attestations-file']
|
129
|
+
if File.exist?(plugin_config['include-attestations-file']['path'])
|
130
|
+
if plugin_config['include-attestations-file']['type'].eql?('csv')
|
131
|
+
sheet = Roo::Spreadsheet.open(plugin_config['include-attestations-file']['path'], extension: :csv).sheet(0)
|
132
|
+
|
133
|
+
attestations = sheet.parse(control_id: "Control_ID",
|
134
|
+
explanation: "Explanation",
|
135
|
+
frequency: "Frequency",
|
136
|
+
status: "Status",
|
137
|
+
updated: "Updated",
|
138
|
+
updated_by: "Updated_By",
|
139
|
+
clean:true
|
140
|
+
)
|
141
|
+
elsif plugin_config['include-attestations-file']['type'].eql?('xlsx')
|
142
|
+
sheet = Roo::Spreadsheet.open(plugin_config['include-attestations-file']['path'], extension: :xlsx).sheet(0)
|
143
|
+
|
144
|
+
attestations = sheet.parse(control_id: "Control_ID",
|
145
|
+
explanation: "Explanation",
|
146
|
+
frequency: "Frequency",
|
147
|
+
status: "Status",
|
148
|
+
updated: "Updated",
|
149
|
+
updated_by: "Updated_By",
|
150
|
+
clean:true
|
151
|
+
)
|
152
|
+
attestations.map do |h|
|
153
|
+
h[:updated] = h[:updated].to_s
|
154
|
+
end
|
155
|
+
else
|
156
|
+
puts 'Warning: Invalid `include-attestations-file` type provided. Supported types: csv, xlsx'
|
157
|
+
end
|
158
|
+
else
|
159
|
+
puts "Warning: Include Attestation File provided '#{plugin_config['include-attestations-file']['path']}' not found."
|
160
|
+
end
|
161
|
+
end
|
162
|
+
attestations.map!{ |x| x.transform_keys(&:to_s) }
|
163
|
+
attestations = attestations + (plugin_config['attestations'] || [])
|
164
|
+
attestations.reject! { |x| x['status'].eql?("") || x['status'].nil? }
|
127
165
|
|
128
166
|
if attestations.empty?
|
129
167
|
puts 'Warning: Attestations not provided; HDF will be generated without attestations.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec-reporter-json-hdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.1.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rony Xavier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git-lite-version-bump
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.17.3
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: roo
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 2.8.3
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.8.3
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: bundler
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,9 +197,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
197
|
version: '2.5'
|
184
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
199
|
requirements:
|
186
|
-
- - "
|
200
|
+
- - ">"
|
187
201
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
202
|
+
version: 1.3.1
|
189
203
|
requirements: []
|
190
204
|
rubygems_version: 3.2.3
|
191
205
|
signing_key:
|