Skip to content

Commit 8d4be63

Browse files
committed
feat: add util for cve url
1 parent 5df22a4 commit 8d4be63

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Shared/Components/Security/SecurityModal/config/CodeScan.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
TablePropsType,
3333
} from '../types'
3434
import { OpenDetailViewButton } from '../components'
35+
import { getCVEUrlFromCVEName } from '../../utils'
3536

3637
export const getCodeScanVulnerabilities = (data: CodeScan['vulnerability']) => ({
3738
headers: [
@@ -57,7 +58,7 @@ export const getCodeScanVulnerabilities = (data: CodeScan['vulnerability']) => (
5758
/* FIXME: which ones should be linked and which ones should not? */
5859
component: (
5960
<a
60-
href={`https://cve.mitre.org/cgi-bin/cvename.cgi?name=${element.cveId}`}
61+
href={getCVEUrlFromCVEName(element.cveId)}
6162
rel="noopener noreferrer"
6263
target="_blank"
6364
data-testid="security-vulnerability-detail--cve-id"

src/Shared/Components/Security/utils.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ export const getSeverityCountFromSummary = (
2020
low: scanResultSeverities?.LOW || 0,
2121
unknown: scanResultSeverities?.UNKNOWN || 0,
2222
})
23+
24+
export const getCVEUrlFromCVEName = (cveName: string): string =>
25+
`https://cve.mitre.org/cgi-bin/cvename.cgi?name=${cveName}`

0 commit comments

Comments
 (0)