Skip to content
Draft
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: 1 addition & 0 deletions src/findings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { artefactMetadataFilter } from './ocm/util'
export const FINDING_TYPES = {
CRYPTO: 'finding/crypto',
DIKI: 'finding/diki',
FALCO: 'finding/falco',
LICENSE: 'finding/license',
MALWARE: 'finding/malware',
OSID: 'finding/osid',
Expand Down
4 changes: 4 additions & 0 deletions src/ocm/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ export const dataKey = ({type, data}) => {
if (type === FINDING_TYPES.OSID) return asKey({
props: [data.osid.ID],
})

if (type === FINDING_TYPES.FALCO) return asKey({
props: [data.finding.group_hash],
})
}


Expand Down
84 changes: 83 additions & 1 deletion src/rescoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,38 @@ CryptoExtraInfo.propTypes = {
}


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


const Subject = ({
rescoring,
ocmNode,
Expand Down Expand Up @@ -1256,7 +1288,31 @@ const Subject = ({
<OcmNodeDetails ocmNode={ocmNode} ocmRepo={ocmRepo} iconProps={{ sx: { height: '1rem' } }}/>
</div>
</Stack>

} else if (rescoring.finding_type === FINDING_TYPES.FALCO) {
return <Stack>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div>
<Typography variant='inherit'>
{
finding.finding.landscape
}
</Typography>
<Typography variant='inherit' marginRight='0.4rem'>
{
`Project: ${finding.finding.project}`
}
</Typography>
<Typography variant='inherit'>Clusters:</Typography>
{
finding.finding.clusters.map((cluster, idx) => <Typography key={idx} variant='inherit'>
{
`- ${cluster.name}`
}
</Typography>)
}
</div>
</div>
</Stack>
}
}
Subject.displayName = 'Subject'
Expand Down Expand Up @@ -1460,6 +1516,15 @@ const Finding = ({
</div>
<Typography variant='inherit' marginRight='0.4rem'>{finding.osid.VERSION_ID} → {finding.greatest_version}</Typography>
</Stack>
} else if (rescoring.finding_type === FINDING_TYPES.FALCO) {
return <div style={{ display: 'flex' }}>
<Typography variant='inherit' marginRight='0.4rem'>
{
`Rule: ${finding.finding.rule}`
}
</Typography>
<FalcoExtraInfo finding={finding.finding}/>
</div>
}
}
Finding.displayName = 'Finding'
Expand Down Expand Up @@ -1922,6 +1987,17 @@ const RescoringContent = ({
}).value,
}

const falcoAccess = {
[orderAttributes.SUBJECT]: rescoring.finding.finding?.landscape,
[orderAttributes.FINDING]: rescoring.finding.finding?.rule,
[orderAttributes.SPRINT]: rescoring.sprint ? new Date(rescoring.sprint.end_date) : new Date(8640000000000000),
[orderAttributes.CURRENT]: categoriseRescoringProposal({rescoring, findingCfg}).value,
[orderAttributes.RESCORED]: findCategorisationById({
id: rescoring.severity,
findingCfg: findingCfg,
}).value,
}

if (
rescoringType === FINDING_TYPES.VULNERABILITY
|| rescoringType === FINDING_TYPES.LICENSE
Expand All @@ -1933,6 +2009,8 @@ const RescoringContent = ({
return sastAccesses[desired]
} else if (rescoringType === FINDING_TYPES.CRYPTO) {
return cryptoAccess[desired]
} else if (rescoringType === FINDING_TYPES.FALCO) {
return falcoAccess[desired]
}

}
Expand Down Expand Up @@ -2372,6 +2450,10 @@ const Rescore = ({
return {
osid: rescoring.finding.osid,
}
} else if (type === FINDING_TYPES.FALCO) {
return {
group_hash: rescoring.finding.finding.group_hash,
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ export const filterRescoringsForFinding = (finding, rescorings) => {
rescoring.data.finding.license.name !== finding.data.license.name
|| rescoring.data.finding.package_name !== finding.data.package_name
) return false
} else if (finding.meta.type === FINDING_TYPES.MALWARE) {
// `malware` has a little special handling here because its findings contain a
// sub-property `finding` whereas its rescoring does not contain this sub-property anymore
} else if ([FINDING_TYPES.MALWARE, FINDING_TYPES.FALCO].includes(finding.meta.type)) {
// `malware` and `falco` have a little special handling here because their findings contain a
// sub-property `finding` whereas their rescoring does not contain this sub-property anymore
if (
dataKey({type: finding.meta.type, data: rescoring.data})
!== dataKey({type: finding.meta.type, data: finding.data})
Expand Down