Skip to content

Commit df995f5

Browse files
authored
Merge pull request #256 from sahibamittal/osv-1964-base-url-feature
Issue 1964: OSV base url customised
2 parents 250522d + cba21c5 commit df995f5

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

src/i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@
466466
"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.",
467467
"vulnsource_osv_advisories_enable": "Select ecosystem to enable Google OSV Advisory mirroring",
468468
"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.",
469+
"vulnsource_osv_base_url": "OSV Base URL",
469470
"registered_email_address": "Registered email address",
470471
"api_token": "API token",
471472
"consumer_key": "Consumer key",

src/views/administration/vuln-sources/VulnSourceOSVAdvisories.vue

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,17 @@
1414
{{$t('admin.vulnsource_osv_advisories_enable')}}
1515
<hr/>
1616
{{ $t('admin.vulnsource_osv_advisories_desc') }}
17-
</b-card-body>
18-
<b-card-body>
17+
<hr/>
18+
<b-validated-input-group-form-input
19+
id="nvd-feeds-url"
20+
:label="$t('admin.vulnsource_osv_base_url')"
21+
input-group-size="mb-3"
22+
rules="required"
23+
type="text"
24+
v-model="osvBaseUrl"
25+
lazy="true"
26+
/>
27+
<hr/>
1928
<b-form-group label="Ecosystems">
2029
<div class="list-group" style="width: 40%">
2130
<span v-for="ecosystem in enabledEcosystems" :key="ecosystem">
@@ -24,8 +33,16 @@
2433
<actionable-list-group-item :add-icon="true" @actionClicked="$root.$emit('bv::show::modal', 'ecosystemModal')"/>
2534
</div>
2635
</b-form-group>
27-
<hr/>
2836
</b-card-body>
37+
<b-card-footer>
38+
<b-button
39+
:disabled="this.vulnsourceEnabled && !this.osvBaseUrl"
40+
variant="outline-primary"
41+
class="px-4"
42+
@click="saveUrl">
43+
{{ $t('message.update') }}
44+
</b-button>
45+
</b-card-footer>
2946
<ecosystem-modal v-on:selection="updateEcosystem"/>
3047
</b-card>
3148
</template>
@@ -35,6 +52,7 @@ import { Switch as cSwitch } from '@coreui/vue';
3552
import configPropertyMixin from "../mixins/configPropertyMixin";
3653
import EcosystemModal from "./EcosystemModal";
3754
import ActionableListGroupItem from '../../components/ActionableListGroupItem.vue';
55+
import BValidatedInputGroupFormInput from '../../../forms/BValidatedInputGroupFormInput';
3856
3957
export default {
4058
mixins: [configPropertyMixin],
@@ -44,11 +62,13 @@ export default {
4462
components: {
4563
cSwitch,
4664
EcosystemModal,
47-
ActionableListGroupItem
65+
ActionableListGroupItem,
66+
BValidatedInputGroupFormInput
4867
},
4968
data() {
5069
return {
5170
vulnsourceEnabled: false,
71+
osvBaseUrl: '',
5272
ecosystemConfig: null,
5373
enabledEcosystems: [],
5474
labelIcon: {
@@ -71,9 +91,6 @@ export default {
7191
removeEcosystem: function(ecosystem) {
7292
this.enabledEcosystems = this.enabledEcosystems.filter(e => e !== ecosystem);
7393
this.vulnsourceEnabled = this.enabledEcosystems.length !== 0;
74-
this.updateConfigProperties([
75-
{groupName: 'vuln-source', propertyName: 'google.osv.enabled', propertyValue: this.enabledEcosystems.join(";")}
76-
]);
7794
},
7895
updateEcosystem: function(ecosystems) {
7996
this.$root.$emit('bv::hide::modal', 'ecosystemModal');
@@ -82,7 +99,10 @@ export default {
8299
this.enabledEcosystems.push(ecosystem.name);
83100
}
84101
this.vulnsourceEnabled = this.enabledEcosystems.length !== 0;
102+
},
103+
saveUrl: function() {
85104
this.updateConfigProperties([
105+
{groupName: 'vuln-source', propertyName: 'google.osv.base.url', propertyValue: this.osvBaseUrl},
86106
{groupName: 'vuln-source', propertyName: 'google.osv.enabled', propertyValue: this.enabledEcosystems.join(";")}
87107
]);
88108
}
@@ -97,6 +117,9 @@ export default {
97117
this.ecosystemConfig = item.propertyValue;
98118
this.vulnsourceEnabled = this.ecosystemConfig != null;
99119
break;
120+
case "google.osv.base.url":
121+
this.osvBaseUrl = item.propertyValue;
122+
break;
100123
}
101124
}
102125
this.enabledEcosystems = this.ecosystemConfig.split(';').map(ecosystem => ecosystem.trim());

0 commit comments

Comments
 (0)