Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #931 : Enable flag for Google OSV mirroring #170

Merged
merged 8 commits into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/assets/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
background-color: #D4BBF7;
border: 1px solid #A66AF7;
}
.label-source-google {
background-color: #f7bbdc;
border: 1px solid #cc668a;
}
.label-source-internal {
background-color: #EBE5A8;
border: 1px solid #DCD167;
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@
"nvd": "NVD",
"national_vulnerability_database": "National Vulnerability Database",
"github_advisories": "GitHub Advisories",
"osv_advisories": "Google OSV Advisories",
"repositories": "Repositories",
"cargo": "Cargo",
"composer": "Composer",
Expand Down Expand Up @@ -445,6 +446,8 @@
"vulnsource_nvd_feeds_url": "NVD Feeds URL",
"vulnsource_github_advisories_enable": "Enable GitHub Advisory mirroring",
"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.",
"vulnsource_osv_advisories_enable": "Enable Google OSV Advisory mirroring",
"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.",
"registered_email_address": "Registered email address",
"api_token": "API token",
"consumer_key": "Consumer key",
Expand Down
5 changes: 5 additions & 0 deletions src/views/administration/AdminMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@
component: "VulnSourceGitHubAdvisories",
name: this.$t('admin.github_advisories'),
href: "#vulnsourceGitHubAdvisoriesTab"
},
{
component: "VulnSourceOSVAdvisories",
name: this.$t('admin.osv_advisories'),
href: "#vulnsourceOSVAdvisoriesTab"
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/administration/Administration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
// Vulnerability sources
import VulnSourceNvd from "./vuln-sources/VulnSourceNvd";
import VulnSourceGitHubAdvisories from "./vuln-sources/VulnSourceGitHubAdvisories";
import VulnSourceOSVAdvisories from "./vuln-sources/VulnSourceOSVAdvisories";
// Repositories
import Cargo from "./repositories/Cargo";
import Composer from "./repositories/Composer";
Expand Down Expand Up @@ -62,7 +63,7 @@
AdminMenu,
General, BomFormats, Email, InternalComponents,
InternalAnalyzer, OssIndexAnalyzer, VulnDbAnalyzer,
VulnSourceNvd, VulnSourceGitHubAdvisories,
VulnSourceNvd, VulnSourceGitHubAdvisories, VulnSourceOSVAdvisories,
Cargo, Composer, Gem, GoModules, Hex, Maven, Npm, Nuget, Python,
Alerts, Templates,
FortifySsc, DefectDojo, KennaSecurity,
Expand Down
69 changes: 69 additions & 0 deletions src/views/administration/vuln-sources/VulnSourceOSVAdvisories.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<template>
<b-card no-body :header="header">
<b-card-body>
<hr/>
nscuro marked this conversation as resolved.
Show resolved Hide resolved
<c-switch
color="primary"
id="vulnsourceEnabled"
label
v-bind="labelIcon"
v-model="vulnsourceEnabled"
/>
{{$t('admin.vulnsource_osv_advisories_enable')}}
<hr/>
{{ $t('admin.vulnsource_osv_advisories_desc') }}
</b-card-body>
<b-card-footer>
<b-button
@click="saveChanges"
class="px-4"
variant="outline-primary">
{{ $t('message.update') }}
</b-button>
</b-card-footer>
</b-card>
</template>

<script>
import { Switch as cSwitch } from '@coreui/vue';
import common from "../../../shared/common";
import configPropertyMixin from "../mixins/configPropertyMixin";

export default {
mixins: [configPropertyMixin],
props: {
header: String
},
components: {
cSwitch
},
data() {
return {
vulnsourceEnabled: false,
labelIcon: {
dataOn: '\u2713',
dataOff: '\u2715'
},
}
},
methods: {
saveChanges: function() {
this.updateConfigProperties([
{groupName: 'vuln-source', propertyName: 'google.osv.enabled', propertyValue: this.vulnsourceEnabled}
]);
}
},
created () {
this.axios.get(this.configUrl).then((response) => {
let configItems = response.data.filter(function (item) { return item.groupName === "vuln-source" });
for (let i=0; i<configItems.length; i++) {
let item = configItems[i];
switch (item.propertyName) {
case "google.osv.enabled":
this.vulnsourceEnabled = common.toBoolean(item.propertyValue); break;
}
}
});
}
}
</script>