opencontrol-linter 0.1.2 → 0.1.3
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/exe/opencontrol2cfacts +53 -0
- data/lib/opencontrol/cli.rb +3 -3
- data/lib/opencontrol/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e890118e6b1b1a483d9dc72f7f90d27dedbf8af
|
4
|
+
data.tar.gz: b823064260b3dbd1fce4ff702752323c3e6de6ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdcd4931f2488c2efb2ff9471bcbcd22408703dd694b0b73e6e3b0d28a7b19faeb7b2b5e687f35ea63dede1421e1dc1371419a689eb5f26bcbd6c7cf6e1dafaa
|
7
|
+
data.tar.gz: 548245c81271b7ae37489a3f7e727cb979a0765e50474adaf6c2c167773d022ec4132635b31ab61dfe248cfaa451edb88e331cf79699e0e65636f5abf29d39f4
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "yaml"
|
5
|
+
require "json"
|
6
|
+
require "pp"
|
7
|
+
require 'date'
|
8
|
+
require 'csv'
|
9
|
+
require 'colorize'
|
10
|
+
|
11
|
+
DEFAULT_OPENCONTROLS_FILENAME = "./opencontrols/opencontrol.yaml".freeze
|
12
|
+
CFACTS_COLUMNS = ['Control Key', 'Response']
|
13
|
+
opencontrols_filename = DEFAULT_OPENCONTROLS_FILENAME
|
14
|
+
cfacts_csv_filename = "./opencontrols/opencontrol.cfacts.csv".freeze
|
15
|
+
|
16
|
+
puts "OpenControl conversion to CSV CFACTS format starting".green
|
17
|
+
|
18
|
+
if not File.exists?(opencontrols_filename)
|
19
|
+
puts "Expected an opencontrol.yaml, but could not find opencontrol.yaml " +
|
20
|
+
"in this directory.".red
|
21
|
+
exit(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
puts " . Reading OpenControl components:"
|
25
|
+
control_responses = {}
|
26
|
+
opencontrols = YAML.load_file(opencontrols_filename)
|
27
|
+
|
28
|
+
opencontrols['data']['components'].each do |component|
|
29
|
+
puts " . #{component['name']}"
|
30
|
+
component['satisfies'].each do |control|
|
31
|
+
key = "#{control['standard_key']} #{control['control_key']}"
|
32
|
+
control_responses[key] = {} unless control_responses.has_key?(key)
|
33
|
+
control_responses[key]['text'] = "" unless control_responses[key].has_key?('text')
|
34
|
+
control_responses[key]['control_key'] = control['control_key']
|
35
|
+
control_responses[key]['standard_key'] = control['standard_key']
|
36
|
+
control['narrative'].each do |narrative|
|
37
|
+
control_responses[key]['text'] += key + "\n"
|
38
|
+
control_responses[key]['text'] += narrative['text']
|
39
|
+
control_responses[key]['text'] += "\n"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
puts " . Building CFACTS file:"
|
45
|
+
CSV.open(cfacts_csv_filename, "w") do |csv|
|
46
|
+
csv << CFACTS_COLUMNS
|
47
|
+
control_responses.each do |key, control_response|
|
48
|
+
puts " . #{control_response['control_key']}"
|
49
|
+
csv << [control_response['control_key'], control_response['text']]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
puts "Completed (OpenControl 2 CFACTS)".green
|
data/lib/opencontrol/cli.rb
CHANGED
@@ -69,7 +69,7 @@ USAGE_TEXT
|
|
69
69
|
'./opencontrol.yaml'
|
70
70
|
]
|
71
71
|
}
|
72
|
-
}
|
72
|
+
}
|
73
73
|
|
74
74
|
ALIASES = {
|
75
75
|
components: %w[component c],
|
@@ -114,7 +114,7 @@ USAGE_TEXT
|
|
114
114
|
def self.construct_defaults(config)
|
115
115
|
spec = {
|
116
116
|
action: :run,
|
117
|
-
targets: {}.merge(PRESET[:targets]).merge(config[:targets])
|
117
|
+
targets: {}.merge(PRESET[:targets].dup).merge(config[:targets])
|
118
118
|
}
|
119
119
|
|
120
120
|
expand_components_filenames(spec)
|
@@ -144,7 +144,7 @@ USAGE_TEXT
|
|
144
144
|
if opencontrol_yaml_present?
|
145
145
|
construct_defaults(load_config_from_yaml)
|
146
146
|
else
|
147
|
-
PRESET
|
147
|
+
PRESET.dup
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
data/lib/opencontrol/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Opencontrol
|
4
4
|
# This module holds the Opencontrol Linter version information.
|
5
5
|
module Version
|
6
|
-
STRING = '0.1.
|
6
|
+
STRING = '0.1.3'.freeze
|
7
7
|
|
8
8
|
MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
|
9
9
|
'%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'.freeze
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opencontrol-linter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Kierman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -129,6 +129,20 @@ dependencies:
|
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '1.7'
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: csv
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 3.0.4
|
139
|
+
type: :runtime
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 3.0.4
|
132
146
|
- !ruby/object:Gem::Dependency
|
133
147
|
name: bundler
|
134
148
|
requirement: !ruby/object:Gem::Requirement
|
@@ -253,6 +267,7 @@ description: |2
|
|
253
267
|
email:
|
254
268
|
executables:
|
255
269
|
- opencontrol-linter
|
270
|
+
- opencontrol2cfacts
|
256
271
|
extensions: []
|
257
272
|
extra_rdoc_files:
|
258
273
|
- LICENSE.txt
|
@@ -261,6 +276,7 @@ files:
|
|
261
276
|
- LICENSE.txt
|
262
277
|
- README.md
|
263
278
|
- exe/opencontrol-linter
|
279
|
+
- exe/opencontrol2cfacts
|
264
280
|
- lib/opencontrol.rb
|
265
281
|
- lib/opencontrol/cli.rb
|
266
282
|
- lib/opencontrol/linter.rb
|