Skip to content

Commit fb22b1a

Browse files
authored
Merge pull request #3398 from CVEProject/tat-3394-cve-id
#3394 update Search Results page with CVE ID found cases
2 parents e4bc271 + 99cc29a commit fb22b1a

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

src/stores/cveListSearch.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const useCveListSearchStore = defineStore('cveListSearch ', {
8989
}
9090

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

113113
// format description
114-
let descriptions = [];
115-
cveRecordData.containers?.cna?.descriptions.forEach((description) => {
116-
if (this.isEnglishLanguage(description.lang)) descriptions.push(this.processShowMoreShowLessDescription(description.value));
117-
});
114+
let descriptions = this.processDescriptionsField(cveRecordData);
115+
118116
let recordDataSummary = {
119117
cveId: cveRecordData?.cveMetadata?.cveId || 'No ID provided',
120118
cna: cveRecordData?.containers?.cna?.providerMetadata?.shortName || 'No CNA provided',
@@ -196,7 +194,7 @@ export const useCveListSearchStore = defineStore('cveListSearch ', {
196194
cveId: result._id,
197195
cna: result?._source?.containers?.cna?.providerMetadata?.shortName || 'No CNA provided',
198196
cnaOrgId: result?._source?.containers?.cna?.providerMetadata?.orgId || '',
199-
descriptions: this.processDescriptionsField(result),
197+
descriptions: this.processDescriptionsField(result?._source),
200198
relevancyScore: result?._score
201199
});
202200
});
@@ -205,17 +203,17 @@ export const useCveListSearchStore = defineStore('cveListSearch ', {
205203

206204
this.searchResults = parsedResults;
207205
},
208-
processDescriptionsField(result){
206+
processDescriptionsField(recordData){
209207
let descriptions = [];
210-
if (result?._source?.cveMetadata?.state === "PUBLISHED") {
211-
result?._source?.containers?.cna?.descriptions.forEach((description) => {
208+
if (recordData.cveMetadata?.state === "PUBLISHED") {
209+
recordData.containers?.cna?.descriptions.forEach((description) => {
212210
if (this.isEnglishLanguage(description.lang)) descriptions.push(this.processShowMoreShowLessDescription(description.value));
213211
});
214-
} else if (result?._source?.cveMetadata?.state === "REJECTED") {
215-
result?._source?.containers?.cna?.rejectedReasons.forEach((rejectedReason) => {
212+
} else if (recordData.cveMetadata?.state === "REJECTED") {
213+
recordData.containers?.cna?.rejectedReasons.forEach((rejectedReason) => {
216214
if (this.isEnglishLanguage(rejectedReason.lang)) descriptions.push(this.processShowMoreShowLessDescription(rejectedReason.value));
217215
});
218-
} else {
216+
} else { // resevered/rejected ID w/o a CVE record does not have description, and that logic is handled in corresponding Vue file
219217
descriptions.push('No description provided');
220218
}
221219

src/views/CVERecord/SearchResults.vue

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,18 @@
3434
<p>You are accessing <span class="has-text-weight-bold">Production</span> data from {{ resultUrl }}</p>
3535
</div>
3636
</div>
37+
<h2 class="title">Search Results</h2>
3738
<div class="mb-3" v-if="hasRecordData || hasIdData">
38-
<h2 class="title"> CVE {{ getRecordOrIdLabel }} Found</h2>
39+
<h3 class="title is-size-5 mb-2"> CVE {{ getRecordOrIdLabel }} Found</h3>
3940
<p class="cve-help-text">
4041
<span v-if="hasRecordData">View the CVE {{ getRecordOrIdLabel }} below.</span>
4142
<span v-if="hasIdData">
4243
The <router-link to="/ResourcesSupport/Glossary#glossaryCVEID">CVE ID</router-link> below has no corresponding
4344
<router-link to="/ResourcesSupport/Glossary#glossaryRecord">CVE Record</router-link>.
4445
</span>
45-
If you are searching for this CVE ID in other CVE Records, view the Search Results section below.
46+
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.
4647
</p>
47-
<div class="columns cve-columns is-variable is-1-desktop is-0-mobile mt-0 mr-2 mb-0 ml-2">
48+
<div class="columns cve-columns is-variable is-1-desktop is-0-mobile mt-0 mr-2 mb-4 ml-2">
4849
<div class="column cve-column">
4950
<div class="columns cve-columns">
5051
<div class="column cve-column">
@@ -57,14 +58,20 @@
5758
{{ cveListSearchStore.idData.cve_id}}
5859
</router-link>
5960
</div>
60-
<div class="column cve-column" v-if="hasRecordData">
61-
<p>
61+
<div class="column cve-column">
62+
<p v-if="hasRecordData">
6263
<span>CNA: </span>
63-
{{ partnerStore.partnerShortLongNameMap[cveListSearchStore.recordData.cnaOrgId] ? partnerStore.partnerShortLongNameMap[cveListSearchStore.recordData.cnaOrgId] : cveListSearchStore.recordData.cna }}</p>
64+
{{ partnerStore.partnerShortLongNameMap[cveListSearchStore.recordData.cnaOrgId] ? partnerStore.partnerShortLongNameMap[cveListSearchStore.recordData.cnaOrgId] : cveListSearchStore.recordData.cna }}
65+
</p>
66+
<p v-if="hasIdData">
67+
<span>Assigner: </span>
68+
<span v-if="cveListSearchStore?.idData?.owning_cna">{{ cveListSearchStore.idData.owning_cna }}</span>
69+
<span v-else>No assigner provided</span>
70+
</p>
6471
</div>
6572
</div>
66-
<div class="columns cve-columns" v-if="hasRecordData">
67-
<div class="column cve-column">
73+
<div class="columns cve-columns">
74+
<div class="column cve-column" v-if="hasRecordData">
6875
<div v-for="(description, index) in cveListSearchStore.recordData.descriptions" :key="description.key" class="mb-0">
6976
<p v-if="!description.showMore" class="mb-0">
7077
{{ description.firstChunk }}<span v-if="!description.showMore && description.secondChunk.length > 0">...</span>
@@ -79,12 +86,22 @@
7986
</button>
8087
</div>
8188
</div>
89+
<div class="column cve-column" v-if="hasIdData">
90+
<p v-if="cveListSearchStore.idData.state === 'REJECTED'">
91+
This CVE ID was unused by the <router-link to="/ProgramOrganization/CNAs">CNA</router-link>
92+
</p>
93+
<p v-if="cveListSearchStore.idData.state === 'RESERVED'">
94+
This ID has been reserved by a <router-link to="/ProgramOrganization/CNAs">CNA</router-link> and its corresponding record
95+
will be updated by the assigning CNA once details are available. Learn more about the
96+
<router-link to="ResourcesSupport/FAQs#pc_cve_recordsreserved_signify_in_cve_record">Reserved state</router-link>.
97+
</p>
98+
</div>
8299
</div>
83100
</div>
84101
</div>
85102
</div>
86103
<div id="cve-search-results-container" v-if="cveListSearchStore.totalSearchResultCount > 0">
87-
<h2 class="title">Search Results</h2>
104+
<h3 class="title is-size-5 mb-2" v-if="hasIdData">Other Results</h3>
88105
<p class="cve-help-text" v-if="hasRecordData || hasIdData">
89106
Includes all record(s) that reference this CVE ID.
90107
</p>

0 commit comments

Comments
 (0)