-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vulns.tsx
137 lines (126 loc) · 6.06 KB
/
Vulns.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import Accordion from '@mui/material/Accordion';
import AccordionDetails from '@mui/material/AccordionDetails';
import AccordionSummary from '@mui/material/AccordionSummary';
import Typography from '@mui/material/Typography';
import { Pill } from './Pill';
import Table from '@mui/material/Table';
import TableCell from '@mui/material/TableCell';
import TableRow from '@mui/material/TableRow';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { Box } from '@mui/system';
import { ReactChild, ReactFragment, ReactPortal } from 'react';
import { VulnsFilter } from './VulnsFilter';
import { Button } from '@mui/material';
import React from 'react';
export function Vulns(props: any) {
const v = props.vulnerabilties;
const handleAVDLinkClick = (e: any) => {
{ window.ddClient.host.openExternal(e.target.innerText) };
}
const generateSBOM = () => {
props.setSBOMOutput(true);
}
React.useEffect(() => {
if (props.SBOMOutput) {
props.runScan();
}
}, [props.SBOMOutput]);
return (
<Box>
<VulnsFilter
severityFilter={props.severityFilter}
triggerFilter={props.triggerFilter}
showFilter={props.showFilter}
all={props.all}
critical={props.critical}
high={props.high}
medium={props.medium}
low={props.low}
unknown={props.unknown}
/>
<Button onClick={generateSBOM} sx={{
float: 'right',
marginRight: '2rem',
marginBottom: '0.2rem',
display: props.showFilter
}}>Generate SBOM Output</Button>
<Box sx={{ m: '2rem', clear: "both" }}>
{v.map((row: { id: boolean | ReactChild | ReactFragment | ReactPortal | null | undefined; title: boolean | ReactChild | ReactFragment | ReactPortal | null | undefined; description: boolean | ReactChild | ReactFragment | ReactPortal | null | undefined; pkgName: boolean | ReactChild | ReactFragment | ReactPortal | null | undefined; installedVersion: boolean | ReactChild | ReactFragment | ReactPortal | null | undefined; fixedVersion: boolean | ReactChild | ReactFragment | ReactPortal | null | undefined; primaryURL: boolean | ReactChild | ReactFragment | ReactPortal | null | undefined; }) => (
<Accordion>
<AccordionSummary
sx={{ overflowX: 'hidden' }}
expandIcon={<ExpandMoreIcon />}
>
<Pill item={row} />
<Typography sx={{ width: '16%', minWidth: '120px', flexShrink: 0, m: '0.35rem' }}>
{row.id}
</Typography>
<Typography sx={{ m: '0.35rem', overflowX: 'hidden', maxWidth: "60%" }}>
{row.pkgName}
</Typography>
</AccordionSummary>
<AccordionDetails>
<Typography variant="h5" gutterBottom>
{row.title}
</Typography>
<Typography>
{row.description}
</Typography>
<Table>
<TableRow>
<TableCell>
<Typography>
Package Name:
</Typography>
</TableCell>
<TableCell>
<Typography>
{row.pkgName}
</Typography>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Typography>
Installed Version:
</Typography>
</TableCell>
<TableCell>
<Typography>
{row.installedVersion}
</Typography>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Typography>
Fixed Version:
</Typography>
</TableCell>
<TableCell>
<Typography>
{row.fixedVersion}
</Typography>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Typography>
More Info:
</Typography>
</TableCell>
<TableCell>
<Typography>
<a href="#" style={{ color: '#116ED0' }} onClick={handleAVDLinkClick}>{row.primaryURL}</a>
</Typography>
</TableCell>
</TableRow>
</Table>
</AccordionDetails>
</Accordion>
))
}
</Box>
</Box >
)
}