Skip to content

Commit

Permalink
Merge pull request #3398 from CVEProject/tat-3394-cve-id
Browse files Browse the repository at this point in the history
#3394 update Search Results page with CVE ID found cases
  • Loading branch information
athu-tran authored Jan 7, 2025
2 parents e4bc271 + 99cc29a commit fb22b1a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 21 deletions.
22 changes: 10 additions & 12 deletions src/stores/cveListSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const useCveListSearchStore = defineStore('cveListSearch ', {
}

} catch (error) {
// if record is not found, find potential reserved ID
// if record is not found, find potential reserved/rejected ID
if (this.isCveIdPattern() && Object.keys(this.recordData).length === 0) {
await this.getIdData();
}
Expand All @@ -111,10 +111,8 @@ export const useCveListSearchStore = defineStore('cveListSearch ', {
this.isIdOrRecordFound = true;

// format description
let descriptions = [];
cveRecordData.containers?.cna?.descriptions.forEach((description) => {
if (this.isEnglishLanguage(description.lang)) descriptions.push(this.processShowMoreShowLessDescription(description.value));
});
let descriptions = this.processDescriptionsField(cveRecordData);

let recordDataSummary = {
cveId: cveRecordData?.cveMetadata?.cveId || 'No ID provided',
cna: cveRecordData?.containers?.cna?.providerMetadata?.shortName || 'No CNA provided',
Expand Down Expand Up @@ -196,7 +194,7 @@ export const useCveListSearchStore = defineStore('cveListSearch ', {
cveId: result._id,
cna: result?._source?.containers?.cna?.providerMetadata?.shortName || 'No CNA provided',
cnaOrgId: result?._source?.containers?.cna?.providerMetadata?.orgId || '',
descriptions: this.processDescriptionsField(result),
descriptions: this.processDescriptionsField(result?._source),
relevancyScore: result?._score
});
});
Expand All @@ -205,17 +203,17 @@ export const useCveListSearchStore = defineStore('cveListSearch ', {

this.searchResults = parsedResults;
},
processDescriptionsField(result){
processDescriptionsField(recordData){
let descriptions = [];
if (result?._source?.cveMetadata?.state === "PUBLISHED") {
result?._source?.containers?.cna?.descriptions.forEach((description) => {
if (recordData.cveMetadata?.state === "PUBLISHED") {
recordData.containers?.cna?.descriptions.forEach((description) => {
if (this.isEnglishLanguage(description.lang)) descriptions.push(this.processShowMoreShowLessDescription(description.value));
});
} else if (result?._source?.cveMetadata?.state === "REJECTED") {
result?._source?.containers?.cna?.rejectedReasons.forEach((rejectedReason) => {
} else if (recordData.cveMetadata?.state === "REJECTED") {
recordData.containers?.cna?.rejectedReasons.forEach((rejectedReason) => {
if (this.isEnglishLanguage(rejectedReason.lang)) descriptions.push(this.processShowMoreShowLessDescription(rejectedReason.value));
});
} else {
} else { // resevered/rejected ID w/o a CVE record does not have description, and that logic is handled in corresponding Vue file
descriptions.push('No description provided');
}

Expand Down
35 changes: 26 additions & 9 deletions src/views/CVERecord/SearchResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@
<p>You are accessing <span class="has-text-weight-bold">Production</span> data from {{ resultUrl }}</p>
</div>
</div>
<h2 class="title">Search Results</h2>
<div class="mb-3" v-if="hasRecordData || hasIdData">
<h2 class="title"> CVE {{ getRecordOrIdLabel }} Found</h2>
<h3 class="title is-size-5 mb-2"> CVE {{ getRecordOrIdLabel }} Found</h3>
<p class="cve-help-text">
<span v-if="hasRecordData">View the CVE {{ getRecordOrIdLabel }} below.</span>
<span v-if="hasIdData">
The <router-link to="/ResourcesSupport/Glossary#glossaryCVEID">CVE ID</router-link> below has no corresponding
<router-link to="/ResourcesSupport/Glossary#glossaryRecord">CVE Record</router-link>.
</span>
If you are searching for this CVE ID in other CVE Records, view the Search Results section below.
If you are searching for this CVE ID in other CVE Records, view the <span class="has-text-weight-bold">Other Results</span> section below.
</p>
<div class="columns cve-columns is-variable is-1-desktop is-0-mobile mt-0 mr-2 mb-0 ml-2">
<div class="columns cve-columns is-variable is-1-desktop is-0-mobile mt-0 mr-2 mb-4 ml-2">
<div class="column cve-column">
<div class="columns cve-columns">
<div class="column cve-column">
Expand All @@ -57,14 +58,20 @@
{{ cveListSearchStore.idData.cve_id}}
</router-link>
</div>
<div class="column cve-column" v-if="hasRecordData">
<p>
<div class="column cve-column">
<p v-if="hasRecordData">
<span>CNA: </span>
{{ partnerStore.partnerShortLongNameMap[cveListSearchStore.recordData.cnaOrgId] ? partnerStore.partnerShortLongNameMap[cveListSearchStore.recordData.cnaOrgId] : cveListSearchStore.recordData.cna }}</p>
{{ partnerStore.partnerShortLongNameMap[cveListSearchStore.recordData.cnaOrgId] ? partnerStore.partnerShortLongNameMap[cveListSearchStore.recordData.cnaOrgId] : cveListSearchStore.recordData.cna }}
</p>
<p v-if="hasIdData">
<span>Assigner: </span>
<span v-if="cveListSearchStore?.idData?.owning_cna">{{ cveListSearchStore.idData.owning_cna }}</span>
<span v-else>No assigner provided</span>
</p>
</div>
</div>
<div class="columns cve-columns" v-if="hasRecordData">
<div class="column cve-column">
<div class="columns cve-columns">
<div class="column cve-column" v-if="hasRecordData">
<div v-for="(description, index) in cveListSearchStore.recordData.descriptions" :key="description.key" class="mb-0">
<p v-if="!description.showMore" class="mb-0">
{{ description.firstChunk }}<span v-if="!description.showMore && description.secondChunk.length > 0">...</span>
Expand All @@ -79,12 +86,22 @@
</button>
</div>
</div>
<div class="column cve-column" v-if="hasIdData">
<p v-if="cveListSearchStore.idData.state === 'REJECTED'">
This CVE ID was unused by the <router-link to="/ProgramOrganization/CNAs">CNA</router-link>
</p>
<p v-if="cveListSearchStore.idData.state === 'RESERVED'">
This ID has been reserved by a <router-link to="/ProgramOrganization/CNAs">CNA</router-link> and its corresponding record
will be updated by the assigning CNA once details are available. Learn more about the
<router-link to="ResourcesSupport/FAQs#pc_cve_recordsreserved_signify_in_cve_record">Reserved state</router-link>.
</p>
</div>
</div>
</div>
</div>
</div>
<div id="cve-search-results-container" v-if="cveListSearchStore.totalSearchResultCount > 0">
<h2 class="title">Search Results</h2>
<h3 class="title is-size-5 mb-2" v-if="hasIdData">Other Results</h3>
<p class="cve-help-text" v-if="hasRecordData || hasIdData">
Includes all record(s) that reference this CVE ID.
</p>
Expand Down

0 comments on commit fb22b1a

Please sign in to comment.