Module: AbideDevUtils::CEM::Mapping::MixinCIS

Defined in:
lib/abide_dev_utils/cem/mapping/mapper.rb

Overview

Mixin module used by Mapper to implement CIS-specific mapping behavior

Instance Method Summary collapse

Instance Method Details

#get_map(control_id, level: nil, profile: nil, **_) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/abide_dev_utils/cem/mapping/mapper.rb', line 118

def get_map(control_id, level: nil, profile: nil, **_)
  mtype, mtop = map_type_and_top_key(control_id)
  return if mtype == 'vulnid'

  return map_data[mtype][mtop][level][profile][control_id] unless level.nil? || profile.nil?

  map_data[mtype][mtop].each do |lvl, profile_hash|
    next if lvl == 'benchmark'

    profile_hash.each do |prof, control_hash|
      return map_data[mtype][mtop][lvl][prof][control_id] if control_hash.key?(control_id)
    end
  end
end