Skip to content

Commit

Permalink
Revert crypto PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
8R0WNI3 committed Dec 12, 2024
1 parent f218bf2 commit 1651613
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 111 deletions.
9 changes: 0 additions & 9 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,12 +370,6 @@ const ComplianceCell = ({
timestamp={lastScanTimestampStr(lastBdbaScan)}
/>
}
{
artefact.kind === ARTEFACT_KIND.RESOURCE && <CryptoAssetsChip
cryptoAssets={cryptoAssets}
timestamp={lastScanTimestampStr(lastCryptoScan)}
/>
}
{
artefact.kind === ARTEFACT_KIND.RESOURCE && <MalwareFindingCell
ocmNodes={ocmNodes}
Expand Down
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
10 changes: 0 additions & 10 deletions src/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,6 @@ export const PACKAGES = {
Object.freeze(PACKAGES)


export const CRYPTO_ASSET_TYPES = {
ALGORITHM: 'algorithm',
CERTIFICATE: 'certificate',
LIBRARY: 'library',
PROTOCOL: 'protocol',
RELATED_CRYPTO_MATERIAL: 'related-crypto-material',
}
Object.freeze(CRYPTO_ASSET_TYPES)


export const USER_IDENTITIES = {
EMAIL_ADDRESS: 'emailAddress',
GITHUB_USER: 'githubUser',
Expand Down
34 changes: 1 addition & 33 deletions src/ocm/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'
import ReportProblemIcon from '@mui/icons-material/ReportProblem'
import ReportProblemOutlinedIcon from '@mui/icons-material/ReportProblemOutlined'

import { CRYPTO_ASSET_TYPES, SEVERITIES } from '../consts'
import { SEVERITIES } from '../consts'
import {
artefactMetadataSeverityComparator,
artefactMetadatumSeverity,
Expand Down Expand Up @@ -74,7 +74,6 @@ const artefactMetadataTypes = {
FINDING_MALWARE: 'finding/malware',
OS_IDS: 'os_ids',
CODECHECKS_AGGREGATED: 'codechecks/aggregated',
CRYPTO_ASSET: 'crypto_asset',
RESCORINGS: 'rescorings',
}
Object.freeze(artefactMetadataTypes)
Expand All @@ -84,7 +83,6 @@ const datasources = {
BDBA: 'bdba',
CLAMAV: 'clamav',
CC_UTILS: 'cc-utils',
CRYPTO: 'crypto',
}
Object.freeze(datasources)

Expand Down Expand Up @@ -122,30 +120,6 @@ const dataKey = ({type, data}) => {
if (type === artefactMetadataTypes.FINDING_MALWARE) return asKey({
props: [data.finding.content_digest, data.finding.filename, data.finding.malware],
})

if (type === CRYPTO_ASSET_TYPES.ALGORITHM) return asKey({
props: [data.primitive, data.parameter_set_identifier, data.curve, data.padding],
})

if (type === CRYPTO_ASSET_TYPES.CERTIFICATE) return asKey({
props: [data.subject_algorithm_ref, data.subject_public_key_ref],
})

if (type === CRYPTO_ASSET_TYPES.LIBRARY) return asKey({
props: [data.name, data.version],
})

if (type === CRYPTO_ASSET_TYPES.PROTOCOL) return asKey({
props: [data.type, data.version],
})

if (type === CRYPTO_ASSET_TYPES.RELATED_CRYPTO_MATERIAL) return asKey({
props: [data.type, data.algorithm_ref, data.size?.toString()],
})

if (type === artefactMetadataTypes.CRYPTO_ASSET) return asKey({
props: [data.asset_type, dataKey({type: data.asset_type, data: data.properties})],
})
}


Expand Down Expand Up @@ -355,12 +329,6 @@ const knownMetadataTypes = [
SpecificTypeHandler: MultilineTextViewer,
Icon: CoronavirusIcon
},
{
name: 'crypto_asset',
friendlyName: 'Crypto Asset',
SpecificTypeHandler: MultilineTextViewer,
Icon: ArticleIcon,
},
]


Expand Down

0 comments on commit 1651613

Please sign in to comment.