Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert crypto PoC #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/compliance/Compliance.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ const TypeFilter = ({
artefactMetadataTypes.LICENSE,
artefactMetadataTypes.VULNERABILITY,
artefactMetadataTypes.FINDING_MALWARE,
artefactMetadataTypes.FINDING_FIPS,
]

return <FormControl variant='standard' fullWidth>
Expand Down
98 changes: 0 additions & 98 deletions src/components/dependencies/ComplianceCells.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore'
import {
evaluateResourceBranch,
GolangChip,
CryptoAssetsChip,
IssueChip,
} from './ComplianceChips'
import {
Expand Down Expand Up @@ -339,11 +338,9 @@ const ComplianceCell = ({
const structureInfos = complianceFiltered?.filter((d) => d.meta.type === artefactMetadataTypes.STRUCTURE_INFO)
const osData = complianceFiltered?.find((d) => d.meta.type === artefactMetadataTypes.OS_IDS)
const codecheckData = complianceFiltered?.find((d) => d.meta.type === artefactMetadataTypes.CODECHECKS_AGGREGATED)
const cryptoAssets = complianceFiltered?.filter((d) => d.meta.type === artefactMetadataTypes.CRYPTO_ASSET)

const lastBdbaScan = findLastScan(complianceFiltered, datasources.BDBA)
const lastMalwareScan = findLastScan(complianceFiltered, datasources.CLAMAV)
const lastCryptoScan = findLastScan(complianceFiltered, datasources.CRYPTO)

return <TableCell>
<Grid container direction='row-reverse' spacing={1}>
Expand Down Expand Up @@ -373,23 +370,6 @@ const ComplianceCell = ({
timestamp={lastScanTimestampStr(lastBdbaScan)}
/>
}
{
artefact.kind === ARTEFACT_KIND.RESOURCE && <CryptoAssetsChip
cryptoAssets={cryptoAssets}
timestamp={lastScanTimestampStr(lastCryptoScan)}
/>
}
{
artefact.kind === ARTEFACT_KIND.RESOURCE && lastCryptoScan && <FipsFindingCell
ocmNodes={ocmNodes}
ocmRepo={ocmRepo}
metadataTypedef={findTypedefByName({name: artefactMetadataTypes.FINDING_FIPS})}
fetchComplianceSummary={fetchComplianceSummary}
lastScan={lastCryptoScan}
severity={getMaxSeverity(artefactMetadataTypes.FINDING_FIPS)}
isLoading={state.isLoading}
/>
}
{
artefact.kind === ARTEFACT_KIND.RESOURCE && <MalwareFindingCell
ocmNodes={ocmNodes}
Expand Down Expand Up @@ -882,82 +862,4 @@ BDBACell.propTypes = {
}


const FipsFindingCell = ({
ocmNodes,
ocmRepo,
metadataTypedef,
fetchComplianceSummary,
lastScan,
severity,
isLoading,
}) => {
const [mountRescoring, setMountRescoring] = React.useState(false)

const handleRescoringClose = () => {
setMountRescoring(false)
}

const title = metadataTypedef.friendlyName

return <Grid item onClick={(e) => e.stopPropagation()}>
{
mountRescoring && <RescoringModal
ocmNodes={ocmNodes}
ocmRepo={ocmRepo}
handleClose={handleRescoringClose}
fetchComplianceSummary={fetchComplianceSummary}
/>
}
<Tooltip
title={
<Stack>
<RescoringButton
setMountRescoring={setMountRescoring}
title='Rescoring'
/>
{
isLoading ? <Skeleton/> : <Typography variant='inherit'>
{
lastScanTimestampStr(lastScan)
}
</Typography>
}
</Stack>
}
>
{
lastScan || isLoading ? <Chip
color={severity.color}
label={severity.name === SEVERITIES.CLEAN
? `No ${title} Findings`
: `${title} ${capitalise(severity.name)}`
}
variant='outlined'
size='small'
icon={<UnfoldMoreIcon/>}
clickable={false}
/> : <Chip
color='default'
label={`No ${title} Scan`}
variant='outlined'
size='small'
icon={<UnfoldMoreIcon/>}
clickable={false}
/>
}
</Tooltip>
</Grid>
}
FipsFindingCell.displayName = 'FipsFindingCell'
FipsFindingCell.propTypes = {
ocmNodes: PropTypes.arrayOf(PropTypes.object).isRequired,
ocmRepo: PropTypes.string,
metadataTypedef: PropTypes.object.isRequired,
fetchComplianceSummary: PropTypes.func.isRequired,
lastScan: PropTypes.object,
severity: PropTypes.object.isRequired,
isLoading: PropTypes.bool.isRequired,
}


export { ComplianceCell, ArtefactCell, IconCell }
57 changes: 0 additions & 57 deletions src/components/dependencies/ComplianceChips.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { parseRelaxedSemver } from '../../osUtil'
import { findSeverityCfgByName } from '../../util'
import {
COMPLIANCE_TOOLS,
CRYPTO_ASSET_TYPES,
REPORTING_MINIMUM_SEVERITY,
SEVERITIES,
} from './../../consts'
Expand Down Expand Up @@ -309,61 +308,6 @@ GolangChip.propTypes = {
timestamp: PropTypes.string,
}


const CryptoAssetsChip = ({
cryptoAssets,
timestamp,
}) => {
if (!cryptoAssets?.length > 0) return null

const cryptoLibraries = cryptoAssets.filter((cryptoAsset) => {
return cryptoAsset.data.asset_type === CRYPTO_ASSET_TYPES.LIBRARY
}).map((cryptoAsset) => cryptoAsset.data.properties).sort((left, right) => {
return left.name === right.name
? left.version.localeCompare(right.version)
: left.name.localeCompare(right.name)
})

return <Tooltip
title={
<Stack direction='column' spacing={1}>
<Typography
variant='inherit'
sx={{
whiteSpace: 'pre-wrap',
maxWidth: 'none',
}}
>
{
cryptoLibraries.map((cryptoLibrary) => `${cryptoLibrary.name}:${cryptoLibrary.version}\n`)
}
</Typography>
<Divider/>
<Typography variant='inherit'>
{
timestamp
}
</Typography>
</Stack>
}
>
<Grid item>
<Chip
label='Crypto'
variant='outlined'
size='small'
color='default'
/>
</Grid>
</Tooltip>
}
CryptoAssetsChip.displayName = 'CryptoAssetsChip'
CryptoAssetsChip.propTypes = {
cryptoAssets: PropTypes.arrayOf(PropTypes.object),
timestamp: PropTypes.string,
}


const IssueChip = ({
ocmNodes,
component,
Expand Down Expand Up @@ -440,7 +384,6 @@ IssueChip.propTypes = {
export {
ComponentChip,
GolangChip,
CryptoAssetsChip,
IssueChip,
evaluateResourceBranch,
}
2 changes: 0 additions & 2 deletions src/components/dependencies/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,12 @@ const Artefacts = ({
artefactMetadataTypes.CODECHECKS_AGGREGATED,
artefactMetadataTypes.OS_IDS,
artefactMetadataTypes.STRUCTURE_INFO,
artefactMetadataTypes.CRYPTO_ASSET,
]
}, [
artefactMetadataTypes.ARTEFACT_SCAN_INFO,
artefactMetadataTypes.CODECHECKS_AGGREGATED,
artefactMetadataTypes.OS_IDS,
artefactMetadataTypes.STRUCTURE_INFO,
artefactMetadataTypes.CRYPTO_ASSET,
])

const params = React.useMemo(() => {
Expand Down
107 changes: 0 additions & 107 deletions src/components/dependencies/RescoringModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -1198,55 +1198,6 @@ MalwareExtraInfo.propTypes = {
}


const FipsExtraInfo = ({
locations,
properties,
}) => {
return <ExtraWideTooltip
title={
<div style={{ overflowY: 'auto', maxHeight: '15rem' }}>
<Typography
variant='inherit'
sx={{
fontWeight: 'bold',
}}
marginBottom='0.5rem'
>
Locations
</Typography>
<Typography variant='inherit' whiteSpace='pre-wrap'>
{
JSON.stringify(locations, null, 2)
}
</Typography>
<Divider/>
<Typography
variant='inherit'
sx={{
fontWeight: 'bold',
}}
marginBottom='0.5rem'
>
Properties
</Typography>
<Typography variant='inherit' whiteSpace='pre-wrap'>
{
JSON.stringify(properties, null, 2)
}
</Typography>
</div>
}
>
<InfoOutlinedIcon sx={{ height: '1rem' }}/>
</ExtraWideTooltip>
}
FipsExtraInfo.displayName = 'FipsExtraInfo'
FipsExtraInfo.propTypes = {
locations: PropTypes.arrayOf(PropTypes.string).isRequired,
properties: PropTypes.object.isRequired,
}


const Subject = ({
rescoring,
ocmNode,
Expand Down Expand Up @@ -1274,20 +1225,6 @@ const Subject = ({
<OcmNodeDetails ocmNode={ocmNode} ocmRepo={ocmRepo} iconProps={{ sx: { height: '1rem' } }}/>
</div>
</Stack>
} else if (rescoring.finding_type === artefactMetadataTypes.FINDING_FIPS) {
return <Stack>
<div style={{ display: 'flex', alignItems: 'center' }}>
<TruncatedTextWithTooltip
text={finding.asset.names.sort().join('\n')}
maxLength={24}
typographyProps={{
variant: 'inherit',
whiteSpace: 'pre-line',
}}
/>
<OcmNodeDetails ocmNode={ocmNode} ocmRepo={ocmRepo} iconProps={{ sx: { height: '1rem' } }}/>
</div>
</Stack>
}
}
Subject.displayName = 'Subject'
Expand Down Expand Up @@ -1394,36 +1331,6 @@ const Finding = ({
/>
</div>
</Stack>

} else if (rescoring.finding_type === artefactMetadataTypes.FINDING_FIPS) {
return <Stack spacing={0.5}>
<Tooltip
title={<div style={{ overflowY: 'auto', maxHeight: '15rem' }}>
{
finding.summary ?? 'No summary available'
}
</div>}
>
<Typography variant='inherit' marginRight='0.4rem'>
{
finding.asset.asset_type
}
</Typography>
</Tooltip>
<div style={{ display: 'flex' }}>
<Typography variant='inherit' marginRight='0.4rem'>Original:</Typography>
<Typography variant='inherit' color={`${findSeverityCfgByName({name: finding.severity}).color}.main`}>
{
finding.severity
}
</Typography>
<FipsExtraInfo
locations={finding.asset.locations}
properties={finding.asset.properties}
/>
</div>
</Stack>

} else if (rescoring.finding_type === artefactMetadataTypes.LICENSE) {
return <Stack spacing={0.5}>
<div style={{ display: 'flex' }}>
Expand Down Expand Up @@ -1863,24 +1770,13 @@ const RescoringContent = ({
[orderAttributes.TYPE]: rescoring.finding_type,
}

const fipsAccess = {
[orderAttributes.SUBJECT]: rescoring.finding.asset?.names.sort(),
[orderAttributes.FINDING]: `${rescoring.finding_type}_${rescoring.finding.asset?.asset_type}`,
[orderAttributes.SPRINT]: rescoring.sprint ? new Date(rescoring.sprint.end_date) : new Date(8640000000000000),
[orderAttributes.CURRENT]: findSeverityCfgByName({name: rescoringProposalSeverity(rescoring)}).value,
[orderAttributes.RESCORED]: findSeverityCfgByName({name: rescoring.severity}).value,
[orderAttributes.TYPE]: rescoring.finding_type,
}

if (
rescoringType === artefactMetadataTypes.VULNERABILITY
|| rescoringType === artefactMetadataTypes.LICENSE
) {
return bdbaAccesses[desired]
} else if (rescoringType === artefactMetadataTypes.FINDING_MALWARE) {
return malwareAccess[desired]
} else if (rescoringType === artefactMetadataTypes.FINDING_FIPS) {
return fipsAccess[desired]
}

}
Expand Down Expand Up @@ -2183,7 +2079,6 @@ const Rescoring = ({
artefactMetadataTypes.VULNERABILITY,
artefactMetadataTypes.LICENSE,
artefactMetadataTypes.FINDING_MALWARE,
artefactMetadataTypes.FINDING_FIPS,
],
scanConfigName: scanConfig?.name,
}),
Expand Down Expand Up @@ -2341,8 +2236,6 @@ const Rescore = ({
filename: rescoring.finding.filename,
malware: rescoring.finding.malware,
}
} else if (type === artefactMetadataTypes.FINDING_FIPS) {
return rescoring.finding.asset
}
}

Expand Down
Loading