inspec_tools 2.3.2 → 2.3.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/lib/happy_mapper_tools/stig_attributes.rb +10 -1
- data/lib/inspec_tools/xccdf.rb +12 -3
- data/lib/utilities/inspec_util.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84cf060364796b3cfd7e3c758498a76379c743452b0ce119e19160b803e81ad8
|
4
|
+
data.tar.gz: dc01762be82174930cb3ba6b59ab02ec1541218ac2567c408f8338d1d6e83e60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a37d714accd3ea9a04d48f60864a5a1701c15f8a8b88072829c933e1f68be6a61af99b2c1d0c9d59ff830c0754adb165bc34c8925f53a2a90168bee783d8f4c5
|
7
|
+
data.tar.gz: feb725f4dd11cf0db94fa9dd7dbbd8108984f4308d5b266da380fa242da8191ea80fdea495c9a4af722630334a823a65da1c075a7a0756d4c35e6fc422a1d3df
|
@@ -77,6 +77,15 @@ module HappyMapperTools
|
|
77
77
|
element :dc_identifier, String, tag: 'identifier', namespace: 'dc'
|
78
78
|
end
|
79
79
|
|
80
|
+
class Ident
|
81
|
+
include HappyMapper
|
82
|
+
attr_accessor :legacy
|
83
|
+
attr_accessor :cci
|
84
|
+
tag 'ident'
|
85
|
+
attribute :system, String, tag: 'system'
|
86
|
+
content :ident, String
|
87
|
+
end
|
88
|
+
|
80
89
|
class Rule
|
81
90
|
include HappyMapper
|
82
91
|
tag 'Rule'
|
@@ -87,7 +96,7 @@ module HappyMapperTools
|
|
87
96
|
element :title, String, tag: 'title'
|
88
97
|
has_one :description, Description, tag: 'description'
|
89
98
|
element :reference, ReferenceInfo, tag: 'reference'
|
90
|
-
has_many :idents,
|
99
|
+
has_many :idents, Ident, tag: 'ident'
|
91
100
|
element :fixtext, String, tag: 'fixtext'
|
92
101
|
has_one :fix, Fix, tag: 'fix'
|
93
102
|
has_one :check, Check, tag: 'check'
|
data/lib/inspec_tools/xccdf.rb
CHANGED
@@ -17,7 +17,7 @@ module InspecTools
|
|
17
17
|
@xccdf = replace_tags_in_xccdf(replace_tags, @xccdf) unless replace_tags.nil?
|
18
18
|
cci_list_path = File.join(File.dirname(__FILE__), '../data/U_CCI_List.xml')
|
19
19
|
@cci_items = HappyMapperTools::CCIAttributes::CCI_List.parse(File.read(cci_list_path))
|
20
|
-
|
20
|
+
register_after_parse_callbacks
|
21
21
|
@benchmark = HappyMapperTools::StigAttributes::Benchmark.parse(@xccdf)
|
22
22
|
end
|
23
23
|
|
@@ -89,6 +89,14 @@ module InspecTools
|
|
89
89
|
|
90
90
|
private
|
91
91
|
|
92
|
+
def register_after_parse_callbacks
|
93
|
+
# Determine if the parsed Ident is refrencing a legacy ID number.
|
94
|
+
HappyMapperTools::StigAttributes::Ident.after_parse do |object|
|
95
|
+
object.cci = object.system.eql?('http://cyber.mil/cci')
|
96
|
+
object.legacy = !object.cci
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
92
100
|
def replace_tags_in_xccdf(replace_tags, xccdf_xml)
|
93
101
|
replace_tags.each do |tag|
|
94
102
|
xccdf_xml = xccdf_xml.gsub(/(<|<)#{tag}(>|>)/, "$#{tag}")
|
@@ -133,8 +141,9 @@ module InspecTools
|
|
133
141
|
control['tags']['rid'] = group.rule.id
|
134
142
|
control['tags']['stig_id'] = group.rule.version
|
135
143
|
control['tags']['fix_id'] = group.rule.fix.id
|
136
|
-
control['tags']['cci'] = group.rule.idents
|
137
|
-
control['tags']['
|
144
|
+
control['tags']['cci'] = group.rule.idents.select { |i| i.cci }.map { |i| i.ident }
|
145
|
+
control['tags']['legacy'] = group.rule.idents.select { |i| i.legacy}.map { |i| i.ident }
|
146
|
+
control['tags']['nist'] = @cci_items.fetch_nists(control['tags']['cci'])
|
138
147
|
control['tags']['false_negatives'] = group.rule.description.false_negatives if group.rule.description.false_negatives != ''
|
139
148
|
control['tags']['false_positives'] = group.rule.description.false_positives if group.rule.description.false_positives != ''
|
140
149
|
control['tags']['documentable'] = group.rule.description.documentable if group.rule.description.documentable != ''
|
@@ -246,6 +246,7 @@ module Utils
|
|
246
246
|
control.add_tag(::Inspec::Object::Tag.new('stig_id', json_control['tags']['stig_id']))
|
247
247
|
control.add_tag(::Inspec::Object::Tag.new('fix_id', json_control['tags']['fix_id']))
|
248
248
|
control.add_tag(::Inspec::Object::Tag.new('cci', json_control['tags']['cci']))
|
249
|
+
control.add_tag(::Inspec::Object::Tag.new('legacy', json_control['tags']['legacy']))
|
249
250
|
control.add_tag(::Inspec::Object::Tag.new('nist', json_control['tags']['nist']))
|
250
251
|
control.add_tag(::Inspec::Object::Tag.new('cis_level', json_control['tags']['cis_level'])) unless json_control['tags']['cis_level'].blank?
|
251
252
|
control.add_tag(::Inspec::Object::Tag.new('cis_controls', json_control['tags']['cis_controls'])) unless json_control['tags']['cis_controls'].blank?
|
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: 2.3.
|
4
|
+
version: 2.3.3
|
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: 2021-
|
14
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: colorize
|
@@ -358,7 +358,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
358
358
|
- !ruby/object:Gem::Version
|
359
359
|
version: '0'
|
360
360
|
requirements: []
|
361
|
-
rubygems_version: 3.
|
361
|
+
rubygems_version: 3.2.3
|
362
362
|
signing_key:
|
363
363
|
specification_version: 4
|
364
364
|
summary: Converter utils for Inspec
|