File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/management/identities/validations Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import {additionalFieldsPartDto} from '../_dto/_parts/additionalFields.dto';
1616 */
1717@Injectable ( )
1818export class IdentitiesValidationService implements OnApplicationBootstrap {
19- private ajv : Ajv = new Ajv ( { allErrors : true } ) ;
19+ private ajv : Ajv = new Ajv ( { allErrors : true } ) ;
2020 private validateSchema ;
2121 private logger : Logger ;
2222
@@ -332,6 +332,12 @@ export class IdentitiesValidationService implements OnApplicationBootstrap {
332332 }
333333
334334 this . logger . debug ( `Additionalfields object validation: ${ JSON . stringify ( data [ key ] ) } ` ) ;
335+ //limitation de la taille du data pour le pb de deny of service de ajv
336+ //voir (https://ajv.js.org/security.html)
337+ if ( Object . keys ( data [ key ] ) . length > 500 ) {
338+ this . logger . error ( 'Request too large' ) ;
339+ throw new BadRequestException ( 'Request too large' ) ;
340+ }
335341 const ok = await this . ajv . validate ( schema , data [ key ] ) ;
336342 if ( ok === false ) {
337343 const retErrors = { } ;
You can’t perform that action at this time.
0 commit comments