diff --git a/application/utils/external_project_parsers/pci_dss.py b/application/utils/external_project_parsers/pci_dss.py index 9d602cc67..5fc4ff1da 100644 --- a/application/utils/external_project_parsers/pci_dss.py +++ b/application/utils/external_project_parsers/pci_dss.py @@ -31,11 +31,11 @@ def __parse( "([CUSTOMIZED APPROACH OBJECTIVE]:.*)", "", str(row.get(standard_to_spreadsheet_mappings["section"], "")), - ), - sectionID=str(row.get(standard_to_spreadsheet_mappings["sectionID"], "")), + ).strip(), + sectionID=str(row.get(standard_to_spreadsheet_mappings["sectionID"], "")).strip(), description=str( row.get(standard_to_spreadsheet_mappings["description"], "") - ), + ).strip() , version=version, ) existing = cache.get_nodes( diff --git a/application/utils/oscal_utils.py b/application/utils/oscal_utils.py index 713ded463..81606f837 100644 --- a/application/utils/oscal_utils.py +++ b/application/utils/oscal_utils.py @@ -37,7 +37,7 @@ def document_to_oscal( oscal_version="1.0.0", version=version, links=[common.Link(href=hyperlink)], - remarks=document.description, + remarks=document.description.strip(), ) else: m = common.Metadata( @@ -96,17 +96,22 @@ def list_to_oscal(documents: List[defs.Standard | defs.Tool]) -> str: if documents[0].doctype == defs.Credoctypes.Standard: for doc in documents: + props = [] + + if doc.section: + props.append(common.Property(name="section", value="".join(doc.section.splitlines()).strip())) + if doc.sectionID: + props.append(common.Property(name="sectionID",value="".join(doc.section.splitlines()).strip())) controls.append( catalog.Control( id=f"_{random.getrandbits(1024)}", title=doc.name, - props=[common.Property(name="section", value=doc.section)], + props=props, links=[common.Link(href=doc.hyperlink)], ) ) elif documents[0].doctype == defs.Credoctypes.Tool: for doc in documents: - from pprint import pprint controls.append( catalog.Control(