Skip to content

Commit 6a8d4d8

Browse files
committed
enable vulnerability source links for github and osv
Signed-off-by: Sahiba Mittal <[email protected]>
1 parent 74d57c9 commit 6a8d4d8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/shared/common.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,20 @@ $common.formatCweShortLabel = function formatCweShortLabel(cweId, cweName) {
9595
/**
9696
* Formats and returns a specialized label for a vulnerability analyzer (OSSINDEX_ANALYZER, INTERNAL_ANALYZER, etc).
9797
*/
98-
$common.formatAnalyzerLabel = function formatAnalyzerLabel(analyzer, vulnId, alternateIdentifier, referenceUrl) {
98+
$common.formatAnalyzerLabel = function formatAnalyzerLabel(analyzer, vulnSource, vulnId, alternateIdentifier, referenceUrl) {
9999
if (! analyzer) {
100100
return null;
101101
}
102102
let analyzerLabel = "";
103103
let analyzerUrl = null;
104104
switch (analyzer) {
105105
case 'INTERNAL_ANALYZER':
106-
analyzerLabel = "Internal";
106+
analyzerLabel = vulnSource ?? "Internal";
107+
if(vulnSource === "GITHUB") {
108+
analyzerUrl = "https://github.com/advisories/" + vulnId;
109+
} else if(vulnSource === "OSV") {
110+
analyzerUrl = "https://osv.dev/vulnerability/" + vulnId;
111+
}
107112
break;
108113
case 'OSSINDEX_ANALYZER':
109114
analyzerLabel = "OSS Index";

src/views/portfolio/projects/ProjectFindings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
field: "attribution.analyzerIdentity",
140140
sortable: true,
141141
formatter(value, row, index) {
142-
return common.formatAnalyzerLabel(row.attribution.analyzerIdentity, row.vulnerability.vulnId,
142+
return common.formatAnalyzerLabel(row.attribution.analyzerIdentity, row.vulnerability.source, row.vulnerability.vulnId,
143143
row.attribution.alternateIdentifier, row.attribution.referenceUrl);
144144
}
145145
},

0 commit comments

Comments
 (0)