Skip to content

Commit

Permalink
Merge branch 'develop' into feat/nist_mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
fsuits authored Mar 20, 2023
2 parents 6769f7a + 138e95f commit 1d466b9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions trestle/core/commands/author/ssp.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,11 @@ def _merge_imp_req_into_ssp(
ssp.control_implementation.implemented_requirements.append(new_imp_req)

def _merge_comp_defs(
self, ssp: ossp.SystemSecurityPlan, comp_dict: Dict[str, generic.GenericComponent], context: ControlContext
self,
ssp: ossp.SystemSecurityPlan,
comp_dict: Dict[str, generic.GenericComponent],
context: ControlContext,
catalog_interface: CatalogInterface
) -> None:
"""Merge the original generic comp defs into the ssp."""
all_comps: List[ossp.SystemComponent] = []
Expand All @@ -372,6 +376,10 @@ def _merge_comp_defs(
for sp in as_list(ci.set_parameters):
set_params.append(sp.to_ssp())
for imp_req in as_list(ci.implemented_requirements):
# ignore any controls not in the ssp profile (resolved catalog)
if not catalog_interface.get_control(imp_req.control_id):
logger.debug(f'Ignoring imp_req for control {imp_req.control_id} not in ssp profile')
continue
if new_ssp:
SSPAssemble._add_imp_req_to_ssp(ssp, gen_comp, imp_req, set_params, context)
else:
Expand Down Expand Up @@ -485,7 +493,7 @@ def _run(self, args: argparse.Namespace) -> int:
raise TrestleError('Original ssp has no system component.')
comp_dict[const.SSP_MAIN_COMP_NAME] = sys_comp

self._merge_comp_defs(ssp, comp_dict, context)
self._merge_comp_defs(ssp, comp_dict, context, catalog_interface)
CatalogReader.read_ssp_md_content(md_path, ssp, comp_dict, part_id_map_by_label, context)

new_file_content_type = FileContentType.path_to_content_type(orig_ssp_path)
Expand All @@ -495,7 +503,7 @@ def _run(self, args: argparse.Namespace) -> int:
ssp.control_implementation.implemented_requirements = []
ssp.control_implementation.description = const.SSP_SYSTEM_CONTROL_IMPLEMENTATION_TEXT
ssp.system_implementation.components = []
self._merge_comp_defs(ssp, comp_dict, context)
self._merge_comp_defs(ssp, comp_dict, context, catalog_interface)
CatalogReader.read_ssp_md_content(md_path, ssp, comp_dict, part_id_map_by_label, context)

import_profile: ossp.ImportProfile = gens.generate_sample_model(ossp.ImportProfile)
Expand Down

0 comments on commit 1d466b9

Please sign in to comment.