Closed rlakey closed 3 years ago
FYI i updated my from_inspec.rb with the new code in the pull request i linked and got it to work.
https://github.com/mitre/inspec_tools/pull/226/commits/897c315ad086ec429c2945d2dbe94897f8188ae2
if control.key?('descriptions') # new (post-2020) inspec output places check, fix, and rationale fields in a descriptions block
c_data[c_id]['check'] = control['descriptions']['check'] || DATA_NOT_FOUND_MESSAGE
c_data[c_id]['fix'] = control['descriptions']['fix'] || DATA_NOT_FOUND_MESSAGE
c_data[c_id]['rationale'] = control['descriptions']['rationale'] || DATA_NOT_FOUND_MESSAGE
else # old inspec output places check, fix, and rationale in the tags block
c_data[c_id]['check'] = control['tags']['check'] || DATA_NOT_FOUND_MESSAGE
c_data[c_id]['fix'] = control['tags']['fix'] || DATA_NOT_FOUND_MESSAGE
c_data[c_id]['rationale'] = control['tags']['rationale'] || DATA_NOT_FOUND_MESSAGE
end
This code also worked for me too. This was ran on windows too.
# new (post-2020) inspec output places check, fix, and rationale fields in a descriptions block
if control['descriptions'].is_a?(Hash) && control['descriptions'].key?('check') && control['descriptions'].key?('fix') && control['descriptions'].key?('rationale')
c_data[c_id]['check'] = control['descriptions']['check'] || DATA_NOT_FOUND_MESSAGE
c_data[c_id]['fix'] = control['descriptions']['fix'] || DATA_NOT_FOUND_MESSAGE
c_data[c_id]['rationale'] = control['descriptions']['rationale'] || DATA_NOT_FOUND_MESSAGE
else
c_data[c_id]['check'] = control['tags']['check'] || DATA_NOT_FOUND_MESSAGE
c_data[c_id]['fix'] = control['tags']['fix'] || DATA_NOT_FOUND_MESSAGE
c_data[c_id]['rationale'] = control['tags']['rationale'] || DATA_NOT_FOUND_MESSAGE
end
inspec2xccdf looks to only support the older tag check/fix syntax and not the newer desc 'check' or 'fix' syntax. This results in check/fix text being N/A in the resulting xccdf for these newer profiles.
csv2inspec and xccdf2inspec create profiles in this newer format.
New syntax example:
Old syntax example:
Result in STIG viewer: