Skip to content

Commit

Permalink
feat: use primaryLink to render vulnerability reports (#77)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
  • Loading branch information
danielpacak authored Feb 28, 2022
1 parent 6873432 commit be0edef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/ciskubebenchreports/cisresults-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

.TableCell {
&.number {
text-align: left;
text-align: right;
flex-grow: 0.1;
}

&.status {
text-align: right;
text-align: center;
flex-grow: 0.1;
}

Expand Down
6 changes: 6 additions & 0 deletions src/vulnerabilityreports/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
}

.Table {
.TableCell {
&.severity {
text-align: center;
}
}

.Badge {
&.severity-CRITICAL {
color: white;
Expand Down
20 changes: 3 additions & 17 deletions src/vulnerabilityreports/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,13 @@ export class VulnerabilitiesList extends React.Component<Props> {
getTableRow = (uid: string) => {
const {vulnerabilities} = this.props;
const vulnerability = vulnerabilities.find(item => item.getId() == uid);
let avdURL: string;
let vulnID = vulnerability.getId();

if (vulnID.startsWith('CVE-')) {
avdURL = `https://avd.aquasec.com/nvd/${vulnID}`.toLowerCase()
} else if (vulnID.startsWith('RUSTSEC-')) {
avdURL = `https://rustsec.org/advisories/${vulnID}`
} else if (vulnID.startsWith('GHSA-')) {
avdURL = `https://github.com/advisories/${vulnID}`
} else if (vulnID.startsWith('TEMP-')) {
avdURL = `https://security-tracker.debian.org/tracker/${vulnID}`
} else {
avdURL = `https://google.com/search?q=${vulnID}`
}

return (
<TableRow key={vulnID} nowrap sortItem={vulnerability}>
<TableRow key={vulnerability.getId()} nowrap sortItem={vulnerability}>
<TableCell className="vulnerabilityID">
<a target="_blank" href={avdURL}>{vulnID}</a>
<a target="_blank" href={vulnerability.primaryLink}>{vulnerability.getId()}</a>
</TableCell>
<TableCell>
<TableCell className="severity">
<Badge className={"Badge severity-" + vulnerability.severity} small label={vulnerability.severity}/>
</TableCell>
<TableCell className="resource">{vulnerability.resource}</TableCell>
Expand Down
2 changes: 1 addition & 1 deletion src/vulnerabilityreports/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class Vulnerability {
installedVersion: string;
fixedVersion?: string;
severity: string;
links?: string[];
primaryLink: string;

constructor(params: Vulnerability) {
Object.entries(params).forEach(([key, value]) => {
Expand Down

0 comments on commit be0edef

Please sign in to comment.