-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use mapping for security cards keys
- Loading branch information
1 parent
7161915
commit db86e02
Showing
9 changed files
with
119 additions
and
96 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 4 additions & 12 deletions
16
src/Shared/Components/Security/SecurityDetailsCards/types.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { CATEGORIES, SUB_CATEGORIES } from './SecurityModal/types' | ||
|
||
export type ScanCategories = (typeof CATEGORIES)[keyof typeof CATEGORIES] | ||
export type ScanSubCategories = (typeof SUB_CATEGORIES)[keyof typeof SUB_CATEGORIES] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
import { ScanResultDTO, SeveritiesDTO } from './SecurityModal' | ||
|
||
export const getCVEUrlFromCVEName = (cveName: string): string => | ||
`https://cve.mitre.org/cgi-bin/cvename.cgi?name=${cveName}` | ||
|
||
export const getTotalSeverities = (severityCount: Partial<Record<SeveritiesDTO, number>>) => | ||
Object.entries(severityCount) | ||
.filter(([key]) => key !== SeveritiesDTO.SUCCESSES) | ||
.reduce((acc, [, value]) => acc + value, 0) | ||
|
||
export const getSecurityThreatsArray = (scanResult: ScanResultDTO): Partial<Record<SeveritiesDTO, number>>[] => { | ||
const { imageScan, codeScan, kubernetesManifest } = scanResult | ||
return [ | ||
imageScan?.vulnerability?.summary?.severities || {}, | ||
imageScan?.license?.summary?.severities || {}, | ||
codeScan?.vulnerability?.summary.severities || {}, | ||
codeScan?.license?.summary?.severities || {}, | ||
codeScan?.misConfigurations?.misConfSummary?.status || {}, | ||
codeScan?.exposedSecrets?.summary?.severities || {}, | ||
kubernetesManifest?.misConfigurations?.misConfSummary?.status || {}, | ||
kubernetesManifest?.exposedSecrets?.summary?.severities || {}, | ||
] | ||
} |