Repository: CVEProject/cve-services
Pull request #302 (2021-02-02 22:09:04)

Removing CNA References
Removing all references to 'CNA' and replacing with 'Org' or 'organization'.



Patch:
diff --git a/docs/openapi.yml b/docs/openapi.yml
index 92766136..ceefde78 100644
--- a/docs/openapi.yml
+++ b/docs/openapi.yml
@@ -215,7 +215,7 @@ paths:
             type: string
           required: true
           description: >
-            Identifies the CNA who should own the IDs reserved.
+            Identifies the Org who should own the IDs reserved.
       responses:
         200:
           description: A list of the newly reserved CVE-IDs the account requested.
diff --git a/src/controller/cve-id.controller/cve-id.controller.js b/src/controller/cve-id.controller/cve-id.controller.js
index 7874e64c..22d73655 100644
--- a/src/controller/cve-id.controller/cve-id.controller.js
+++ b/src/controller/cve-id.controller/cve-id.controller.js
@@ -30,7 +30,7 @@ async function getCveId (req, res, next) {
         const cveId = JSON.parse(JSON.stringify(result)) // clone cve id returned from the db
         delete cveId._id
 
-        logger.info({ message: id + ' is ' + result.state + '. A 404 status was sent to the requester.', cveId: cveId })
+        logger.info({ uuid: req.ctx.uuid, message: id + ' is ' + result.state + '. A 404 status was sent to the requester.', cveId: cveId })
         return res.status(404).json(error.cveIdNotFound(id))
       }
 
@@ -41,7 +41,7 @@ async function getCveId (req, res, next) {
         owning_cna: (await orgRepo.findOneByUUID(result.owning_cna)).short_name
       }
 
