Skip to content

Commit

Permalink
Add i18n; Add help texts and links to NVD resources
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Nov 13, 2023
1 parent d444c7a commit b246890
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,12 @@
"snyk": "Snyk (Beta)",
"vuln_sources": "Vulnerability Sources",
"nvd": "NVD",
"nvd_enable_mirroring_via_api": "Enable mirroring via API",
"nvd_why_enable_api_help": "Why should I enable API mirroring?",
"nvd_request_api_key_help": "How do I get an API key?",
"nvd_api_last_modification": "Last Modification (UTC)",
"nvd_api_last_modification_help": "After mirroring the NVD database once completely, all following mirror operations will only request data that was modified since its last successful execution.",
"nvd_api_last_modification_warning": "Changing the last modification datetime manually is generally not recommended, but may be used to force re-ingestion of NVD data. Note that due to a limitation in the NVD's REST API, only data for 120 consecutive days can be requested when a last modification datetime is configured. Resetting the last modification datetime will cause the entire NVD database to be re-mirrored.",
"national_vulnerability_database": "National Vulnerability Database",
"github_advisories": "GitHub Advisories",
"osv_advisories": "Google OSV Advisories (Beta)",
Expand Down
41 changes: 31 additions & 10 deletions src/views/administration/vuln-sources/VulnSourceNvd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
/>
{{$t('admin.vulnsource_nvd_enable')}}
<hr/>
{{ $t('admin.vulnsource_nvd_desc') }}
<hr/>
<b-validated-input-group-form-input
id="nvd-feeds-url"
:label="$t('admin.vulnsource_nvd_feeds_url')"
Expand All @@ -28,11 +30,10 @@
label
v-bind="labelIcon"
/>
Enable API
{{ $t('admin.nvd_enable_mirroring_via_api') }}
<p class="font-sm text-muted">
<span class="fa fa-question-circle">&nbsp;</span>
<!-- TODO: Explain why users may want to enable API over feeds; Point out caveats (feed files no longer being downloaded etc.) -->
Foobarbaz
<a :href="nvdApiWhyEnableUrl" target="_blank">{{ $t('admin.nvd_why_enable_api_help') }}</a>
</p>
<b-validated-input-group-form-input
id="nvdApiEndpoint"
Expand All @@ -49,28 +50,38 @@
v-model="nvdApiKey"
lazy="true"
/>
<b-form-group label="Last Modification">
<p class="font-sm text-muted">
<span class="fa fa-question-circle">&nbsp;</span>
<a :href="nvdApiRequestApiKeyUrl" target="_blank">{{ $t('admin.nvd_request_api_key_help') }}</a>
</p>
<b-form-group :label="$t('admin.nvd_api_last_modification')">
<b-input-group>
<b-form-datepicker
id="nvdApiLastModifiedDate"
v-model="nvdApiLastModifiedDate"
:date-format-options="{ year: 'numeric', month: 'numeric', day: 'numeric' }"
:min="nvdApiLastModifiedDateMin"
:max="nvdApiLastModifiedDateMax"
locale="en-GB"
:reset-button="true"
:show-decade-nav="true"
/>
<b-form-timepicker
id="nvdApiLastModifiedTime"
v-model="nvdApiLastModifiedTime"
locale="en-GB"
:reset-button="true"
/>
</b-input-group>
</b-form-group>
<p class="font-sm text-muted">
<span class="fa fa-question-circle">&nbsp;</span>
<!-- TODO: Explain what the last modified datetime is used for and when users may want to modify it. -->
Foobarbaz
{{ $t('admin.nvd_api_last_modification_help') }}
</p>
<p class="font-sm text-muted">
<span class="fa fa-warning">&nbsp;</span>
{{ $t('admin.nvd_api_last_modification_warning') }}
</p>
<hr/>
{{ $t('admin.vulnsource_nvd_desc') }}
</b-card-body>
<b-card-footer>
<b-button
Expand Down Expand Up @@ -108,8 +119,12 @@ export default {
nvdApiEnabled: false,
nvdApiEndpoint: '',
nvdApiKey: '',
nvdApiLastModifiedDate: new Date().toISOString(),
nvdApiLastModifiedDate: '',
nvdApiLastModifiedDateMin: new Date(1999, 1, 1),
nvdApiLastModifiedDateMax: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()),
nvdApiLastModifiedTime: '',
nvdApiWhyEnableUrl: 'https://nvd.nist.gov/General/News/change-timeline',
nvdApiRequestApiKeyUrl: 'https://nvd.nist.gov/developers/request-an-api-key',
labelIcon: {
dataOn: '\u2713',
dataOff: '\u2715'
Expand All @@ -128,8 +143,14 @@ export default {
]);
},
getApiLastModifiedEpochSeconds() {
if (!this.nvdApiLastModifiedDate) {
return 0;
} else if (!this.nvdApiLastModifiedTime) {
let lastModifiedDateTime = Date.parse(this.nvdApiLastModifiedDate);
return lastModifiedDateTime ? lastModifiedDateTime / 1000 : 0;
}
let lastModifiedDateTime = Date.parse(`${this.nvdApiLastModifiedDate}T${this.nvdApiLastModifiedTime}Z`);
return lastModifiedDateTime ? lastModifiedDateTime / 1000 : null;
return lastModifiedDateTime ? lastModifiedDateTime / 1000 : 0;
}
},
created () {
Expand Down

0 comments on commit b246890

Please sign in to comment.