Module: CemSpecHelper::GeneralSpec
- Defined in:
- lib/cem_spec_helper.rb
Instance Method Summary collapse
-
#cis_control_id_type(id) ⇒ Symbol
The type of control ID used in the CIS mapping data, resource data, or control configs.
-
#control_id_type(id, framework = nil) ⇒ Symbol
The type of control ID used in the mapping data, resource data, or control configs.
-
#stig_control_id_type(id) ⇒ Symbol
The type of control ID used in the STIG mapping data, resource data, or control configs.
Instance Method Details
#cis_control_id_type(id) ⇒ Symbol
The type of control ID used in the CIS mapping data, resource data, or control configs.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cem_spec_helper.rb', line 46 def cis_control_id_type(id) case id when /^([0-9]\.)+/ :number when /^[A-Za-z0-9_]+$/ :hiera_title when /^c[0-9_]+$/ :hiera_title_num else :title end end |
#control_id_type(id, framework = nil) ⇒ Symbol
The type of control ID used in the mapping data, resource data, or control configs.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cem_spec_helper.rb', line 31 def control_id_type(id, framework = nil) case framework when 'cis' cis_control_id_type(id) when 'stig' stig_control_id_type(id) else # stig_control_id_type can return nil, cis_control_id_type will return 'title' stig_control_id_type(id) || cis_control_id_type(id) end end |
#stig_control_id_type(id) ⇒ Symbol
The type of control ID used in the STIG mapping data, resource data, or control configs.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/cem_spec_helper.rb', line 62 def stig_control_id_type(id) case id when /^V-\d{6}$/ :vulnid when /^SV-\d{6}r\d{6}_rule$/ :ruleid else nil end end |