Skip to content

Commit

Permalink
fix oscal bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
northdpole committed Jul 15, 2023
1 parent d5fccbd commit ede2b99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions application/utils/external_project_parsers/pci_dss.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 8 additions & 3 deletions application/utils/oscal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit ede2b99

Please sign in to comment.