-      logger.info({ message: id + ' record was sent to the user.', cveId: cveId })
+      logger.info({ uuid: req.ctx.uuid, message: id + ' record was sent to the user.', cveId: cveId })
       return res.status(200).json(cveId)
     } else {
       // the requester is a user in the organization or is the secretariat
@@ -55,7 +55,7 @@ async function getCveId (req, res, next) {
         delete cveId.__v
       }
 
-      logger.info({ message: id + ' record was sent to the user.', cveId: cveId })
+      logger.info({ uuid: req.ctx.uuid, message: id + ' record was sent to the user.', cveId: cveId })
       return res.status(200).json(cveId)
     }
   } catch (err) {
@@ -234,7 +234,7 @@ async function getFilteredCveId (req, res, next) {
         utils.setPaginatorHeaders(res, pg)
       }
 
-      logger.info({ message: 'The CVEs were sent to the user.' })
+      logger.info({ uuid: req.ctx.uuid, message: 'The CVEs were sent to the user.' })
       return res.status(200).json({ cve_ids: pg.itemsList })
     }
   } catch (err) {
@@ -257,8 +257,8 @@ async function modifyCveId (req, res, next) {
       state = req.ctx.query.state
     }
 
-    if (req.ctx.query.cna) {
-      newOrgShortName = req.ctx.query.cna
+    if (req.ctx.query.org) {
+      newOrgShortName = req.ctx.query.org
     }
 
     if (state && !returned) {
@@ -276,7 +276,7 @@ async function modifyCveId (req, res, next) {
 
       if (!orgUUID) {
         returned = true
-        logger.info({ message: id + ' could not be reasigned to ' + newOrgShortName + ' in MongoDB because it does not exist.' })
+        logger.info({ uuid: req.ctx.uuid, message: id + ' could not be reasigned to ' + newOrgShortName + ' in MongoDB because it does not exist.' })
         return res.status(404).json(error.orgDne(newOrgShortName))
       }
     }
@@ -395,7 +395,7 @@ async function reserveCveId (req, res, next) {
 
       if (!result) {
         returned = true
-        logger.info({ message: shortName + ' organization does not exist.' })
+        logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization does not exist.' })
         return res.status(403).json(error.orgDne(shortName))
       }
     }
@@ -453,7 +453,7 @@ async function priorityReservation (year, amount, shortName, orgShortName, reque
   // Cve Id Range for 'year' does not exists
   if (!result) {
     returned = true
-    logger.info({ message: 'CVE IDs for year ' + year + ' cannot be reserved at this time.' })
+    logger.info({ uuid: req.ctx.uuid, message: 'CVE IDs for year ' + year + ' cannot be reserved at this time.' })
     res.header(CONSTANTS.QUOTA_HEADER, availableIds)
     return res.status(403).json(error.cannotReserveForYear(year))
   }
@@ -465,7 +465,7 @@ async function priorityReservation (year, amount, shortName, orgShortName, reque
     // priority id block is full, reserve id in sequential block
     if (!result) {
       isFull = true
-      logger.info({ message: 'Priority id block is full for year ' + year + ', reserving id in sequential block.' })
+      logger.info({ uuid: req.ctx.uuid, message: 'Priority id block is full for year ' + year + ', reserving id in sequential block.' })
       await sequentialReservation(year, amount, shortName, orgShortName, requester, availableIds, true, res, req)
     }
   }
@@ -531,7 +531,7 @@ async function sequentialReservation (year, amount, shortName, orgShortName, req
   // Cve Id Range for 'year' does not exists
   if (!result) {
     returned = true
-    logger.info({ message: 'CVE IDs for year ' + year + ' cannot be reserved at this time.' })
+    logger.info({ uuid: req.ctx.uuid, message: 'CVE IDs for year ' + year + ' cannot be reserved at this time.' })
     res.header(CONSTANTS.QUOTA_HEADER, availableIds)
     return res.status(403).json(error.cannotReserveForYear(year))
   }
@@ -546,9 +546,9 @@ async function sequentialReservation (year, amount, shortName, orgShortName, req
       returned = true
 
       if (isPriority) {
-        logger.error({ message: 'The cve id priority and sequential blocks are full for year ' + year + '. No more priority or sequential ids can be reserved at this time.' })
+        logger.error(JSON.stringify({ message: 'The cve id priority and sequential blocks are full for year ' + year + '. No more priority or sequential ids can be reserved at this time.' }))
       } else {
-        logger.error({ message: 'The cve id sequential block is full for year ' + year + '. No more sequential ids can be reserved at this time.' })
+        logger.error(JSON.stringify({ message: 'The cve id sequential block is full for year ' + year + '. No more sequential ids can be reserved at this time.' }))
       }
 
       res.header(CONSTANTS.QUOTA_HEADER, availableIds)
@@ -628,7 +628,7 @@ async function nonSequentialReservation (year, amount, shortName, orgShortName,
   // Cve Id Range for 'year' does not exists
   if (!result) {
     returned = true
-    logger.info({ message: 'CVE IDs for year ' + year + ' cannot be reserved at this time.' })
+    logger.info({ uuid: req.ctx.uuid, message: 'CVE IDs for year ' + year + ' cannot be reserved at this time.' })
     res.header(CONSTANTS.QUOTA_HEADER, availableIds)
     return res.status(403).json(error.cannotReserveForYear(year))
   }
@@ -643,12 +643,12 @@ async function nonSequentialReservation (year, amount, shortName, orgShortName,
       returned = result.returned
 
       if (isFull || returned) {
-        logger.error({ message: 'The cve id non-sequential block is full for year ' + year + '. No more sequential ids can be reserved at this time.' })
+        logger.error(JSON.stringify({ message: 'The cve id non-sequential block is full for year ' + year + '. No more sequential ids can be reserved at this time.' }))
         res.header(CONSTANTS.QUOTA_HEADER, availableIds)
         return res.status(403).json(error.yearRangeFull(year))
       }
 
-      await allocateAvailableCveIds(result.ids, year, cveIdRepo) // Pool was incremented. Create 'AVAILABLE' cve ids.
+      await allocateAvailableCveIds(result.ids, year, req) // Pool was incremented. Create 'AVAILABLE' cve ids.
       available = await cveIdRepo.find({ cve_year: year, state: 'AVAILABLE' }, { limit: availableLimit }) // get available ids
     }
   }
@@ -669,7 +669,7 @@ async function nonSequentialReservation (year, amount, shortName, orgShortName,
     result = await reserveNonSequentialCveId(index, available, year, shortName, orgShortName, requester, owningOrgUUID, orgUUID, requesterUUID, cveIdRepo)
 
     if (result.isReserved) {
-      logger.info({ message: result.cveId.cve_id + ' was reserved' })
+      logger.info({ uuid: req.ctx.uuid, message: result.cveId.cve_id + ' was reserved' })
       cveIdDocuments.push(result.cveId) // add reserved cve id to the array of reserved cve ids
       cveIdDocumentsUUID.push(result.cveIdUUID) // add reserved cve id UUID to the array of reserved cve ids
       available.splice(index, 1) // remove reserved cve id from the 'AVAILABLE' pool
@@ -686,12 +686,12 @@ async function nonSequentialReservation (year, amount, shortName, orgShortName,
         returned = result.returned
 
         if (isFull || returned) {
-          logger.info({ message: 'Only ' + counter + ' cve ids were reserved because there are not enough ids in the CVE ID non-sequential block. Non-sequential CVE IDs were reserved for \'' + shortName + '\' organization on behalf of \'' + orgShortName + '\' organization.', cve_ids: cveIdDocumentsUUID })
+          logger.info({ uuid: req.ctx.uuid, message: 'Only ' + counter + ' cve ids were reserved because there are not enough ids in the CVE ID non-sequential block. Non-sequential CVE IDs were reserved for \'' + shortName + '\' organization on behalf of \'' + orgShortName + '\' organization.', cve_ids: cveIdDocumentsUUID })
           res.header(CONSTANTS.QUOTA_HEADER, availableIds - counter)
           return res.status(206).json(error.reservedPartialAmount(counter, cveIdDocuments))
         }
 
-        await allocateAvailableCveIds(result.ids, year, cveIdRepo) // Pool was incremented. Create 'AVAILABLE' cve ids.
+        await allocateAvailableCveIds(result.ids, year, req) // Pool was incremented. Create 'AVAILABLE' cve ids.
         available = await cveIdRepo.find({ cve_year: year, state: 'AVAILABLE' }, { limit: availableLimit }) // get available ids
       }
     }
@@ -753,9 +753,9 @@ async function incrementNonSequentialPool (availableLimit, end, top, amount, ava
   return result
 }
 
-async function allocateAvailableCveIds (ids, year, cveIdR) {
+async function allocateAvailableCveIds (ids, year, req) {
   if (ids) {
-    const cveIdRepo = cveIdR
+    const cveIdRepo = req.ctx.repositories.getCveIdRepository()
     const cveIdDocuments = []
     let cveId
 
@@ -775,7 +775,7 @@ async function allocateAvailableCveIds (ids, year, cveIdR) {
     })
 
     await cveIdRepo.insertMany(cveIdDocuments) // Save the 'AVAILABLE' cve ids
-    logger.info({ message: 'The AVAILABLE pool was incremented by ' + cveIdDocuments.length + ' cve ids.' })
+    logger.info({ uuid: req.ctx.uuid, message: 'The AVAILABLE pool was incremented by ' + cveIdDocuments.length + ' cve ids.' })
   }
 }
 
@@ -862,7 +862,7 @@ async function createCveIdRange (req, res, next) {
     const result = await cveIdRangeRepo.findOne({ cve_year: year })
 
     if (result) {
-      logger.info({ message: 'CVE Id Range document for year ' + year + ' already exists.' })
+      logger.info({ uuid: req.ctx.uuid, message: 'CVE Id Range document for year ' + year + ' already exists.' })
       return res.status(400).json(error.yearRangeExists(year))
     }
 
diff --git a/src/controller/cve-id.controller/cve-id.middleware.js b/src/controller/cve-id.controller/cve-id.middleware.js
index 8ae5474c..ae5b0293 100644
--- a/src/controller/cve-id.controller/cve-id.middleware.js
+++ b/src/controller/cve-id.controller/cve-id.middleware.js
@@ -12,7 +12,7 @@ function parseGetParams (req, res, next) {
 }
 
 function parsePostParams (req, res, next) {
-  utils.reqCtxMapping(req, 'query', ['state', 'amount', 'batch_type', 'short_name', 'cve_year', 'cna'])
+  utils.reqCtxMapping(req, 'query', ['state', 'amount', 'batch_type', 'short_name', 'cve_year', 'org'])
   utils.reqCtxMapping(req, 'params', ['id', 'year'])
   next()
 }
diff --git a/src/controller/cve-id.controller/index.js b/src/controller/cve-id.controller/index.js
index cf7820cc..9661799b 100644
--- a/src/controller/cve-id.controller/index.js
+++ b/src/controller/cve-id.controller/index.js
@@ -40,7 +40,7 @@ router.post('/cve-id/:id',
   mw.validateUser,
   param(['id']).isString().matches(/^CVE-[0-9]{4}-[0-9]{4,}$/, 'i'),
   query(['state']).optional().isString().trim().escape().customSanitizer(val => { return val.toUpperCase() }).isIn(CHOICES),
-  query(['cna']).optional().isString().trim().escape(),
+  query(['org']).optional().isString().trim().escape(),
   parseError,
   parsePostParams,
   controller.CVEID_UPDATE_SINGLE)
diff --git a/src/controller/org.controller/index.js b/src/controller/org.controller/index.js
index 795e5113..68270fa2 100644
--- a/src/controller/org.controller/index.js
+++ b/src/controller/org.controller/index.js
@@ -75,7 +75,7 @@ router.post('/org/:shortname/user/:username',
   param(['username']).isString().trim().escape().notEmpty(),
   query(['active']).optional().isString().trim().escape().isIn(['true', 'false']),
   query(['new_username']).optional().isString().trim().escape().notEmpty(),
-  query(['new_cna_shortname']).optional().isString().trim().escape().notEmpty(),
+  query(['org_shortname']).optional().isString().trim().escape().notEmpty(),
   query(['name.first']).optional().isString().trim().escape(),
   query(['name.last']).optional().isString().trim().escape(),
   query(['name.middle']).optional().isString().trim().escape(),
diff --git a/src/controller/org.controller/org.controller.js b/src/controller/org.controller/org.controller.js
index 0d8e7c93..07333401 100644
--- a/src/controller/org.controller/org.controller.js
+++ b/src/controller/org.controller/org.controller.js
@@ -38,7 +38,7 @@ async function getOrgs (req, res, next) {
       utils.setPaginatorHeaders(res, pg)
     }
 
-    logger.info({ message: 'The orgs were sent to the user.' })
+    logger.info({ uuid: req.ctx.uuid, message: 'The orgs were sent to the user.' })
     return res.status(200).json({ organizations: pg.itemsList })
   } catch (err) {
     next(err)
@@ -56,7 +56,7 @@ async function getOrg (req, res, next) {
 
     if (orgShortName !== shortName && !isSecretariat) {
       returned = true
-      logger.info({ message: shortName + ' organization can only be viewed by the users of the same organization or the Secretariat.' })
+      logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization can only be viewed by the users of the same organization or the Secretariat.' })
       return res.status(403).json(error.notSameOrgOrSecretariat())
     }
 
@@ -79,11 +79,11 @@ async function getOrg (req, res, next) {
       ])
 
       if (utils.isEmptyObject(result)) {
-        logger.info({ message: shortName + ' organization does not exist.' })
+        logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization does not exist.' })
         return res.status(404).json(error.orgDneParam(shortName))
       }
 
-      logger.info({ message: shortName + ' organization was sent to the user.', org: result })
+      logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization was sent to the user.', org: result })
       return res.status(200).json(result[0])
     }
   } catch (err) {
@@ -105,13 +105,13 @@ async function getUsers (req, res, next) {
 
     if (!orgUUID) {
       returned = true
-      logger.info({ message: orgShortName + ' organization does not exist.' })
+      logger.info({ uuid: req.ctx.uuid, message: orgShortName + ' organization does not exist.' })
       return res.status(404).json(error.orgDneParam(orgShortName))
     }
 
     if (orgShortName !== shortName && !isSecretariat && !returned) {
       returned = true
-      logger.info({ message: orgShortName + ' organization can only be viewed by the users of the same organization.' })
+      logger.info({ uuid: req.ctx.uuid, message: orgShortName + ' organization can only be viewed by the users of the same organization.' })
       return res.status(403).json(error.notSameOrgOrSecretariat())
     }
 
@@ -139,7 +139,7 @@ async function getUsers (req, res, next) {
         utils.setPaginatorHeaders(res, pg)
       }
 
-      logger.info({ message: `The users of ${orgShortName} organization were sent to the user.` })
+      logger.info({ uuid: req.ctx.uuid, message: `The users of ${orgShortName} organization were sent to the user.` })
       return res.status(200).json({ users: pg.itemsList })
     }
   } catch (err) {
@@ -159,14 +159,14 @@ async function getUser (req, res, next) {
 
     if (orgShortName !== shortName && !isSecretariat) {
       returned = true
-      logger.info({ message: shortName + ' organization can only be viewed by that organization\'s users or the Secretariat.' })
+      logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization can only be viewed by that organization\'s users or the Secretariat.' })
       return res.status(403).json(error.notSameOrgOrSecretariat())
     }
 
     const orgUUID = await orgRepo.getOrgUUID(orgShortName)
     if (!orgUUID && !returned) {
       returned = true
-      logger.info({ message: orgShortName + ' organization does not exist.' })
+      logger.info({ uuid: req.ctx.uuid, message: orgShortName + ' organization does not exist.' })
       return res.status(404).json(error.orgDneParam(orgShortName))
     }
 
@@ -190,11 +190,11 @@ async function getUser (req, res, next) {
       ])
 
       if (utils.isEmptyObject(result)) {
-        logger.info({ message: username + ' does not exist.' })
+        logger.info({ uuid: req.ctx.uuid, message: username + ' does not exist.' })
         return res.status(404).json(error.userDne(username))
       }
 
-      logger.info({ message: username + ' was sent to the user.', user: result })
+      logger.info({ uuid: req.ctx.uuid, message: username + ' was sent to the user.', user: result })
       return res.status(200).json(result[0])
     }
   } catch (err) {
@@ -210,13 +210,13 @@ async function getOrgIdQuota (req, res, next) {
     const repo = req.ctx.repositories.getOrgRepository()
     const isSecretariat = await repo.isSecretariat(orgShortName)
     if (orgShortName !== shortName && !isSecretariat) {
-      logger.info({ message: shortName + ' organization id quota can only be viewed by the users of the same organization or the Secretariat.' })
+      logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization id quota can only be viewed by the users of the same organization or the Secretariat.' })
       return res.status(403).json(error.notSameOrgOrSecretariat())
     }
 
     let result = await repo.findOneByShortName(shortName)
     if (!result) {
-      logger.info({ message: shortName + ' organization does not exist.' })
+      logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization does not exist.' })
       return res.status(404).json(error.orgDneParam(shortName))
     }
 
@@ -235,7 +235,7 @@ async function getOrgIdQuota (req, res, next) {
     returnPayload.total_reserved = result
     returnPayload.available = returnPayload.id_quota - returnPayload.total_reserved
 
-    logger.info({ message: 'The organization\'s id quota was returned to the user.', details: returnPayload })
+    logger.info({ uuid: req.ctx.uuid, message: 'The organization\'s id quota was returned to the user.', details: returnPayload })
     return res.status(200).json(returnPayload)
   } catch (err) {
     next(err)
@@ -250,7 +250,7 @@ async function createOrg (req, res, next) {
 
     const result = await orgRepo.findOneByShortName(newOrg.short_name) // Find org in MongoDB
     if (result) {
-      logger.info({ message: newOrg.short_name + ' organization was not created because it already exists.' })
+      logger.info({ uuid: req.ctx.uuid, message: newOrg.short_name + ' organization was not created because it already exists.' })
       return res.status(400).json(error.orgExists(newOrg.short_name))
     }
 
@@ -309,7 +309,7 @@ async function updateOrg (req, res, next) {
     // org doesn't exist
     if (!org) {
       returned = true
-      logger.info({ message: shortName + ' organization could not be updated in MongoDB because it does not exist.' })
+      logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization could not be updated in MongoDB because it does not exist.' })
       return res.status(404).json(error.orgDneParam(shortName))
     }
 
@@ -388,7 +388,7 @@ async function updateOrg (req, res, next) {
       const result = await orgRepo.updateByOrgUUID(org.UUID, newOrg)
 
       if (result.n === 0) {
-        logger.info({ message: shortName + ' organization could not be updated in MongoDB because it does not exist.' })
+        logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization could not be updated in MongoDB because it does not exist.' })
         return res.status(404).json(error.orgDneParam(shortName))
       }
 
@@ -424,7 +424,7 @@ async function createUser (req, res, next) {
 
     const orgUUID = await orgRepo.getOrgUUID(orgShortName)
     if (!orgUUID) {
-      logger.info({ message: 'The user could not be created because ' + orgShortName + ' organization does not exist.' })
+      logger.info({ uuid: req.ctx.uuid, message: 'The user could not be created because ' + orgShortName + ' organization does not exist.' })
       return res.status(404).json(error.orgDneParam(orgShortName))
     }
 
@@ -449,7 +449,7 @@ async function createUser (req, res, next) {
     let result = await orgRepo.findOneByUUID(newUser.org_UUID) // Check the org exists
 
     if (!result) {
-      logger.info({ message: 'The user could not be created because ' + orgShortName + ' organization does not exist.' })
+      logger.info({ uuid: req.ctx.uuid, message: 'The user could not be created because ' + orgShortName + ' organization does not exist.' })
       return res.status(400).json(error.orgDneParam(orgShortName))
     }
 
@@ -464,7 +464,7 @@ async function createUser (req, res, next) {
     result = await userRepo.findOneByUserNameAndOrgUUID(newUser.username, newUser.org_UUID) // Find user in MongoDB
 
     if (result) {
-      logger.info({ message: newUser.username + ' was not created because it already exists.' })
+      logger.info({ uuid: req.ctx.uuid, message: newUser.username + ' was not created because it already exists.' })
       return res.status(400).json(error.userExists(newUser.username))
     }
     await userRepo.updateByUserNameAndOrgUUID(newUser.username, newUser.org_UUID, newUser, { upsert: true }) // Create user in MongoDB if it doesn't exist
@@ -514,22 +514,22 @@ async function updateUser (req, res, next) {
     const orgUUID = await orgRepo.getOrgUUID(shortName)
     if (!orgUUID) {
       returned = true
-      logger.info({ message: 'The user could not be updated because ' + shortName + ' organization does not exist.' })
+      logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + shortName + ' organization does not exist.' })
       return res.status(404).json(error.orgDneParam(shortName))
     }
 
     const user = await userRepo.findOneByUserNameAndOrgUUID(username, orgUUID)
     if (!user) {
       returned = true
-      logger.info({ message: 'The user could not be updated because ' + username + ' does not exist for ' + shortName + ' organization.' })
+      logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + username + ' does not exist for ' + shortName + ' organization.' })
       return res.status(404).json(error.userDne(username))
     }
 
     if ('new_username' in req.ctx.query) {
       newUsername = req.ctx.query.new_username
     }
-    if ('new_cna_shortname' in req.ctx.query) {
-      newOrgShortName = req.ctx.query.new_cna_shortname
+    if ('org_shortname' in req.ctx.query) {
+      newOrgShortName = req.ctx.query.org_shortname
     }
     if ('active' in req.ctx.query) {
       active = req.ctx.query.active
@@ -580,7 +580,7 @@ async function updateUser (req, res, next) {
 
       if (!newUser.org_UUID) {
         returned = true
-        logger.info({ message: 'The user could not be updated because ' + newOrgShortName + ' organization does not exist.' })
+        logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + newOrgShortName + ' organization does not exist.' })
         return res.status(404).json(error.orgDne(newOrgShortName))
       }
     }
@@ -590,21 +590,21 @@ async function updateUser (req, res, next) {
       const duplicateUsers = await userRepo.find({ org_UUID: newUser.org_UUID, username: newUser.username })
       if (duplicateUsers.length) {
         returned = true
-        logger.info({ message: 'The user could not be updated because ' + newOrgShortName + ' organization contains a user with the same name.' })
+        logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + newOrgShortName + ' organization contains a user with the same name.' })
         return res.status(403).json(error.duplicateUsername(newOrgShortName, newUsername))
       }
     } else if (newUsername && !returned) {
       const duplicateUsers = await userRepo.find({ org_UUID: orgUUID, username: newUser.username })
       if (duplicateUsers.length) {
         returned = true
-        logger.info({ message: 'The user could not be updated because ' + shortName + ' organization contains a user with the same name.' })
+        logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + shortName + ' organization contains a user with the same name.' })
         return res.status(403).json(error.duplicateUsername(shortName, newUsername))
       }
     } else if (newOrgShortName && !returned) {
       const duplicateUsers = await userRepo.find({ org_UUID: newUser.org_UUID, username: username })
       if (duplicateUsers.length) {
         returned = true
-        logger.info({ message: 'The user could not be updated because ' + newOrgShortName + ' organization contains a user with the same name.' })
+        logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + newOrgShortName + ' organization contains a user with the same name.' })
         return res.status(403).json(error.duplicateUsername(newOrgShortName, username))
       }
     }
@@ -613,7 +613,7 @@ async function updateUser (req, res, next) {
       const result = await userRepo.updateByUserNameAndOrgUUID(username, orgUUID, newUser)
 
       if (result.n === 0) {
-        logger.info({ message: 'The user could not be updated because ' + username + ' does not exist for ' + shortName + ' organization.' })
+        logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + username + ' does not exist for ' + shortName + ' organization.' })
         return res.status(404).json(error.userDne(username))
       }
 
@@ -652,17 +652,17 @@ async function resetSecret (req, res, next) {
     const orgUUID = await orgRepo.getOrgUUID(orgShortName) // userUUID may be null if user does not exist
 
     if (!orgUUID) {
-      logger.info({ messsage: orgShortName + ' organization does not exist.' })
+      logger.info({ uuid: req.ctx.uuid, messsage: orgShortName + ' organization does not exist.' })
       return res.status(404).json(error.orgDneParam(orgShortName))
     }
 
     const result = await userRepo.updateByUserNameAndOrgUUID(newUser.username, orgUUID, newUser)
     if (result.n === 0) {
-      logger.info({ message: 'The user could not be updated because ' + username + ' does not exist for ' + orgShortName + ' organization.' })
+      logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + username + ' does not exist for ' + orgShortName + ' organization.' })
       return res.status(404).json(error.userDne(username))
     }
 
-    logger.info({ message: `The API secret was successfully reset and sent to ${username}` })
+    logger.info({ uuid: req.ctx.uuid, message: `The API secret was successfully reset and sent to ${username}` })
     const payload = {
       action: 'reset_userAPIkey',
       change: 'API secret was successfully reset.',
diff --git a/src/controller/org.controller/org.middleware.js b/src/controller/org.controller/org.middleware.js
index ded4b29b..41aa48d7 100644
--- a/src/controller/org.controller/org.middleware.js
+++ b/src/controller/org.controller/org.middleware.js
@@ -1,4 +1,3 @@
-const logger = require('../../middleware/logger')
 const CONSTANTS = require('../../constants')
 const { validationResult } = require('express-validator')
 const errors = require('./error')
@@ -8,8 +7,7 @@ const utils = require('../../utils/utils')
 function isOrgRole (val) {
   val.forEach(role => {
     if (!CONSTANTS.ORG_ROLES.includes(role)) {
-      logger.info('Invalid role for organization', role)
-      throw new Error('The organization role \'' + role + '\' does not exist.')
+      throw new Error('Organization role \'' + role + '\' does not exist.')
     }
   })
 
@@ -21,7 +19,7 @@ function parsePostParams (req, res, next) {
   utils.reqCtxMapping(req, 'query', [
     'shortname', 'name', 'id_quota', 'active',
     'active_roles.add', 'active_roles.remove',
-    'new_username', 'new_cna_shortname',
+    'new_username', 'org_shortname',
     'name.first', 'name.last', 'name.middle', 'name.suffix', 'name.surname'
   ])
   utils.reqCtxMapping(req, 'params', ['shortname', 'username'])
diff --git a/src/middleware/middleware.js b/src/middleware/middleware.js
index 7ae2eec0..5312b3c7 100644
--- a/src/middleware/middleware.js
+++ b/src/middleware/middleware.js
@@ -59,31 +59,31 @@ async function validateUser (req, res, next) {
       return res.status(400).json(error.badRequest(CONSTANTS.AUTH_HEADERS.KEY))
     }
 
-    logger.info({ message: 'Authenticating user: ' + user }) // userUUID may be null if user does not exist
+    logger.info({ uuid: req.ctx.uuid, message: 'Authenticating user: ' + user }) // userUUID may be null if user does not exist
     const orgUUID = await orgRepo.getOrgUUID(org)
     if (!orgUUID) {
-      logger.info({ message: org + ' organization does not exist. User authentication FAILED for ' + user })
+      logger.info({ uuid: req.ctx.uuid, message: org + ' organization does not exist. User authentication FAILED for ' + user })
       return res.status(401).json(error.unauthorized())
     }
 
     const result = await userRepo.findOneByUserNameAndOrgUUID(user, orgUUID)
     if (!result) {
-      logger.warn({ message: 'User not found. User authentication FAILED for ' + user })
+      logger.warn(JSON.stringify({ uuid: req.ctx.uuid, message: 'User not found. User authentication FAILED for ' + user }))
       return res.status(401).json(error.unauthorized())
     }
 
     if (!result.active) {
-      logger.warn({ message: 'User deactivated. Authentication failed for ' + user })
+      logger.warn(JSON.stringify({ uuid: req.ctx.uuid, message: 'User deactivated. Authentication failed for ' + user }))
       return res.status(401).json(error.unauthorized())
     }
 
     const isPwd = await argon2.verify(result.secret, key)
     if (!isPwd) {
-      logger.warn({ message: 'Incorrect apikey. User authentication FAILED for ' + user })
+      logger.warn(JSON.stringify({ uuid: req.ctx.uuid, message: 'Incorrect apikey. User authentication FAILED for ' + user }))
       return res.status(401).json(error.unauthorized())
     }
 
-    logger.info({ message: 'SUCCESSFUL user authentication for ' + user })
+    logger.info({ uuid: req.ctx.uuid, message: 'SUCCESSFUL user authentication for ' + user })
     next()
   } catch (err) {
     next(err)
@@ -98,11 +98,11 @@ async function onlySecretariat (req, res, next) {
   try {
     const isSec = await orgRepo.isSecretariat(org)
     if (!isSec) {
-      logger.info({ message: org + ' is NOT a ' + CONSTANTS.AUTH_ROLE_ENUM.SECRETARIAT })
+      logger.info({ uuid: req.ctx.uuid, message: org + ' is NOT a ' + CONSTANTS.AUTH_ROLE_ENUM.SECRETARIAT })
       return res.status(403).json(error.secretariatOnly())
     }
 
-    logger.info({ message: 'Confirmed ' + org + ' as a ' + CONSTANTS.AUTH_ROLE_ENUM.SECRETARIAT })
+    logger.info({ uuid: req.ctx.uuid, message: 'Confirmed ' + org + ' as a ' + CONSTANTS.AUTH_ROLE_ENUM.SECRETARIAT })
     next()
   } catch (err) {
     next(err)
@@ -117,13 +117,13 @@ async function onlyCnas (req, res, next) {
   try {
     const org = await orgRepo.findOneByShortName(shortName) // org exists
     if (org.authority.active_roles.includes(CONSTANTS.AUTH_ROLE_ENUM.SECRETARIAT)) {
-      logger.info({ message: org.short_name + ' is a ' + CONSTANTS.AUTH_ROLE_ENUM.SECRETARIAT + ' so until Root CNAs are implemented this role is allowed.' })
+      logger.info({ uuid: req.ctx.uuid, message: org.short_name + ' is a ' + CONSTANTS.AUTH_ROLE_ENUM.SECRETARIAT + ' so until Root organizations are implemented this role is allowed.' })
       next()
     } else if (org.authority.active_roles.includes(CONSTANTS.AUTH_ROLE_ENUM.CNA)) { // the org is a CNA
-      logger.info({ message: 'Confirmed ' + org.short_name + ' as a ' + CONSTANTS.AUTH_ROLE_ENUM.CNA })
+      logger.info({ uuid: req.ctx.uuid, message: 'Confirmed ' + org.short_name + ' as a ' + CONSTANTS.AUTH_ROLE_ENUM.CNA })
       next()
     } else {
-      logger.info({ message: org.short_name + ' is NOT a ' + CONSTANTS.AUTH_ROLE_ENUM.CNA })
+      logger.info({ uuid: req.ctx.uuid, message: org.short_name + ' is NOT a ' + CONSTANTS.AUTH_ROLE_ENUM.CNA })
       return res.status(403).json(error.cnaOnly())
     }
   } catch (err) {
@@ -137,7 +137,7 @@ function validateCveJsonSchema (req, res, next) {
     const cve = req.body
     const cveState = cve.CVE_data_meta.STATE
     let schema
-    logger.info('Validating CVE JSON schema.')
+    logger.info({ uuid: req.ctx.uuid, message: 'Validating CVE JSON schema.' })
 
     // For validating schema 4.0
     // if (cveState === 'PUBLIC' || cveState === 'RESERVED' || cveState === 'REJECT') {
@@ -163,11 +163,11 @@ function validateCveJsonSchema (req, res, next) {
     const result = v.validate(cve, schema, { nestedErrors: true })
 
     if (result.valid) {
-      logger.info('SUCCESSFUL CVE JSON schema validation.')
+      logger.info({ uuid: req.ctx.uuid, message: 'SUCCESSFUL CVE JSON schema validation.' })
       next()
     } else {
-      logger.error(result)
-      logger.error('CVE JSON schema validation FAILED.')
+      logger.error(JSON.stringify(result))
+      logger.error(JSON.stringify({ uuid: req.ctx.uuid, message: 'CVE JSON schema validation FAILED.' }))
 
       const temp = result.toString().split('\n')
       const errors = []
diff --git a/src/repositories/orgRepository.js b/src/repositories/orgRepository.js
index da774a05..5257f05c 100644
--- a/src/repositories/orgRepository.js
+++ b/src/repositories/orgRepository.js
@@ -19,8 +19,8 @@ class OrgRepository extends BaseRepository {
     return utils.getOrgUUID(shortName)
   }
 
-  async updateByOrgUUID (orgUUID, cna, options = {}) {
-    return this.collection.findOneAndUpdate().byUUID(orgUUID).updateOne(cna).setOptions(options)
+  async updateByOrgUUID (orgUUID, org, options = {}) {
+    return this.collection.findOneAndUpdate().byUUID(orgUUID).updateOne(org).setOptions(options)
   }
 
   async isSecretariat (shortName) {


Test patch:
diff --git a/test-utils/index.js b/test-utils/index.js
index 51f76c63..f58e9939 100644
--- a/test-utils/index.js
+++ b/test-utils/index.js
@@ -19,16 +19,6 @@ app.use(express.urlencoded({ extended: false })) // Allows us to handle url enco
 app.use(middleware.createCtxAndReqUUID)
 
 //* ************API Routes Setup*********** */
-//* ************* Cve Routes ************ */
-
-// // create cve
-// app.route('/api/test/cve')
-//   .post(cveController.CVE_SUBMIT)
-
-// // update cve
-// app.route('/api/test/cve/:id')
-//   .post(cveController.CVE_UPDATE_SINGLE)
-
 // --- create org --- //
 app.route('/org-created-when-uuid-undefined')
   .post((req, res, next) => {
@@ -272,7 +262,7 @@ app.route('/org-all-cnas-limit-5-2')
     next()
   }, orgController.ORG_ALL)
 
-app.route('/org-no-cnas-exist')
+app.route('/org-no-orgs-exist')
   .get((req, res, next) => {
     const factory = {
       getOrgRepository: () => { return new repos.OrgsCantGet() }
@@ -285,7 +275,7 @@ app.route('/org-no-cnas-exist')
 app.route('/user-not-created-org-does-not-exist/:shortname')
   .post((req, res, next) => {
     const factory = {
-      getOrgRepository: () => { return new repos.OrgCantCreateUserCnaDoesNotExist() },
+      getOrgRepository: () => { return new repos.OrgCantCreateUserOrgDoesNotExist() },
       getUserRepository: () => { return new repos.NullUserRepo() }
     }
     req.ctx.repositories = factory
@@ -295,7 +285,7 @@ app.route('/user-not-created-org-does-not-exist/:shortname')
 app.route('/user-not-created-org-does-not-match/:shortname')
   .post((req, res, next) => {
     const factory = {
-      getOrgRepository: () => { return new repos.OrgCantCreateUserCnaDoesNotMatch() },
+      getOrgRepository: () => { return new repos.OrgCantCreateUserOrgDoesNotMatch() },
       getUserRepository: () => { return new repos.NullUserRepo() }
     }
     req.ctx.repositories = factory
@@ -665,11 +655,11 @@ app.route('/cve-id-modify-secretariat-cve-id-doesnt-exist/:id')
     next()
   }, cveIdParams.parsePostParams, cveIdController.CVEID_UPDATE_SINGLE)
 
-app.route('/cve-id-modify-cna-doesnt-exist/:id')
+app.route('/cve-id-modify-org-doesnt-exist/:id')
   .post((req, res, next) => {
     const factory = {
       getCveIdRepository: () => { return new repos.NullCveIdRepo() },
-      getOrgRepository: () => { return new repos.OrgModifyCveIdCnaDoesntExist() },
+      getOrgRepository: () => { return new repos.OrgModifyCveIdOrgDoesntExist() },
       getUserRepository: () => { return new repos.NullUserRepo() }
     }
     req.ctx.repositories = factory
@@ -701,9 +691,9 @@ app.route('/cve-id-modify-state-query-is-invalid/:id')
 app.route('/cve-id-modify-org-and-state-modified/:id')
   .post((req, res, next) => {
     const factory = {
-      getCveIdRepository: () => { return new repos.CveIdModifyCveIdCnaAndStateModified() },
-      getOrgRepository: () => { return new repos.OrgModifyCveIdCnaAndStateModified() },
-      getUserRepository: () => { return new repos.UserModifyCveIdCnaAndStateModified() }
+      getCveIdRepository: () => { return new repos.CveIdModifyCveIdOrgAndStateModified() },
+      getOrgRepository: () => { return new repos.OrgModifyCveIdOrgAndStateModified() },
+      getUserRepository: () => { return new repos.UserModifyCveIdOrgAndStateModified() }
     }
     req.ctx.repositories = factory
     next()
@@ -713,8 +703,8 @@ app.route('/cve-id-modify-no-query/:id')
   .post((req, res, next) => {
     const factory = {
       getCveIdRepository: () => { return new repos.CveIdModifyCveIdNoQuery() },
-      getOrgRepository: () => { return new repos.OrgModifyCveIdCnaAndStateModified() },
-      getUserRepository: () => { return new repos.UserModifyCveIdCnaAndStateModified() }
+      getOrgRepository: () => { return new repos.OrgModifyCveIdOrgAndStateModified() },
+      getUserRepository: () => { return new repos.UserModifyCveIdOrgAndStateModified() }
     }
     req.ctx.repositories = factory
     next()
@@ -1161,7 +1151,7 @@ app.route('/validate-user-deactivated')
     return res.status(200).json({ message: 'Success! You have reached the target endpoint.' })
   })
 
-app.route('/validate-user-cna-undefined')
+app.route('/validate-user-org-undefined')
   .post((req, res, next) => {
     const factory = {
       getOrgRepository: () => { return new repos.NullOrgRepo() },
diff --git a/test-utils/repositories.js b/test-utils/repositories.js
index d2515370..f32e9c46 100644
--- a/test-utils/repositories.js
+++ b/test-utils/repositories.js
@@ -295,13 +295,13 @@ class OrgsCantGet {
   }
 }
 
-class OrgCantCreateUserCnaDoesNotExist {
+class OrgCantCreateUserOrgDoesNotExist {
   async getOrgUUID () {
     return null
   }
 }
 
-class OrgCantCreateUserCnaDoesNotMatch {
+class OrgCantCreateUserOrgDoesNotMatch {
   async getOrgUUID () {
     return orgMockObj.existentOrg.UUID
   }
@@ -523,13 +523,13 @@ class OrgModifyCveIdDoesntExist {
   }
 }
 
-class OrgModifyCveIdCnaDoesntExist {
+class OrgModifyCveIdOrgDoesntExist {
   async getOrgUUID () {
     return null
   }
 }
 
-class OrgModifyCveIdCnaAndStateModified {
+class OrgModifyCveIdOrgAndStateModified {
   async getOrgUUID () {
     return cveIdMockObj.org.UUID
   }
@@ -1281,7 +1281,7 @@ class CveIdModifyCveIdDoesntExist {
   }
 }
 
-class CveIdModifyCveIdCnaAndStateModified {
+class CveIdModifyCveIdOrgAndStateModified {
   async findOneByCveId () {
     return cveIdMockObj.cveReserved
   }
@@ -2504,7 +2504,7 @@ class UserGetCveIdRequestorSecretariat {
   }
 }
 
-class UserModifyCveIdCnaAndStateModified {
+class UserModifyCveIdOrgAndStateModified {
   async findOneByUUID () {
     return cveIdMockObj.owningOrgUser
   }
@@ -2614,8 +2614,8 @@ module.exports = {
   OrgsGetPaginationLimit51,
   OrgsGetPaginationLimit52,
   OrgsCantGet,
-  OrgCantCreateUserCnaDoesNotExist,
-  OrgCantCreateUserCnaDoesNotMatch,
+  OrgCantCreateUserOrgDoesNotExist,
+  OrgCantCreateUserOrgDoesNotMatch,
   OrgCreatedUserOrgUndefined,
   OrgUserNotUpdatedOrgDoesntExist,
   OrgUserNotUpdatedUserDoesntExist,
@@ -2637,8 +2637,8 @@ module.exports = {
   OrgGetCveIdRequestedNotChanged,
   OrgGetCveIdRequestedPagination,
   OrgModifyCveIdDoesntExist,
-  OrgModifyCveIdCnaDoesntExist,
-  OrgModifyCveIdCnaAndStateModified,
+  OrgModifyCveIdOrgDoesntExist,
+  OrgModifyCveIdOrgAndStateModified,
   OrgReserveNotOwningOrg,
   OrgReserveShortNameUndefined,
   OrgReserveOrgDoesntExist,
@@ -2686,7 +2686,7 @@ module.exports = {
   CveIdGetCveIdRequestedPaginationDefined1,
   CveIdGetCveIdRequestedPaginationDefined2,
   CveIdModifyCveIdDoesntExist,
-  CveIdModifyCveIdCnaAndStateModified,
+  CveIdModifyCveIdOrgAndStateModified,
   CveIdModifyCveIdNoQuery,
   CveIdRangeReserveYearDoesntExist,
   CveIdReserveSequentialYearDoesntExist,
@@ -2736,7 +2736,7 @@ module.exports = {
   UserGetUserDoesntExist,
   UserGetCveIdOwningOrg,
   UserGetCveIdRequestorSecretariat,
-  UserModifyCveIdCnaAndStateModified,
+  UserModifyCveIdOrgAndStateModified,
   UserReserveSequentialPriorityIsFull,
   UserReserveNonSequentialSuccess,
   UserReserveNonSequentialSuccessCaseAB,
diff --git a/test/unit-tests/cve-id/cveIdTest.js b/test/unit-tests/cve-id/cveIdTest.js
index 4a1dadf8..5fd320de 100644
--- a/test/unit-tests/cve-id/cveIdTest.js
+++ b/test/unit-tests/cve-id/cveIdTest.js
@@ -65,7 +65,7 @@ describe('Test ID Reservator Endpoints', () => {
     it('Requester is not a user of the same org or the secretariat and the cve is RESERVED', (done) => {
       chai.request(server)
         .get(`/cve-id-not-owning-org-reserved/${cveId}`)
-        .set(orgHeader) // not the owning cna or secretariat
+        .set(orgHeader) // not the owning org or secretariat
         .end((err, res) => {
           if (err) {
             done(err)
@@ -227,7 +227,7 @@ describe('Test ID Reservator Endpoints', () => {
 
     it('Updating the org of the user who requested the cve id', (done) => {
       chai.request(server)
-        .post(`/cve-id-filtered-update-user-org-request-cve-id-1/${owningOrg.short_name}/${owningOrgUser.username}?new_cna_shortname=${org.short_name}`)
+        .post(`/cve-id-filtered-update-user-org-request-cve-id-1/${owningOrg.short_name}/${owningOrgUser.username}?org_shortname=${org.short_name}`)
         .set(owningOrgHeader)
         .end((err) => {
           if (err) {
@@ -391,9 +391,9 @@ describe('Test ID Reservator Endpoints', () => {
         })
     })
 
-    it('Cna query parameter is provided but new cna does not exist', (done) => {
+    it('Org query parameter is provided but new org does not exist', (done) => {
       chai.request(server)
-        .post(`/cve-id-modify-cna-doesnt-exist/${cveId}?cna=${nonExistentOrg.short_name}`)
+        .post(`/cve-id-modify-org-doesnt-exist/${cveId}?org=${nonExistentOrg.short_name}`)
         .set(secretariatHeader)
         .end((err, res) => {
           if (err) {
@@ -447,7 +447,7 @@ describe('Test ID Reservator Endpoints', () => {
 
     it('Cve is reasigned to another org and state is modified', (done) => {
       chai.request(server)
-        .post(`/cve-id-modify-org-and-state-modified/${cveId}?state=REJECT&cna=${org.short_name}`)
+        .post(`/cve-id-modify-org-and-state-modified/${cveId}?state=REJECT&org=${org.short_name}`)
         .set(secretariatHeader)
         .end((err, res) => {
           if (err) {
diff --git a/test/unit-tests/middleware/middlewareTest.js b/test/unit-tests/middleware/middlewareTest.js
index 274fe9c9..bf292d69 100644
--- a/test/unit-tests/middleware/middlewareTest.js
+++ b/test/unit-tests/middleware/middlewareTest.js
@@ -250,7 +250,7 @@ describe('Test for middleware', () => {
       delete testHeaders[CONSTANTS.AUTH_HEADERS.ORG]
 
       chai.request(server)
-        .post('/validate-user-cna-undefined')
+        .post('/validate-user-org-undefined')
         .set(testHeaders)
         .send(cvePass5)
         .end((err, res) => {
diff --git a/test/unit-tests/org/orgTest.js b/test/unit-tests/org/orgTest.js
index 406c5b2e..458df8b6 100644
--- a/test/unit-tests/org/orgTest.js
+++ b/test/unit-tests/org/orgTest.js
@@ -503,7 +503,7 @@ describe('Test Org Controller', () => {
 
     it('Orgs do not exists', async () => {
       const res = await chai.request(server)
-        .get('/org-no-cnas-exist')
+        .get('/org-no-orgs-exist')
         .set(secretariatHeader)
 
       expect(res).to.have.status(200)
diff --git a/test/unit-tests/org/userTest.js b/test/unit-tests/org/userTest.js
index 0f42a405..99fff50b 100644
--- a/test/unit-tests/org/userTest.js
+++ b/test/unit-tests/org/userTest.js
@@ -242,7 +242,7 @@ describe('Test user functions in Org Controller', () => {
 
     it('User is not updated because the new shortname does not exist', (done) => {
       chai.request(server)
-        .post(`/user-not-updated-user-doesnt-exist/${existentOrg.short_name}/${existentUser.username}?new_cna_shortname=${nonExistentOrg.short_name}`)
+        .post(`/user-not-updated-user-doesnt-exist/${existentOrg.short_name}/${existentUser.username}?org_shortname=${nonExistentOrg.short_name}`)
         .set(secretariatHeader)
         .end((err, res) => {
           if (err) {