Skip to content

Commit cd207f1

Browse files
authored
Merge pull request #1034 from CVEProject/dev
Update INT with Sprint 25
2 parents 8294189 + cb243b8 commit cd207f1

File tree

27 files changed

+310
-114
lines changed

27 files changed

+310
-114
lines changed

api-docs/openapi.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,8 +1105,8 @@
11051105
"tags": [
11061106
"CVE Record"
11071107
],
1108-
"summary": "Creates a reject CVE Record for the specified ID if no record yet exists (accessible to CNAs and Secretariat)",
1109-
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>CNA</b> or <b>Secretariat</b> role</p> <h2>Expected Behavior</h2> <p><b>CNA:</b> Creates a reject CVE Record for a record owned by their organization</p> <p><b>Secretariat:</b> Creates a reject CVE Record for a record owned by any organization</p>",
1108+
"summary": "Creates a rejected CVE Record for the specified ID if no record yet exists (accessible to CNAs and Secretariat)",
1109+
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>CNA</b> or <b>Secretariat</b> role</p> <h2>Expected Behavior</h2> <p><b>CNA:</b> Creates a rejected CVE Record for a record owned by their organization</p> <p><b>Secretariat:</b> Creates a rejected CVE Record for a record owned by any organization</p>",
11101110
"operationId": "cveCnaCreateReject",
11111111
"parameters": [
11121112
{
@@ -1205,8 +1205,8 @@
12051205
"tags": [
12061206
"CVE Record"
12071207
],
1208-
"summary": "Updates an existing CVE Record with a reject record for the specified ID (accessible to CNAs and Secretariat)",
1209-
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>CNA</b> or <b>Secretariat</b> role</p> <h2>Expected Behavior</h2> <p><b>CNA:</b> Updates a reject CVE Record for a record owned by their organization</p> <p><b>Secretariat:</b> Updates a reject CVE Record for a record owned by any organization</p>",
1208+
"summary": "Updates an existing CVE Record with a rejected record for the specified ID (accessible to CNAs and Secretariat)",
1209+
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>CNA</b> or <b>Secretariat</b> role</p> <h2>Expected Behavior</h2> <p><b>CNA:</b> Updates a rejected CVE Record for a record owned by their organization</p> <p><b>Secretariat:</b> Updates a rejected CVE Record for a record owned by any organization</p>",
12101210
"operationId": "cveCnaUpdateReject",
12111211
"parameters": [
12121212
{

package-lock.json

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"depcheck": "^0.9.2",
1616
"eslint": "^8.20.0",
1717
"eslint-config-standard": "^14.1.1",
18-
"eslint-plugin-import": "^2.20.1",
18+
"eslint-plugin-import": "^2.26.0",
1919
"eslint-plugin-mocha": "^8.0.0",
2020
"eslint-plugin-node": "^11.0.0",
2121
"eslint-plugin-promise": "^4.2.1",
@@ -41,7 +41,7 @@
4141
"jsonschema": "^1.4.0",
4242
"JSONStream": "^1.3.5",
4343
"kleur": "^4.1.4",
44-
"mongoose": "^5.12.3",
44+
"mongoose": "^5.13.15",
4545
"mongoose-aggregate-paginate-v2": "1.0.6",
4646
"morgan": "^1.9.1",
4747
"node-dev": "^7.4.3",

src/controller/cve-id.controller/cve-id.controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async function reserveCveId (req, res, next) {
173173
const result = await orgRepo.findOneByShortName(shortName)
174174
if (!result) {
175175
logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization does not exist.' })
176-
return res.status(403).json(error.orgDne(shortName))
176+
return res.status(403).json(error.orgDne(shortName, 'short_name', 'query'))
177177
}
178178

179179
const payload = await getPayload(req, result)
@@ -330,7 +330,7 @@ async function modifyCveId (req, res, next) {
330330

331331
if (!orgUUID) {
332332
logger.info({ uuid: req.ctx.uuid, message: id + ' could not be reassigned to ' + newOrgShortName + ' in MongoDB because it does not exist.' })
333-
return res.status(404).json(error.orgDne(newOrgShortName))
333+
return res.status(404).json(error.orgDne(newOrgShortName, 'org', 'query'))
334334
}
335335

336336
cveId.owning_cna = orgUUID

src/controller/cve-id.controller/error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class CveIdControllerError extends idrErr.IDRError {
105105
overIdQuota (details) { // cve-id
106106
const err = {}
107107
err.error = 'EXCEEDED_ID_QUOTA'
108-
err.message = 'The amount requested would exceed the organization\'s ID quota. No more IDs can be reserved until the number of IDs in the Reserved state goes below the ID quota or the ID quota is raised. If you feel you are receiving this message in error, please contact support.'
108+
err.message = 'The amount requested would exceed the organization\'s ID quota. No more IDs can be reserved until the number of IDs in the Reserved state goes below the ID quota or the ID quota is raised. If you feel you are receiving this message in error, please contact support here: https://cveform.mitre.org/'
109109
err.details = details
110110
return err
111111
}

src/controller/cve.controller/cve.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ async function submitCna (req, res, next) {
306306

307307
// create full cve record here
308308
const owningCna = await orgRepo.findOneByUUID(cveId.owning_cna)
309-
const assignerShortName = owningCna?.short_name
309+
const assignerShortName = owningCna.short_name
310310
const cnaContainer = req.ctx.body.cnaContainer
311311
const dateUpdated = (new Date()).toISOString()
312312
const additionalCveMetadataFields = {

src/controller/cve.controller/error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class CveControllerError extends idrErr.IDRError {
7070
unableToStoreCveRecord () { // cve
7171
const err = {}
7272
err.error = 'UNABLE_TO_STORE_CVE_RECORD'
73-
err.message = 'A problem occurred while saving the CVE Record, ensure that x_ values do not start with $'
73+
err.message = 'A problem occurred while saving the CVE Record, ensure field names in x_ objects do not start with $'
7474
return err
7575
}
7676

src/controller/cve.controller/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,13 +504,13 @@ router.post('/cve/:id/reject',
504504
/*
505505
#swagger.tags = ['CVE Record']
506506
#swagger.operationId = 'cveCnaCreateReject'
507-
#swagger.summary = "Creates a reject CVE Record for the specified ID if no record yet exists (accessible to CNAs and Secretariat)"
507+
#swagger.summary = "Creates a rejected CVE Record for the specified ID if no record yet exists (accessible to CNAs and Secretariat)"
508508
#swagger.description = "
509509
<h2>Access Control</h2>
510510
<p>User must belong to an organization with the <b>CNA</b> or <b>Secretariat</b> role</p>
511511
<h2>Expected Behavior</h2>
512-
<p><b>CNA:</b> Creates a reject CVE Record for a record owned by their organization</p>
513-
<p><b>Secretariat:</b> Creates a reject CVE Record for a record owned by any organization</p>"
512+
<p><b>CNA:</b> Creates a rejected CVE Record for a record owned by their organization</p>
513+
<p><b>Secretariat:</b> Creates a rejected CVE Record for a record owned by any organization</p>"
514514
#swagger.parameters['id'] = { description: 'The CVE ID for the record being rejected' }
515515
#swagger.parameters['$ref'] = [
516516
'#/components/parameters/apiEntityHeader',
@@ -589,13 +589,13 @@ router.put('/cve/:id/reject',
589589
/*
590590
#swagger.tags = ['CVE Record']
591591
#swagger.operationId = 'cveCnaUpdateReject'
592-
#swagger.summary = "Updates an existing CVE Record with a reject record for the specified ID (accessible to CNAs and Secretariat)"
592+
#swagger.summary = "Updates an existing CVE Record with a rejected record for the specified ID (accessible to CNAs and Secretariat)"
593593
#swagger.description = "
594594
<h2>Access Control</h2>
595595
<p>User must belong to an organization with the <b>CNA</b> or <b>Secretariat</b> role</p>
596596
<h2>Expected Behavior</h2>
597-
<p><b>CNA:</b> Updates a reject CVE Record for a record owned by their organization</p>
598-
<p><b>Secretariat:</b> Updates a reject CVE Record for a record owned by any organization</p>"
597+
<p><b>CNA:</b> Updates a rejected CVE Record for a record owned by their organization</p>
598+
<p><b>Secretariat:</b> Updates a rejected CVE Record for a record owned by any organization</p>"
599599
#swagger.parameters['id'] = { description: 'The CVE ID for the record being rejected' }
600600
#swagger.parameters['$ref'] = [
601601
'#/components/parameters/apiEntityHeader',

src/controller/org.controller/error.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const idrErr = require('../../utils/error')
22

33
class OrgControllerError extends idrErr.IDRError {
4-
orgDneParam (shortname) { // org
4+
orgDnePathParam (shortname) { // org
55
const err = {}
66
err.error = 'ORG_DNE_PARAM'
7-
err.message = `The '${shortname}' organization designated by the shortname parameter does not exist.`
7+
err.message = `The '${shortname}' organization designated by the shortname path parameter does not exist.`
88
return err
99
}
1010

@@ -77,6 +77,13 @@ class OrgControllerError extends idrErr.IDRError {
7777
err.message = `'${param}' is not a valid parameter.`
7878
return err
7979
}
80+
81+
notAllowedToSelfDemote () {
82+
const err = {}
83+
err.error = 'NOT_ALLOWED_TO_SELF_DEMOTE'
84+
err.message = 'Please have another admin user from your organization change your role.'
85+
return err
86+
}
8087
}
8188

8289
module.exports = {

0 commit comments

Comments
 (0)