@@ -48,6 +48,18 @@ function validateCreateOrgParameters () {
4848 . isArray ( ) ,
4949 body ( [ 'root_or_tlr' ] ) . default ( false )
5050 . isBoolean ( ) ,
51+ body ( [ 'vulnerability_advisory_locations' ] )
52+ . default ( [ ] )
53+ . custom ( isFlatStringArray ) ,
54+ body ( [ 'advisory_location_require_credentials' ] )
55+ . default ( false )
56+ . isBoolean ( ) ,
57+ body ( [ 'tl_root_start_date' ] )
58+ . default ( null )
59+ . isDate ( ) ,
60+ body ( [ 'is_cna_discussion_list' ] )
61+ . default ( false )
62+ . isBoolean ( ) ,
5163 body (
5264 [
5365 'charter_or_scope' ,
@@ -58,7 +70,10 @@ function validateCreateOrgParameters () {
5870 'contact_info.poc_email' ,
5971 'contact_info.poc_phone' ,
6072 'contact_info.org_email' ,
61- 'contact_info.website'
73+ 'contact_info.website' ,
74+ 'cna_role_type' ,
75+ 'cna_country' ,
76+ 'industry'
6277 ] )
6378 . default ( '' )
6479 . isString ( ) ,
@@ -119,7 +134,14 @@ function validateCreateOrgParameters () {
119134 'contact_info.poc_phone' ,
120135 'contact_info.org_email' ,
121136 'contact_info.additional_contact_users' ,
122- 'contact_info.website' )
137+ 'contact_info.website' ,
138+ 'cna_role_type' ,
139+ 'cna_country' ,
140+ 'vulnerability_advisory_locations' ,
141+ 'advisory_location_require_credentials' ,
142+ 'industry' ,
143+ 'tl_root_start_date' ,
144+ 'is_cna_discussion_list' )
123145 ]
124146 }
125147
@@ -169,8 +191,8 @@ function validateUpdateOrgParameters () {
169191 const useRegistry = req . query . registry === 'true'
170192
171193 const legacyParametersOnly = [ 'id_quota' , 'name' ]
172- const registryParametersOnly = [ 'hard_quota' , 'long_name' , 'cve_program_org_function' , 'oversees' , 'root_or_tlr' , 'charter_or_scope' , 'disclosure_policy' , 'product_list' ]
173- const sharedParameters = [ 'new_short_name' , 'active_roles.add' , 'active_roles.remove' ]
194+ const registryParametersOnly = [ 'hard_quota' , 'long_name' , 'cve_program_org_function' , 'oversees' , 'root_or_tlr' , 'charter_or_scope' , 'disclosure_policy' , 'product_list' , 'cna_role_type' , 'cna_country' , 'vulnerability_advisory_locations' , 'advisory_location_require_credentials' , 'industry' , 'tl_root_start_date' , 'is_cna_discussion_list' ]
195+ const sharedParameters = [ 'new_short_name' , 'active_roles.add' , 'active_roles.remove' , 'registry' ]
174196
175197 const allParameters = [
176198 ...legacyParametersOnly , ...registryParametersOnly , ...sharedParameters
@@ -191,28 +213,40 @@ function validateUpdateOrgParameters () {
191213
192214 if ( useRegistry ) {
193215 validations . push (
194-
195- query ( [ 'hard_quota' ] ) . optional ( ) . not ( ) . isArray ( ) . isInt ( { min : CONSTANTS . MONGOOSE_VALIDATION . Org_policies_id_quota_min , max : CONSTANTS . MONGOOSE_VALIDATION . Org_policies_id_quota_max } ) . withMessage ( errorMsgs . ID_QUOTA ) ,
216+ query ( [ 'hard_quota' ] )
217+ . optional ( )
218+ . not ( )
219+ . isArray ( )
220+ . isInt ( {
221+ min : CONSTANTS . MONGOOSE_VALIDATION . Org_policies_id_quota_min ,
222+ max : CONSTANTS . MONGOOSE_VALIDATION . Org_policies_id_quota_max
223+ } )
224+ . withMessage ( errorMsgs . ID_QUOTA ) ,
196225 query ( [ 'long_name' ] ) . optional ( ) . isString ( ) . trim ( ) . notEmpty ( ) ,
197226 query ( [ 'oversees' ] ) . optional ( ) . isArray ( ) ,
198227 query ( [ 'root_or_tlr' ] ) . optional ( ) . isBoolean ( ) ,
199- query (
200- [
201- 'cve_program_org_function' ,
202- 'charter_or_scope' ,
203- 'disclosure_policy' ,
204- 'product_list' ,
205- 'contact_info.poc' ,
206- 'contact_info.poc_email' ,
207- 'contact_info.poc_phone' ,
208- 'contact_info.org_email' ,
209- 'contact_info.website'
210- ] )
228+ query ( [
229+ 'cve_program_org_function' ,
230+ 'charter_or_scope' ,
231+ 'disclosure_policy' ,
232+ 'product_list' ,
233+ 'contact_info.poc' ,
234+ 'contact_info.poc_email' ,
235+ 'contact_info.poc_phone' ,
236+ 'contact_info.org_email' ,
237+ 'contact_info.website' ,
238+ 'cna_role_type' ,
239+ 'cna_country' ,
240+ 'vulnerability_advisory_locations' ,
241+ 'advisory_location_require_credentials' ,
242+ 'industry' ,
243+ 'tl_root_start_date' ,
244+ 'is_cna_discussion_list'
245+ ] )
211246 . optional ( )
212247 . isString ( ) ,
213248 ...isNotAllowedQuery ( ...legacyParametersOnly )
214249 // if we decide that we want to allow more, we can add them here.
215-
216250 )
217251 } else {
218252 validations . push (
@@ -273,10 +307,20 @@ function isUserRole (val) {
273307function parsePostParams ( req , res , next ) {
274308 utils . reqCtxMapping ( req , 'body' , [ ] )
275309 utils . reqCtxMapping ( req , 'query' , [
276- 'new_short_name' , 'name' , 'id_quota' , 'active' ,
277- 'active_roles.add' , 'active_roles.remove' ,
278- 'new_username' , 'org_short_name' ,
279- 'name.first' , 'name.last' , 'name.middle' , 'name.suffix' , 'long_name' , 'cve_program_org_function' ,
310+ 'new_short_name' ,
311+ 'name' ,
312+ 'id_quota' ,
313+ 'active' ,
314+ 'active_roles.add' ,
315+ 'active_roles.remove' ,
316+ 'new_username' ,
317+ 'org_short_name' ,
318+ 'name.first' ,
319+ 'name.last' ,
320+ 'name.middle' ,
321+ 'name.suffix' ,
322+ 'long_name' ,
323+ 'cve_program_org_function' ,
280324 'charter_or_scope' ,
281325 'disclosure_policy' ,
282326 'product_list' ,
@@ -285,7 +329,16 @@ function parsePostParams (req, res, next) {
285329 'contact_info.poc_phone' ,
286330 'contact_info.org_email' ,
287331 'hard_quota' ,
288- 'contact_info.website' , 'root_or_tlr' , 'oversees'
332+ 'contact_info.website' ,
333+ 'root_or_tlr' ,
334+ 'oversees' ,
335+ 'cna_role_type' ,
336+ 'cna_country' ,
337+ 'vulnerability_advisory_locations' ,
338+ 'advisory_location_require_credentials' ,
339+ 'industry' ,
340+ 'tl_root_start_date' ,
341+ 'is_cna_discussion_list'
289342 ] )
290343 utils . reqCtxMapping ( req , 'params' , [ 'shortname' , 'username' ] )
291344 next ( )
0 commit comments