Skip to content

Commit

Permalink
Fix labels for vulnerabilities with source UNKNOWN
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Apr 20, 2024
1 parent 3851825 commit 82c015f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/assets/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ html {
background-color: #EBE5A8;
border: 1px solid #DCD167;
}
.label-source-unknown {
background-color: $severity-unassigned;
border: 1px solid $grey-900;
color: #FFFFFF;
}
.label-notification {
color: #222222;
padding: .2em .6em .3em;
Expand Down
11 changes: 8 additions & 3 deletions src/shared/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ $common.formatAnalyzerLabel = function formatAnalyzerLabel(
break;
case 'TRIVY_ANALYZER':
analyzerLabel = 'Trivy';

analyzerUrl = 'https://nvd.nist.gov/vuln/detail/' + vulnId;
if (vulnSource === 'GITHUB') {
if (vulnSource === 'NVD') {
analyzerUrl = 'https://nvd.nist.gov/vuln/detail/' + vulnId;
} else if (vulnSource === 'GITHUB') {
analyzerUrl = 'https://github.com/advisories/' + vulnId;
}
// NB: Trivy can report vulnerabilities from sources that DT does
// not explicitly support.
break;
}
if (analyzerUrl) {
Expand Down Expand Up @@ -228,6 +230,9 @@ $common.resolveSourceVulnInfo = function resolveSourceVulnInfo(
sourceInfo.url =
'https://vulndb.cyberriskanalytics.com/vulnerabilities/' + vulnId;
break;
case 'UNKNOWN':
// Not possible to provide any additional information.
break;
}
return sourceInfo;
};
Expand Down

0 comments on commit 82c015f

Please sign in to comment.