inspec_tools 2.3.7 → 2.3.8
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 +30 -30
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6f754f4816775d8bb360ed2ce768b1f4a443f647a440a1fe04a371388af6fe0
|
4
|
+
data.tar.gz: d31e79fb1477ab0b9fed85df8847f59f487d1ca5dc0bfc369e201dd2e0b87ba8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f4fe6b5f733d4654d179e0bbe651276afa3ccfff6527e6088f50c13da23324b1be9c6b695cad464895f13e53b442dd674d546c826b31632def647b73d50d26e
|
7
|
+
data.tar.gz: bee2b9f2a53efa941413308ea6eaeb340493c8d581b07a4d348094ba1278c4177fd3de7ee6575226896d41d0156bf6eaf0934a5f0eb597956c1b4c5ff2c07c67
|
@@ -158,12 +158,13 @@ module HappyMapperTools
|
|
158
158
|
|
159
159
|
def apply(value)
|
160
160
|
value = value.gsub('&', 'and')
|
161
|
-
|
161
|
+
value = value.gsub('"<"', 'less than (converted less than)')
|
162
|
+
DescriptionDetails.parse("<Details>#{value}</Details>")
|
162
163
|
rescue Nokogiri::XML::SyntaxError => e
|
163
|
-
if
|
164
|
-
|
164
|
+
if report_disallowed_tags(value) # if there was a bad tag
|
165
|
+
exit(1)
|
165
166
|
else
|
166
|
-
|
167
|
+
report_error(value, e)
|
167
168
|
end
|
168
169
|
end
|
169
170
|
|
@@ -173,7 +174,7 @@ module HappyMapperTools
|
|
173
174
|
|
174
175
|
private
|
175
176
|
|
176
|
-
def
|
177
|
+
def report_error(value, error)
|
177
178
|
puts error.to_s.colorize(:red)
|
178
179
|
column = error.column - '<Details>'.length - 2
|
179
180
|
puts "Error around #{value[column-10..column+10].colorize(:light_yellow)}"
|
@@ -184,39 +185,38 @@ module HappyMapperTools
|
|
184
185
|
allowed_tags = %w{VulnDiscussion FalsePositives FalseNegatives Documentable
|
185
186
|
Mitigations SeverityOverrideGuidance PotentialImpacts
|
186
187
|
PotentialImpacts ThirdPartyTools MitigationControl
|
187
|
-
Responsibility IAControl SecurityOverrideGuidance}
|
188
|
+
Responsibility IAControl IAControls SecurityOverrideGuidance}
|
188
189
|
|
189
190
|
tags_found = value.scan(%r{(?<=<)([^\/]*?)((?= \/>)|(?=>))}).to_a
|
190
191
|
|
191
192
|
tags_found = tags_found.uniq.flatten.reject!(&:empty?)
|
192
193
|
offending_tags = tags_found - allowed_tags
|
193
194
|
|
194
|
-
|
195
|
-
puts "\n\nThe non-standard
|
195
|
+
unless offending_tags.count.zero?
|
196
|
+
puts "\n\nThe non-standard tag(s): #{offending_tags.to_s.colorize(:red)}" \
|
196
197
|
' were found in: ' + "\n\n#{value}"
|
197
|
-
|
198
|
-
|
199
|
-
|
198
|
+
puts "\n\nPlease:\n "
|
199
|
+
option_one = '(1) ' + '(best)'.colorize(:green) + ' Use the ' +
|
200
|
+
'`-r --replace-tags array` '.colorize(:light_yellow) +
|
201
|
+
'(case sensitive) option to replace the offending tags ' \
|
202
|
+
'during processing of the XCCDF ' \
|
203
|
+
'file to use the ' +
|
204
|
+
"`$#{offending_tags[0]}` ".colorize(:light_green) +
|
205
|
+
'syntax in your InSpec profile.'
|
206
|
+
option_two = '(2) Update your XCCDF file to *not use* non-standard XCCDF ' \
|
207
|
+
'elements within ' +
|
208
|
+
'`<`,`>`, `<` '.colorize(:red) +
|
209
|
+
'or '.colorize(:default) +
|
210
|
+
'`>` '.colorize(:red) +
|
211
|
+
'as "placeholders", and use something that doesn\'t confuse ' \
|
212
|
+
'the XML parser, such as : ' +
|
213
|
+
"`$#{offending_tags[0]}`".colorize(:light_green)
|
214
|
+
puts option_one
|
215
|
+
puts "\n"
|
216
|
+
puts option_two
|
217
|
+
return true
|
200
218
|
end
|
201
|
-
|
202
|
-
option_one = '(1) ' + '(best)'.colorize(:green) + ' Use the ' +
|
203
|
-
'`-r --replace-tags array` '.colorize(:light_yellow) +
|
204
|
-
'(case sensitive) option to replace the offending tags ' \
|
205
|
-
'during processing of the XCCDF ' \
|
206
|
-
'file to use the ' +
|
207
|
-
"`$#{offending_tags[0]}` ".colorize(:light_green) +
|
208
|
-
'syntax in your InSpec profile.'
|
209
|
-
option_two = '(2) Update your XCCDF file to *not use* non-standard XCCDF ' \
|
210
|
-
'elements within ' +
|
211
|
-
'`<`,`>`, `<` '.colorize(:red) +
|
212
|
-
'or '.colorize(:default) +
|
213
|
-
'`>` '.colorize(:red) +
|
214
|
-
'as "placeholders", and use something that doesn\'t confuse ' \
|
215
|
-
'the XML parser, such as : ' +
|
216
|
-
"`$#{offending_tags[0]}`".colorize(:light_green)
|
217
|
-
puts option_one
|
218
|
-
puts "\n"
|
219
|
-
puts option_two
|
219
|
+
false
|
220
220
|
end
|
221
221
|
end
|
222
222
|
HappyMapper::SupportedTypes.register DescriptionDetailsType
|
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.8
|
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-07-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: colorize
|