Skip to content

Commit 8450982

Browse files
committed
publishedRecord: display owner name if different from assigner name (issue #1224)
1 parent 506bfdd commit 8450982

File tree

4 files changed

+142
-76
lines changed

4 files changed

+142
-76
lines changed

src/stores/partners.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PartnerData from '@/assets/data/CNAsList.json';
33
import axios from 'axios';
44

55
export const usePartnerStore = defineStore('partner', {
6-
state: () => {
6+
state: () => {
77
return {
88
partnerCounts: {},
99
partnerShortLongNameMap: {},
@@ -16,7 +16,7 @@ export const usePartnerStore = defineStore('partner', {
1616
const partnerCounts = {
1717
type: {}, role: {}, totalPartners: 0, countries: {}, countriesCount: 0,
1818
};
19-
19+
2020
PartnerData.forEach((partner) => {
2121
if (partner.CNA.roles.length > 0) {
2222
partner.CNA.roles.forEach((roleObj) => {
@@ -29,12 +29,12 @@ export const usePartnerStore = defineStore('partner', {
2929
}
3030
});
3131
}
32-
32+
3333
if (partner.CNA.type.length > 0) {
3434
partner.CNA.type.forEach((type) => {
3535
let newType = '';
3636
if (new RegExp(/^(Vulnerability Researcher)/, 'i').test(type)) { newType = 'Vulnerability Researcher(s)'; } else { newType = type; }
37-
37+
3838
if (newType.toLowerCase() !== 'n/a') {
3939
if (Object.prototype.hasOwnProperty.call(partnerCounts.type, newType)) {
4040
partnerCounts.type[newType] += 1;
@@ -44,34 +44,35 @@ export const usePartnerStore = defineStore('partner', {
4444
}
4545
});
4646
}
47-
47+
4848
if (Object.prototype.hasOwnProperty.call(partnerCounts.countries, partner.country)) {
4949
partnerCounts.countries[partner.country] += 1;
5050
} else {
5151
partnerCounts.countries[partner.country] = 1;
5252
}
5353
});
54-
54+
5555
partnerCounts.totalPartners = PartnerData.length;
5656
Object.keys(partnerCounts.countries).forEach((country)=>{
5757
if (country !== 'n/a') partnerCounts.countriesCount += 1;
5858
});
5959

6060
partnerCounts.countries['No country affiliation'] = partnerCounts.countries['n/a'];
6161
delete partnerCounts.countries['n/a'];
62-
62+
6363
this.partnerCounts = partnerCounts;
6464
},
6565
async populatePartnerShortLongNameMap () {
6666

67+
const url = `${import.meta.env.VITE_API_BASE_URL}cve-partner-name-map.json`;
68+
6769
try {
68-
const url = `${import.meta.env.VITE_API_BASE_URL}cve-partner-name-map.json`;
6970
const response = await axios.get(url, { timeout: 30000 });
7071

7172
this.partnerShortLongNameMap = response?.data || {};
72-
73+
7374
} catch (error) {
74-
throw new Error(`Error fetching ${import.meta.env.VITE_API_BASE_URL}cve-partner-name-map.json`);
75+
console.log(`Unavailable: ${url}`);
7576
}
7677
}
7778
},

src/views/CVERecord/CVERecord.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ export default {
206206
this.handleServerError();
207207
}
208208
} finally {
209-
if (!usecveRecordStore().serverError && !usecveRecordStore().isPublished
210-
&& !usecveRecordStore().isReserved && !usecveRecordStore().isRejected) {
209+
if (!usecveRecordStore().serverError && !usecveRecordStore().isReserved
210+
&& !usecveRecordStore().isRejected) {
211211
await this.getIdData();
212212
}
213213
}
@@ -289,7 +289,14 @@ export default {
289289
} else if (usecveRecordStore().recordData.cveMetadata.state === 'REJECTED') {
290290
usecveRecordStore().isRejected = true;
291291
}
292-
this.handleIsIdOrRecordFound(true);
292+
293+
// For published records, hold off on marking the record found until
294+
// after we've also retrieved the ID record. Both record and ID data
295+
// is needed for a published record to determine if the owner of the
296+
// CVE record is the same as the assigner.
297+
298+
if (!usecveRecordStore().isPublished)
299+
this.handleIsIdOrRecordFound(true);
293300
}
294301
},
295302
handleServerError() {

0 commit comments

Comments
 (0)