diff --git a/application/frontend/src/components/DocumentNode/DocumentNode.tsx b/application/frontend/src/components/DocumentNode/DocumentNode.tsx index b9bbf1ba1..4968ae50e 100644 --- a/application/frontend/src/components/DocumentNode/DocumentNode.tsx +++ b/application/frontend/src/components/DocumentNode/DocumentNode.tsx @@ -3,12 +3,9 @@ import './documentNode.scss'; import axios from 'axios'; import React, { FunctionComponent, useContext, useEffect, useMemo, useState } from 'react'; import { Link, useHistory } from 'react-router-dom'; +import { Icon } from 'semantic-ui-react'; -import { - TYPE_CONTAINS, - TYPE_IS_PART_OF, - TYPE_RELATED, -} from '../../const'; +import { TYPE_CONTAINS, TYPE_IS_PART_OF, TYPE_RELATED } from '../../const'; import { useEnvironment } from '../../hooks'; import { applyFilters } from '../../hooks/applyFilters'; import { Document } from '../../types'; @@ -16,7 +13,6 @@ import { getDocumentDisplayName, groupLinksByType } from '../../utils'; import { getApiEndpoint, getDocumentTypeText, getInternalUrl } from '../../utils/document'; import { FilterButton } from '../FilterButton/FilterButton'; import { LoadingAndErrorIndicator } from '../LoadingAndErrorIndicator'; -import { Icon } from 'semantic-ui-react'; export interface DocumentNode { node: Document; @@ -107,9 +103,9 @@ export const DocumentNode: FunctionComponent = ({ } return ( - - - + + + ); }; const SimpleView = () => { @@ -118,7 +114,7 @@ export const DocumentNode: FunctionComponent = ({
- {getDocumentDisplayName(usedNode)} + {getDocumentDisplayName(usedNode)}
@@ -139,30 +135,34 @@ export const DocumentNode: FunctionComponent = ({ {expanded && getTopicsToDisplayOrderdByLinkType().map(([type, links], idx) => { - const sortedResults = links.sort((a, b) => getDocumentDisplayName(a.document).localeCompare(getDocumentDisplayName(b.document))) - let lastDocumentName = sortedResults[0].document.name + const sortedResults = links.sort((a, b) => + getDocumentDisplayName(a.document).localeCompare(getDocumentDisplayName(b.document)) + ); + let lastDocumentName = sortedResults[0].document.name; return (
- {idx > 0 &&
} + {idx > 0 &&
}
- Which {getDocumentTypeText(type, links[0].document.doctype)}:{/* Risk here of mixed doctype in here causing odd output */} + Which {getDocumentTypeText(type, links[0].document.doctype)}: + {/* Risk here of mixed doctype in here causing odd output */}
- {sortedResults.map((link, i) =>{const temp = ( -
- {lastDocumentName !== (link.document.name) &&} - - -
- ) - lastDocumentName = link.document.name - return temp; + {sortedResults.map((link, i) => { + const temp = ( +
+ {lastDocumentName !== link.document.name && } + + +
+ ); + lastDocumentName = link.document.name; + return temp; })}
diff --git a/application/frontend/src/pages/CommonRequirementEnumeration/CommonRequirementEnumeration.tsx b/application/frontend/src/pages/CommonRequirementEnumeration/CommonRequirementEnumeration.tsx index 5a796161e..77cde05a2 100644 --- a/application/frontend/src/pages/CommonRequirementEnumeration/CommonRequirementEnumeration.tsx +++ b/application/frontend/src/pages/CommonRequirementEnumeration/CommonRequirementEnumeration.tsx @@ -79,26 +79,30 @@ export const CommonRequirementEnumeration = () => {
{Object.keys(linksByType).length > 0 && Object.entries(linksByType).map(([type, links]) => { - const sortedResults = links.sort((a, b) => getDocumentDisplayName(a.document).localeCompare(getDocumentDisplayName(b.document))) - let lastDocumentName = sortedResults[0].document.name + const sortedResults = links.sort((a, b) => + getDocumentDisplayName(a.document).localeCompare(getDocumentDisplayName(b.document)) + ); + let lastDocumentName = sortedResults[0].document.name; return (
- Which {getDocumentTypeText(type, links[0].document.doctype)}:{/* Risk here of mixed doctype in here causing odd output */} + Which {getDocumentTypeText(type, links[0].document.doctype)}: + {/* Risk here of mixed doctype in here causing odd output */}
{sortedResults.map((link, i) => { const temp = (
- {lastDocumentName !== (link.document.name) && } + {lastDocumentName !== link.document.name && }
- ) - lastDocumentName = link.document.name - return temp + ); + lastDocumentName = link.document.name; + return temp; })}
- )})} + ); + })}
)} diff --git a/application/frontend/src/pages/Search/Search.tsx b/application/frontend/src/pages/Search/Search.tsx index 01f833485..61629cb53 100644 --- a/application/frontend/src/pages/Search/Search.tsx +++ b/application/frontend/src/pages/Search/Search.tsx @@ -17,8 +17,10 @@ export const Search = () => { Your gateway to security topics
- - + +
diff --git a/application/frontend/src/pages/Search/components/BodyText.tsx b/application/frontend/src/pages/Search/components/BodyText.tsx index 4bf878be1..573e247a0 100644 --- a/application/frontend/src/pages/Search/components/BodyText.tsx +++ b/application/frontend/src/pages/Search/components/BodyText.tsx @@ -51,8 +51,8 @@ export const SearchBody = () => {

OpenCRE currently links OWASP standards (Top 10, ASVS, Proactive Controls, Cheat sheets, Testing - guide, ZAP, SAMM), plus several other sources (CWE, CAPEC, NIST-800 53, NIST-800 63b, Cloud Control Matrix, - ISO27001, ISO27002, NIST SSDF, and PCI-DSS). + guide, ZAP, SAMM), plus several other sources (CWE, CAPEC, NIST-800 53, NIST-800 63b, Cloud Control + Matrix, ISO27001, ISO27002, NIST SSDF, and PCI-DSS).

Contact us via (rob.vanderveer [at] owasp.org) to join the movement. Currently, a stakeholder group is @@ -61,7 +61,11 @@ export const SearchBody = () => {

For more details, see this presentation video, read the - {' '}CRE explanation document{' '} or click the diagram below. + + {' '} + CRE explanation document{' '} + {' '} + or click the diagram below.

diff --git a/application/frontend/src/pages/Search/components/SearchBar.tsx b/application/frontend/src/pages/Search/components/SearchBar.tsx index aee389e51..42020f7c0 100644 --- a/application/frontend/src/pages/Search/components/SearchBar.tsx +++ b/application/frontend/src/pages/Search/components/SearchBar.tsx @@ -31,7 +31,6 @@ export const SearchBar = () => { } }; - return (
@@ -45,10 +44,12 @@ export const SearchBar = () => { term: e.target.value, }); }} - label={} + label={ + + } labelPosition="right" placeholder="Search..." /> diff --git a/application/frontend/src/pages/Search/components/SearchResults.tsx b/application/frontend/src/pages/Search/components/SearchResults.tsx index 8ba0352b7..acb7c80a1 100644 --- a/application/frontend/src/pages/Search/components/SearchResults.tsx +++ b/application/frontend/src/pages/Search/components/SearchResults.tsx @@ -1,26 +1,30 @@ +import { DOCUMENT_TYPES } from 'application/frontend/src/const'; +import { getDocumentDisplayName } from 'application/frontend/src/utils/document'; import React from 'react'; import { DocumentNode } from '../../../components/DocumentNode'; -import { getDocumentDisplayName } from 'application/frontend/src/utils/document'; -import { DOCUMENT_TYPES } from 'application/frontend/src/const'; export const SearchResults = ({ results }) => { if (results && results.length != 0) { - const sortedResults = results.sort((a, b) => getDocumentDisplayName(a).localeCompare(getDocumentDisplayName(b))) - let lastDocumentName = sortedResults[0].name + const sortedResults = results.sort((a, b) => + getDocumentDisplayName(a).localeCompare(getDocumentDisplayName(b)) + ); + let lastDocumentName = sortedResults[0].name; return ( <> - {sortedResults.map((document, i) => {let temp = ( - <> - {document.doctype != DOCUMENT_TYPES.TYPE_CRE && lastDocumentName !== document.name &&} -
- -
- - - ) - lastDocumentName = (document.id ?? document.name); - return temp + {sortedResults.map((document, i) => { + let temp = ( + <> + {document.doctype != DOCUMENT_TYPES.TYPE_CRE && lastDocumentName !== document.name && ( + + )} +
+ +
+ + ); + lastDocumentName = document.id ?? document.name; + return temp; })} ); diff --git a/application/frontend/src/pages/Standard/Standard.tsx b/application/frontend/src/pages/Standard/Standard.tsx index 34ab3fa95..53bb7b316 100644 --- a/application/frontend/src/pages/Standard/Standard.tsx +++ b/application/frontend/src/pages/Standard/Standard.tsx @@ -45,11 +45,13 @@ export const Standard = () => { {!loading && !error && - documents.sort((a, b) => getDocumentDisplayName(a).localeCompare(getDocumentDisplayName(b))).map((standard, i) => ( -
- -
- ))} + documents + .sort((a, b) => getDocumentDisplayName(a).localeCompare(getDocumentDisplayName(b))) + .map((standard, i) => ( +
+ +
+ ))} {data && data.total_pages > 0 && (
{ return ( <>
-
- {getDocumentDisplayName(document)} -
+
{getDocumentDisplayName(document)}
{document && document.hyperlink && ( <> Reference: @@ -76,13 +74,18 @@ export const StandardSection = () => { Object.entries(linksByType).map(([type, links]) => (
- Which {getDocumentTypeText(type, links[0].document.doctype)}:{/* Risk here of mixed doctype in here causing odd output */} + Which {getDocumentTypeText(type, links[0].document.doctype)}: + {/* Risk here of mixed doctype in here causing odd output */}
- {links.sort((a, b) => getDocumentDisplayName(a.document).localeCompare(getDocumentDisplayName(b.document))).map((link, i) => ( -
- -
- ))} + {links + .sort((a, b) => + getDocumentDisplayName(a.document).localeCompare(getDocumentDisplayName(b.document)) + ) + .map((link, i) => ( +
+ +
+ ))}
)) ) : ( diff --git a/application/frontend/src/utils/document.ts b/application/frontend/src/utils/document.ts index 3ce0d948b..71011fa4a 100644 --- a/application/frontend/src/utils/document.ts +++ b/application/frontend/src/utils/document.ts @@ -74,10 +74,9 @@ export const getApiEndpoint = (doc: Document, apiUrl: string): string => { }; export const getDocumentTypeText = (linkType, docType): string => { - let docText = DOCUMENT_TYPE_NAMES[linkType]; - if(linkType === TYPE_LINKED_TO && docType === DOCUMENT_TYPES.TYPE_CRE) - { + let docText = DOCUMENT_TYPE_NAMES[linkType]; + if (linkType === TYPE_LINKED_TO && docType === DOCUMENT_TYPES.TYPE_CRE) { docText = DOCUMENT_TYPE_NAMES[TYPE_IS_PART_OF]; } - return docText -} + return docText; +}; diff --git a/application/utils/external_project_parsers/pci_dss.py b/application/utils/external_project_parsers/pci_dss.py index 5fc4ff1da..12c9b7fe6 100644 --- a/application/utils/external_project_parsers/pci_dss.py +++ b/application/utils/external_project_parsers/pci_dss.py @@ -32,10 +32,12 @@ def __parse( "", str(row.get(standard_to_spreadsheet_mappings["section"], "")), ).strip(), - 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() , + ).strip(), version=version, ) existing = cache.get_nodes( diff --git a/application/utils/oscal_utils.py b/application/utils/oscal_utils.py index 81606f837..9f4228557 100644 --- a/application/utils/oscal_utils.py +++ b/application/utils/oscal_utils.py @@ -97,11 +97,20 @@ 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())) + 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())) + props.append( + common.Property( + name="sectionID", + value="".join(doc.section.splitlines()).strip(), + ) + ) controls.append( catalog.Control( id=f"_{random.getrandbits(1024)}", @@ -112,7 +121,6 @@ def list_to_oscal(documents: List[defs.Standard | defs.Tool]) -> str: ) elif documents[0].doctype == defs.Credoctypes.Tool: for doc in documents: - controls.append( catalog.Control( id=f"_{random.getrandbits(1024)}",