Skip to content

Commit d56159e

Browse files
authored
Merge pull request #170 from sahibamittal/osv-support-enable-flag
Issue #931 : Enable flag for Google OSV mirroring
2 parents a4f7d49 + bbc7592 commit d56159e

File tree

8 files changed

+92
-4
lines changed

8 files changed

+92
-4
lines changed

src/assets/img/osv-logo.png

1.87 KB
Loading

src/assets/scss/_custom.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
background-color: #D4BBF7;
105105
border: 1px solid #A66AF7;
106106
}
107+
.label-source-google {
108+
background-color: #f7bbdc;
109+
border: 1px solid #cc668a;
110+
}
107111
.label-source-internal {
108112
background-color: #EBE5A8;
109113
border: 1px solid #DCD167;

src/i18n/locales/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@
388388
"nvd": "NVD",
389389
"national_vulnerability_database": "National Vulnerability Database",
390390
"github_advisories": "GitHub Advisories",
391+
"osv_advisories": "Google OSV Advisories",
391392
"repositories": "Repositories",
392393
"cargo": "Cargo",
393394
"composer": "Composer",
@@ -452,6 +453,8 @@
452453
"vulnsource_nvd_feeds_url": "NVD Feeds URL",
453454
"vulnsource_github_advisories_enable": "Enable GitHub Advisory mirroring",
454455
"vulnsource_github_advisories_desc": "GitHub Advisories (GHSA) is a database of CVEs and GitHub-originated security advisories affecting the open source world. Dependency-Track integrates with GHSA by mirroring advisories via GitHub's public GraphQL API. The mirror is refreshed daily, or upon restart of the Dependency-Track instance. A personal access token (PAT) is required in order to authenticate with GitHub, but no scopes need to be assigned to it.",
456+
"vulnsource_osv_advisories_enable": "Enable Google OSV Advisory mirroring",
457+
"vulnsource_osv_advisories_desc": "Google OSV is a distributed vulnerability and triage infrastructure for open source projects aimed at helping both open source maintainers and consumers of open source. It serves as an aggregator of vulnerability databases that have adopted the OpenSSF Vulnerability format.",
455458
"registered_email_address": "Registered email address",
456459
"api_token": "API token",
457460
"consumer_key": "Consumer key",

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;
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/administration/AdminMenu.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@
9797
component: "VulnSourceGitHubAdvisories",
9898
name: this.$t('admin.github_advisories'),
9999
href: "#vulnsourceGitHubAdvisoriesTab"
100+
},
101+
{
102+
component: "VulnSourceOSVAdvisories",
103+
name: this.$t('admin.osv_advisories'),
104+
href: "#vulnsourceOSVAdvisoriesTab"
100105
}
101106
]
102107
},

src/views/administration/Administration.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
// Vulnerability sources
3131
import VulnSourceNvd from "./vuln-sources/VulnSourceNvd";
3232
import VulnSourceGitHubAdvisories from "./vuln-sources/VulnSourceGitHubAdvisories";
33+
import VulnSourceOSVAdvisories from "./vuln-sources/VulnSourceOSVAdvisories";
3334
// Repositories
3435
import Cargo from "./repositories/Cargo";
3536
import Composer from "./repositories/Composer";
@@ -62,7 +63,7 @@
6263
AdminMenu,
6364
General, BomFormats, Email, InternalComponents,
6465
InternalAnalyzer, OssIndexAnalyzer, VulnDbAnalyzer,
65-
VulnSourceNvd, VulnSourceGitHubAdvisories,
66+
VulnSourceNvd, VulnSourceGitHubAdvisories, VulnSourceOSVAdvisories,
6667
Cargo, Composer, Gem, GoModules, Hex, Maven, Npm, Nuget, Python,
6768
Alerts, Templates,
6869
FortifySsc, DefectDojo, KennaSecurity,
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<template>
2+
<b-card no-body :header="header">
3+
<b-card-body>
4+
<img alt="OSV logo" src="@/assets/img/osv-logo.png" width="65"/>
5+
<hr/>
6+
<c-switch
7+
color="primary"
8+
id="vulnsourceEnabled"
9+
label
10+
v-bind="labelIcon"
11+
v-model="vulnsourceEnabled"
12+
/>
13+
{{$t('admin.vulnsource_osv_advisories_enable')}}
14+
<hr/>
15+
{{ $t('admin.vulnsource_osv_advisories_desc') }}
16+
</b-card-body>
17+
<b-card-footer>
18+
<b-button
19+
@click="saveChanges"
20+
class="px-4"
21+
variant="outline-primary">
22+
{{ $t('message.update') }}
23+
</b-button>
24+
</b-card-footer>
25+
</b-card>
26+
</template>
27+
28+
<script>
29+
import { Switch as cSwitch } from '@coreui/vue';
30+
import common from "../../../shared/common";
31+
import configPropertyMixin from "../mixins/configPropertyMixin";
32+
33+
export default {
34+
mixins: [configPropertyMixin],
35+
props: {
36+
header: String
37+
},
38+
components: {
39+
cSwitch
40+
},
41+
data() {
42+
return {
43+
vulnsourceEnabled: false,
44+
labelIcon: {
45+
dataOn: '\u2713',
46+
dataOff: '\u2715'
47+
},
48+
}
49+
},
50+
methods: {
51+
saveChanges: function() {
52+
this.updateConfigProperties([
53+
{groupName: 'vuln-source', propertyName: 'google.osv.enabled', propertyValue: this.vulnsourceEnabled}
54+
]);
55+
}
56+
},
57+
created () {
58+
this.axios.get(this.configUrl).then((response) => {
59+
let configItems = response.data.filter(function (item) { return item.groupName === "vuln-source" });
60+
for (let i=0; i<configItems.length; i++) {
61+
let item = configItems[i];
62+
switch (item.propertyName) {
63+
case "google.osv.enabled":
64+
this.vulnsourceEnabled = common.toBoolean(item.propertyValue); break;
65+
}
66+
}
67+
});
68+
}
69+
}
70+
</script>

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)