Skip to content

Commit 15238d1

Browse files
authored
Merge pull request #1726 from CVEProject/dev
Update Staging with version 2.7.3 - getAllOrgs DocumentDb bug fix.
2 parents 5f94285 + a7e4393 commit 15238d1

5 files changed

Lines changed: 15 additions & 4 deletions

File tree

api-docs/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"openapi": "3.0.2",
33
"info": {
4-
"version": "2.7.2",
4+
"version": "2.7.3",
55
"title": "CVE Services API",
66
"description": "The CVE Services API supports automation tooling for the CVE Program. Credentials are required for most service endpoints. Representatives of <a href='https://www.cve.org/ProgramOrganization/CNAs'>CVE Numbering Authorities (CNAs)</a> should use one of the methods below to obtain credentials: <ul><li>If your organization already has an Organizational Administrator (OA) account for the CVE Services, ask your admin for credentials</li> <li>Contact your Root (<a href='https://www.cve.org/PartnerInformation/ListofPartners/partner/Google'>Google</a>, <a href='https://www.cve.org/PartnerInformation/ListofPartners/partner/INCIBE'>INCIBE</a>, <a href='https://www.cve.org/PartnerInformation/ListofPartners/partner/jpcert'>JPCERT/CC</a>, or <a href='https://www.cve.org/PartnerInformation/ListofPartners/partner/redhat'>Red Hat</a>) or Top-Level Root (<a href='https://www.cve.org/PartnerInformation/ListofPartners/partner/icscert'>CISA ICS</a> or <a href='https://www.cve.org/PartnerInformation/ListofPartners/partner/mitre'>MITRE</a>) to request credentials </ul> <p>CVE data is to be in the JSON 5.2 CVE Record format. Details of the JSON 5.2 schema are located <a href='https://github.com/CVEProject/cve-schema/releases/tag/v5.2.0' target='_blank'>here</a>.</p> <a href='https://cveform.mitre.org/' class='link' target='_blank'>Contact the CVE Services team</a>",
77
"contact": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cve-services",
33
"author": "Automation Working Group",
4-
"version": "2.7.2",
4+
"version": "2.7.3",
55
"license": "(CC0)",
66
"devDependencies": {
77
"@faker-js/faker": "^7.6.0",

src/controller/registry-org.controller/registry-org.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ async function getAllOrgs (req, res, next) {
4848
if (error.message && error.message.includes('Unknown Org type requested')) {
4949
return res.status(400).json({ message: error.message })
5050
}
51+
return res.status(500).json({ message: 'Error fetching orgs' })
5152
}
5253

5354
logger.info({ uuid: req.ctx.uuid, message: 'The orgs were sent to the user.' })

src/repositories/baseOrgRepository.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function setAggregateRegistryOrgObj (query) {
6868
$cond: {
6969
if: { $gt: [{ $size: '$parentOrg' }, 0] },
7070
then: { $arrayElemAt: ['$parentOrg.UUID', 0] },
71-
else: '$$REMOVE'
71+
else: null
7272
}
7373
}
7474
}
@@ -272,6 +272,16 @@ class BaseOrgRepository extends BaseRepository {
272272
const agt = setAggregateRegistryOrgObj({})
273273
pg = await this.aggregatePaginate(agt, options)
274274
}
275+
276+
// Strip nulls returned by DocumentDB to prevent schema validation errors
277+
if (pg.itemsList) {
278+
pg.itemsList.forEach(org => {
279+
if (org.reports_to === null) {
280+
delete org.reports_to
281+
}
282+
})
283+
}
284+
275285
const data = { organizations: pg.itemsList }
276286
if (pg.itemCount >= options.limit) {
277287
data.totalCount = pg.itemCount

src/swagger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const fullCnaContainerRequest = require('../schemas/cve/create-cve-record-cna-re
2222
/* eslint-disable no-multi-str */
2323
const doc = {
2424
info: {
25-
version: '2.7.2',
25+
version: '2.7.3',
2626
title: 'CVE Services API',
2727
description: "The CVE Services API supports automation tooling for the CVE Program. Credentials are \
2828
required for most service endpoints. Representatives of \

0 commit comments

Comments
 (0)