inspec_tools 1.8.3 → 2.0.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 +117 -5
- data/README.md +19 -5
- data/lib/data/NIST_Map_02052020_CIS_Controls_Version_7.1_Implementation_Groups_1.2.xlsx +0 -0
- data/lib/data/NIST_Map_09212017B_CSC-CIS_Critical_Security_Controls_VER_6.1_Excel_9.1.2016.xlsx +0 -0
- data/lib/inspec_tools/help/summary.md +2 -2
- data/lib/inspec_tools/plugin_cli.rb +15 -8
- data/lib/inspec_tools/version.rb +6 -1
- data/lib/inspec_tools/xlsx.rb +28 -20
- data/lib/overrides/false_class.rb +5 -0
- data/lib/overrides/nil_class.rb +5 -0
- data/lib/overrides/object.rb +5 -0
- data/lib/overrides/string.rb +5 -0
- data/lib/overrides/true_class.rb +5 -0
- data/lib/utilities/inspec_util.rb +8 -32
- metadata +24 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 665c46c30c84540e2442c2e2f5c0f9f1d2947c588468e21f55fb8f8da3458f6e
|
4
|
+
data.tar.gz: 6bcdae205277fa85d2aa8c52a1a5f33dacdea173f17f1c77ae70be955ffe933c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f8417d22291ca94062949c58104256fcbf9eed642f61b53d10913abdc121a249872dc562d6a9d248656be36e8adcef15422e59d69c1777f7b9c649d79dd9ab
|
7
|
+
data.tar.gz: 79febc2b5c86c16b3f21747f1155e3832f8c489d7e334252c317662c256902d19aad5f9f79921f1da1c30cad877dffb71ec32f1b19f2006b0f2f768b9a2da527
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,87 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [Unreleased](https://github.com/mitre/inspec_tools/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.10...HEAD)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- xlsx2inspec failing to parse controls over two digits [\#117](https://github.com/mitre/inspec_tools/issues/117)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Update parse XLSXTool\#parse\_cis\_control to handle the case when there… [\#123](https://github.com/mitre/inspec_tools/pull/123) ([Bialogs](https://github.com/Bialogs))
|
14
|
+
- Track Inspec versions \>= 4.18.100 [\#122](https://github.com/mitre/inspec_tools/pull/122) ([Bialogs](https://github.com/Bialogs))
|
15
|
+
- Restructure workflow for publishing gem [\#121](https://github.com/mitre/inspec_tools/pull/121) ([rbclark](https://github.com/rbclark))
|
16
|
+
|
17
|
+
## [v1.8.10](https://github.com/mitre/inspec_tools/tree/v1.8.10) (2020-03-30)
|
18
|
+
|
19
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.9...v1.8.10)
|
20
|
+
|
21
|
+
**Merged pull requests:**
|
22
|
+
|
23
|
+
- added two digit contol parsing fixes \#117 [\#120](https://github.com/mitre/inspec_tools/pull/120) ([yarick](https://github.com/yarick))
|
24
|
+
|
25
|
+
## [v1.8.9](https://github.com/mitre/inspec_tools/tree/v1.8.9) (2020-03-30)
|
26
|
+
|
27
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.8...v1.8.9)
|
28
|
+
|
29
|
+
**Merged pull requests:**
|
30
|
+
|
31
|
+
- Fix bug in creating severity override guidance tags [\#118](https://github.com/mitre/inspec_tools/pull/118) ([Bialogs](https://github.com/Bialogs))
|
32
|
+
|
33
|
+
## [v1.8.8](https://github.com/mitre/inspec_tools/tree/v1.8.8) (2020-03-30)
|
34
|
+
|
35
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.7...v1.8.8)
|
36
|
+
|
37
|
+
**Implemented enhancements:**
|
38
|
+
|
39
|
+
- add a `--json-full` and `--json-counts` option to the summary command - like the cli so I can pipe to jq [\#78](https://github.com/mitre/inspec_tools/issues/78)
|
40
|
+
|
41
|
+
**Merged pull requests:**
|
42
|
+
|
43
|
+
- Add --json-full and --json-summary options to summary subcommand [\#116](https://github.com/mitre/inspec_tools/pull/116) ([Bialogs](https://github.com/Bialogs))
|
44
|
+
|
45
|
+
## [v1.8.7](https://github.com/mitre/inspec_tools/tree/v1.8.7) (2020-03-29)
|
46
|
+
|
47
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.6...v1.8.7)
|
48
|
+
|
49
|
+
## [v1.8.6](https://github.com/mitre/inspec_tools/tree/v1.8.6) (2020-03-27)
|
50
|
+
|
51
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.5...v1.8.6)
|
52
|
+
|
53
|
+
**Closed issues:**
|
54
|
+
|
55
|
+
- GitHub Actions Build Matrix [\#112](https://github.com/mitre/inspec_tools/issues/112)
|
56
|
+
|
57
|
+
**Merged pull requests:**
|
58
|
+
|
59
|
+
- Update build/test process to only use GitHub actions [\#115](https://github.com/mitre/inspec_tools/pull/115) ([Bialogs](https://github.com/Bialogs))
|
60
|
+
|
61
|
+
## [v1.8.5](https://github.com/mitre/inspec_tools/tree/v1.8.5) (2020-03-27)
|
62
|
+
|
63
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.4...v1.8.5)
|
64
|
+
|
65
|
+
**Implemented enhancements:**
|
66
|
+
|
67
|
+
- add "\# encoding: utf-8" to controls [\#54](https://github.com/mitre/inspec_tools/issues/54)
|
68
|
+
|
69
|
+
**Merged pull requests:**
|
70
|
+
|
71
|
+
- Add '\# encoding: UTF-8' to the top of all generated controls/\*.rb [\#114](https://github.com/mitre/inspec_tools/pull/114) ([Bialogs](https://github.com/Bialogs))
|
72
|
+
|
73
|
+
## [v1.8.4](https://github.com/mitre/inspec_tools/tree/v1.8.4) (2020-03-27)
|
74
|
+
|
75
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.3...v1.8.4)
|
76
|
+
|
77
|
+
**Fixed bugs:**
|
78
|
+
|
79
|
+
- \[BUG\] inspec\_tools \> 1.7.1 getting unknown encoding name - UTF-8 \(RuntimeError\) [\#110](https://github.com/mitre/inspec_tools/issues/110)
|
80
|
+
|
81
|
+
**Merged pull requests:**
|
82
|
+
|
83
|
+
- Reorganize overrides [\#113](https://github.com/mitre/inspec_tools/pull/113) ([Bialogs](https://github.com/Bialogs))
|
84
|
+
|
3
85
|
## [v1.8.3](https://github.com/mitre/inspec_tools/tree/v1.8.3) (2020-03-27)
|
4
86
|
|
5
87
|
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.2...v1.8.3)
|
@@ -12,6 +94,10 @@
|
|
12
94
|
|
13
95
|
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.1...v1.8.2)
|
14
96
|
|
97
|
+
**Merged pull requests:**
|
98
|
+
|
99
|
+
- Gemspec Dependency Updates [\#109](https://github.com/mitre/inspec_tools/pull/109) ([Bialogs](https://github.com/Bialogs))
|
100
|
+
|
15
101
|
## [v1.8.1](https://github.com/mitre/inspec_tools/tree/v1.8.1) (2020-03-24)
|
16
102
|
|
17
103
|
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.8.0...v1.8.1)
|
@@ -34,8 +120,8 @@
|
|
34
120
|
|
35
121
|
**Merged pull requests:**
|
36
122
|
|
37
|
-
- Gemspec Dependency Updates [\#109](https://github.com/mitre/inspec_tools/pull/109) ([Bialogs](https://github.com/Bialogs))
|
38
123
|
- Support conversion from CAT/Category style severities when generating an impact number. [\#106](https://github.com/mitre/inspec_tools/pull/106) ([Bialogs](https://github.com/Bialogs))
|
124
|
+
- Remove warnings \(\#minor\) [\#101](https://github.com/mitre/inspec_tools/pull/101) ([Bialogs](https://github.com/Bialogs))
|
39
125
|
|
40
126
|
## [v1.7.3](https://github.com/mitre/inspec_tools/tree/v1.7.3) (2020-03-23)
|
41
127
|
|
@@ -73,10 +159,6 @@
|
|
73
159
|
|
74
160
|
- Migrate to depend on the new inspect objects library [\#86](https://github.com/mitre/inspec_tools/issues/86)
|
75
161
|
|
76
|
-
**Merged pull requests:**
|
77
|
-
|
78
|
-
- Remove warnings \(\#minor\) [\#101](https://github.com/mitre/inspec_tools/pull/101) ([Bialogs](https://github.com/Bialogs))
|
79
|
-
|
80
162
|
## [v1.6.21](https://github.com/mitre/inspec_tools/tree/v1.6.21) (2020-03-20)
|
81
163
|
|
82
164
|
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.6.20...v1.6.21)
|
@@ -372,6 +454,7 @@
|
|
372
454
|
- Travis test [\#39](https://github.com/mitre/inspec_tools/pull/39) ([robthew](https://github.com/robthew))
|
373
455
|
- Add rubocop to the process [\#35](https://github.com/mitre/inspec_tools/pull/35) ([aaronlippold](https://github.com/aaronlippold))
|
374
456
|
- \* added refernces to external data sources [\#30](https://github.com/mitre/inspec_tools/pull/30) ([aaronlippold](https://github.com/aaronlippold))
|
457
|
+
- Cleanup Debug Statetements [\#12](https://github.com/mitre/inspec_tools/pull/12) ([yarick](https://github.com/yarick))
|
375
458
|
|
376
459
|
## [v1.1.2](https://github.com/mitre/inspec_tools/tree/v1.1.2) (2018-11-08)
|
377
460
|
|
@@ -381,6 +464,35 @@
|
|
381
464
|
|
382
465
|
[Full Changelog](https://github.com/mitre/inspec_tools/compare/v1.1.0...v1.1.1)
|
383
466
|
|
467
|
+
## [v1.1.0](https://github.com/mitre/inspec_tools/tree/v1.1.0) (2018-11-08)
|
468
|
+
|
469
|
+
[Full Changelog](https://github.com/mitre/inspec_tools/compare/85b69b32277ea43f95b09eee00e9f7b84c62dfff...v1.1.0)
|
470
|
+
|
471
|
+
**Fixed bugs:**
|
472
|
+
|
473
|
+
- Remove unneeded `exe` dir if we are going to standardize on `bin`and update the `.gemspec` file [\#25](https://github.com/mitre/inspec_tools/issues/25)
|
474
|
+
|
475
|
+
**Closed issues:**
|
476
|
+
|
477
|
+
- when you When build the gem and install it - the command `inspec\_tools` does not seem to install into the path [\#26](https://github.com/mitre/inspec_tools/issues/26)
|
478
|
+
- Add MITRE Copyright to the end of the README.md [\#23](https://github.com/mitre/inspec_tools/issues/23)
|
479
|
+
- Update email addresses to MITRE addresses [\#18](https://github.com/mitre/inspec_tools/issues/18)
|
480
|
+
- update readme.md [\#17](https://github.com/mitre/inspec_tools/issues/17)
|
481
|
+
- update inspec\_tools.gemspec [\#16](https://github.com/mitre/inspec_tools/issues/16)
|
482
|
+
- update license to apache 2.0 [\#13](https://github.com/mitre/inspec_tools/issues/13)
|
483
|
+
- Separate Files defaults to \[False\] [\#10](https://github.com/mitre/inspec_tools/issues/10)
|
484
|
+
- Rename repository to 'inspec\_tools' [\#9](https://github.com/mitre/inspec_tools/issues/9)
|
485
|
+
|
486
|
+
**Merged pull requests:**
|
487
|
+
|
488
|
+
- Change default separated\_files setting to default to true [\#11](https://github.com/mitre/inspec_tools/pull/11) ([yarick](https://github.com/yarick))
|
489
|
+
- Cleanup [\#8](https://github.com/mitre/inspec_tools/pull/8) ([robthew](https://github.com/robthew))
|
490
|
+
- Unification [\#5](https://github.com/mitre/inspec_tools/pull/5) ([dromazmj](https://github.com/dromazmj))
|
491
|
+
- \* Adds functionality for inspec2csv [\#4](https://github.com/mitre/inspec_tools/pull/4) ([dromazmj](https://github.com/dromazmj))
|
492
|
+
- Md/pdf [\#3](https://github.com/mitre/inspec_tools/pull/3) ([dromazmj](https://github.com/dromazmj))
|
493
|
+
- Md/csv2inspec [\#2](https://github.com/mitre/inspec_tools/pull/2) ([dromazmj](https://github.com/dromazmj))
|
494
|
+
- Writes code in the inspec util to output an inspec json to a directory [\#1](https://github.com/mitre/inspec_tools/pull/1) ([dromazmj](https://github.com/dromazmj))
|
495
|
+
|
384
496
|
|
385
497
|
|
386
498
|
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# InspecTools
|
2
2
|
|
3
|
-

|
3
|
+

|
4
|
+

|
4
5
|
|
5
6
|
InspecTools supplies several CLI tools to convert to and from InSpec format.
|
6
7
|
|
@@ -140,13 +141,16 @@ summary parses an inspec results json to create a summary json
|
|
140
141
|
USAGE: inspec_tools summary [OPTIONS] -j <inspec-json> -o <summary-csv>
|
141
142
|
|
142
143
|
FLAGS:
|
143
|
-
-j --inspec-json <inspec-json>
|
144
|
-
-o --output <output-json>
|
145
|
-
|
144
|
+
-j --inspec-json <inspec-json> : path to InSpec results JSON
|
145
|
+
-o --output <output-json> : path to summary JSON
|
146
|
+
-c --cli, --no-cli : print summary to STDOUT
|
147
|
+
-V --verbose, --no-verbose : print verbose an debug output
|
148
|
+
-f --json-full, --no-json-full : print the summary STDOUT as JSON
|
149
|
+
-k --json-counts, --no-json_cou : print the reslut status to STDOUT as JSON
|
146
150
|
|
147
151
|
Examples:
|
148
152
|
|
149
|
-
inspec_tools summary -j examples/sample_json/rhel-simp.json -o summary.json -c
|
153
|
+
inspec_tools summary -j examples/sample_json/rhel-simp.json -f -o summary.json -c
|
150
154
|
```
|
151
155
|
|
152
156
|
## xccdf2inspec
|
@@ -298,6 +302,16 @@ View our wiki pages on [expected](https://github.com/mitre/inspec_tools/wiki/Exp
|
|
298
302
|
|
299
303
|
View our [wiki page](https://github.com/mitre/inspec_tools/wiki/Development) for more information on contributing.
|
300
304
|
|
305
|
+
# Publishing a Release
|
306
|
+
|
307
|
+
If you are a maintainer, it is very easy to cut a release of this gem:
|
308
|
+
|
309
|
+
1. Click on "Releases" and there should be a draft pending.
|
310
|
+
2. Make sure the Tag version and Release title match!
|
311
|
+
3. Add any additional notes can be added in the Description box.
|
312
|
+
4. Click "Publish release".
|
313
|
+
5. Release notes will be posted and a new gem will be pushed to Rubygems & Github Packages with the version you specified on step 2.
|
314
|
+
|
301
315
|
### NOTICE
|
302
316
|
|
303
317
|
© 2018 The MITRE Corporation.
|
Binary file
|
data/lib/data/NIST_Map_09212017B_CSC-CIS_Critical_Security_Controls_VER_6.1_Excel_9.1.2016.xlsx
CHANGED
Binary file
|
@@ -205,21 +205,28 @@ module InspecPlugins
|
|
205
205
|
long_desc InspecTools::Help.text(:summary)
|
206
206
|
option :inspec_json, required: true, aliases: '-j'
|
207
207
|
option :output, required: false, aliases: '-o'
|
208
|
-
option :cli, required: false, aliases: '-c'
|
208
|
+
option :cli, type: :boolean, required: false, aliases: '-c'
|
209
209
|
option :verbose, type: :boolean, aliases: '-V'
|
210
|
+
option :json_full, type: :boolean, required: false, aliases: '-f'
|
211
|
+
option :json_counts, type: :boolean, required: false, aliases: '-k'
|
210
212
|
|
211
213
|
def summary
|
212
214
|
summary = InspecTools::Summary.new(File.read(options[:inspec_json])).to_summary
|
213
215
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
216
|
+
if options[:cli]
|
217
|
+
puts "\nOverall compliance: #{summary[:compliance]}%\n\n"
|
218
|
+
summary[:status].keys.each do |category|
|
219
|
+
puts category
|
220
|
+
summary[:status][category].keys.each do |impact|
|
221
|
+
puts "\t#{impact} : #{summary[:status][category][impact]}"
|
222
|
+
end
|
219
223
|
end
|
220
|
-
end
|
224
|
+
end
|
221
225
|
|
222
|
-
|
226
|
+
json_summary = summary.to_json
|
227
|
+
File.write(options[:output], json_summary) if options[:output]
|
228
|
+
puts json_summary if options[:json_full]
|
229
|
+
puts summary[:status].to_json if options[:json_counts]
|
223
230
|
end
|
224
231
|
|
225
232
|
desc 'compliance', 'compliance parses an inspec results json to check if the compliance level meets a specified threshold'
|
data/lib/inspec_tools/version.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'git-version-bump'
|
2
|
+
|
1
3
|
module InspecTools
|
2
|
-
|
4
|
+
# Enable lite-tags (2nd parameter to git-version-bump version command)
|
5
|
+
# Lite tags are tags that are used by GitHub releases that do not contain
|
6
|
+
# annotations
|
7
|
+
VERSION = GVB.version(false, true)
|
3
8
|
end
|
data/lib/inspec_tools/xlsx.rb
CHANGED
@@ -70,7 +70,7 @@ module InspecTools
|
|
70
70
|
end
|
71
71
|
[ 1, 2 ].each do |level|
|
72
72
|
@xlsx.sheet(level).each_row_streaming do |row|
|
73
|
-
if row[@mapping['control.id']].nil? || !/^\d
|
73
|
+
if row[@mapping['control.id']].nil? || !/^\d+(\.?\d)*$/.match(row[@mapping['control.id']].formatted_value)
|
74
74
|
next
|
75
75
|
end
|
76
76
|
tag_pos = @mapping['control.tags']
|
@@ -80,38 +80,46 @@ module InspecTools
|
|
80
80
|
control['title'] = row[@mapping['control.title']].formatted_value unless @mapping['control.title'].nil? || row[@mapping['control.title']].nil?
|
81
81
|
control['desc'] = ""
|
82
82
|
control['desc'] = row[@mapping['control.desc']].formatted_value unless row[@mapping['control.desc']].nil?
|
83
|
-
control['tags']['rationale'] = row[tag_pos['rationale']].formatted_value unless row[tag_pos['rationale']].
|
83
|
+
control['tags']['rationale'] = row[tag_pos['rationale']].formatted_value unless row[tag_pos['rationale']].empty?
|
84
84
|
|
85
85
|
control['tags']['severity'] = level == 1 ? 'medium' : 'high'
|
86
86
|
control['impact'] = Utils::InspecUtil.get_impact(control['tags']['severity'])
|
87
87
|
control['tags']['ref'] = row[@mapping['control.ref']].formatted_value unless @mapping['control.ref'].nil? || row[@mapping['control.ref']].nil?
|
88
88
|
control['tags']['cis_level'] = level unless level.nil?
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
control['tags']['nist'] = []
|
94
|
-
cis_tags.each do |cis_tag|
|
95
|
-
if cis_tag[2].nil? || cis_tag[2] == ""
|
96
|
-
control['tags']['cis_controls'] << cis_tag[1].to_s
|
97
|
-
control['tags']['nist'] << cis2Nist[cis_tag[1]]
|
98
|
-
else
|
99
|
-
control['tags']['cis_controls'] << cis_tag[1].to_s + "." + cis_tag[2].to_s
|
100
|
-
control['tags']['nist'] << cis2Nist[cis_tag[1].to_s + "." + cis_tag[2].to_s]
|
101
|
-
end
|
90
|
+
unless row[tag_pos['cis_controls']].empty?
|
91
|
+
# cis_control must be extracted from CIS control column via regex
|
92
|
+
control = handle_cis_tags(control, row[tag_pos['cis_controls']].formatted_value.scan(/CONTROL:v(\d) (\d+)\.?(\d*)/))
|
102
93
|
end
|
103
|
-
if not control['tags']['nist'].nil?
|
104
|
-
control['tags']['nist'] << "Rev_4"
|
105
|
-
end
|
106
|
-
control['tags']['cis_controls'] << "Rev_" + cis_tags.first[0] unless cis_tags[0].nil?
|
107
94
|
|
108
95
|
control['tags']['cis_rid'] = row[@mapping['control.id']].formatted_value unless @mapping['control.id'].nil? || row[@mapping['control.id']].nil?
|
109
|
-
control['tags']['check'] = row[tag_pos['check']].formatted_value unless tag_pos['check'].nil? || row[tag_pos['check']].
|
110
|
-
control['tags']['fix'] = row[tag_pos['fix']].formatted_value unless tag_pos['fix'].nil? || row[tag_pos['fix']].
|
96
|
+
control['tags']['check'] = row[tag_pos['check']].formatted_value unless tag_pos['check'].nil? || row[tag_pos['check']].empty?
|
97
|
+
control['tags']['fix'] = row[tag_pos['fix']].formatted_value unless tag_pos['fix'].nil? || row[tag_pos['fix']].empty?
|
111
98
|
|
112
99
|
@controls << control
|
113
100
|
end
|
114
101
|
end
|
115
102
|
end
|
103
|
+
|
104
|
+
def handle_cis_tags(control, cis_tags)
|
105
|
+
control['tags']['cis_controls'] = []
|
106
|
+
control['tags']['nist'] = []
|
107
|
+
|
108
|
+
cis_tags.each do |cis_tag|
|
109
|
+
if cis_tag[2].nil? || cis_tag[2] == ""
|
110
|
+
control['tags']['cis_controls'] << cis_tag[1].to_s
|
111
|
+
control['tags']['nist'] << cis2Nist[cis_tag[1]]
|
112
|
+
else
|
113
|
+
control['tags']['cis_controls'] << cis_tag[1].to_s + "." + cis_tag[2].to_s
|
114
|
+
control['tags']['nist'] << cis2Nist[cis_tag[1].to_s + "." + cis_tag[2].to_s]
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
if not control['tags']['nist'].nil?
|
119
|
+
control['tags']['nist'] << "Rev_4"
|
120
|
+
end
|
121
|
+
control['tags']['cis_controls'] << "Rev_" + cis_tags.first[0] unless cis_tags[0].nil?
|
122
|
+
control
|
123
|
+
end
|
116
124
|
end
|
117
125
|
end
|
@@ -6,37 +6,11 @@ require 'net/http'
|
|
6
6
|
require 'fileutils'
|
7
7
|
require 'exceptions/impact_input_error'
|
8
8
|
require 'exceptions/severity_input_error'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class String
|
18
|
-
def blank?
|
19
|
-
self.strip.empty?
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class FalseClass
|
24
|
-
def blank?
|
25
|
-
true
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class TrueClass
|
30
|
-
def blank?
|
31
|
-
false
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
class Object
|
36
|
-
def blank?
|
37
|
-
respond_to?(:empty?) ? empty? : !self
|
38
|
-
end
|
39
|
-
end
|
9
|
+
require 'overrides/false_class'
|
10
|
+
require 'overrides/true_class'
|
11
|
+
require 'overrides/nil_class'
|
12
|
+
require 'overrides/object'
|
13
|
+
require 'overrides/string'
|
40
14
|
|
41
15
|
# rubocop:disable Metrics/ClassLength
|
42
16
|
# rubocop:disable Metrics/AbcSize
|
@@ -324,7 +298,7 @@ module Utils
|
|
324
298
|
control.add_tag(::Inspec::Object::Tag.new('false_positives', json_control['tags']['false_positives'])) unless json_control['tags']['false_positives'].blank?
|
325
299
|
control.add_tag(::Inspec::Object::Tag.new('documentable', json_control['tags']['documentable'])) unless json_control['tags']['documentable'].blank?
|
326
300
|
control.add_tag(::Inspec::Object::Tag.new('mitigations', json_control['tags']['mitigations'])) unless json_control['tags']['mitigations'].blank?
|
327
|
-
control.add_tag(::Inspec::Object::Tag.new('severity_override_guidance', json_control['tags']['
|
301
|
+
control.add_tag(::Inspec::Object::Tag.new('severity_override_guidance', json_control['tags']['severity_override_guidance'])) unless json_control['tags']['severity_override_guidance'].blank?
|
328
302
|
control.add_tag(::Inspec::Object::Tag.new('potential_impacts', json_control['tags']['potential_impacts'])) unless json_control['tags']['potential_impacts'].blank?
|
329
303
|
control.add_tag(::Inspec::Object::Tag.new('third_party_tools', json_control['tags']['third_party_tools'])) unless json_control['tags']['third_party_tools'].blank?
|
330
304
|
control.add_tag(::Inspec::Object::Tag.new('mitigation_controls', json_control['tags']['mitigation_controls'])) unless json_control['tags']['mitigation_controls'].blank?
|
@@ -403,6 +377,7 @@ module Utils
|
|
403
377
|
controls.each do |control|
|
404
378
|
file_name = control.id.to_s
|
405
379
|
myfile = File.new("#{directory}/controls/#{file_name}.rb", 'w')
|
380
|
+
myfile.puts "# encoding: UTF-8\n\n"
|
406
381
|
myfile.puts wrap(control.to_ruby, WIDTH) + "\n"
|
407
382
|
myfile.close
|
408
383
|
end
|
@@ -418,6 +393,7 @@ module Utils
|
|
418
393
|
myfile = File.new("#{directory}/controls/controls.rb", 'w')
|
419
394
|
if output_format == 'ruby'
|
420
395
|
controls.each do |control|
|
396
|
+
myfile.puts "# encoding: UTF-8\n\n"
|
421
397
|
myfile.puts wrap(control.to_ruby, WIDTH) + "\n"
|
422
398
|
end
|
423
399
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Thew
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-04-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: colorize
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
requirements:
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: 4.18.100
|
37
37
|
- - "<"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '5.0'
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 4.18.100
|
47
47
|
- - "<"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '5.0'
|
@@ -145,6 +145,20 @@ dependencies:
|
|
145
145
|
- - "~>"
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '1.0'
|
148
|
+
- !ruby/object:Gem::Dependency
|
149
|
+
name: git-lite-version-bump
|
150
|
+
requirement: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0.17'
|
155
|
+
type: :runtime
|
156
|
+
prerelease: false
|
157
|
+
version_requirements: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0.17'
|
148
162
|
- !ruby/object:Gem::Dependency
|
149
163
|
name: bundler
|
150
164
|
requirement: !ruby/object:Gem::Requirement
|
@@ -309,6 +323,11 @@ files:
|
|
309
323
|
- lib/inspec_tools/xccdf.rb
|
310
324
|
- lib/inspec_tools/xlsx.rb
|
311
325
|
- lib/inspec_tools_plugin.rb
|
326
|
+
- lib/overrides/false_class.rb
|
327
|
+
- lib/overrides/nil_class.rb
|
328
|
+
- lib/overrides/object.rb
|
329
|
+
- lib/overrides/string.rb
|
330
|
+
- lib/overrides/true_class.rb
|
312
331
|
- lib/utilities/csv_util.rb
|
313
332
|
- lib/utilities/extract_nist_cis_mapping.rb
|
314
333
|
- lib/utilities/extract_pdf_text.rb
|
@@ -334,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
353
|
- !ruby/object:Gem::Version
|
335
354
|
version: '0'
|
336
355
|
requirements: []
|
337
|
-
rubygems_version: 3.
|
356
|
+
rubygems_version: 3.1.2
|
338
357
|
signing_key:
|
339
358
|
specification_version: 4
|
340
359
|
summary: Converter utils for Inspec
|