I am getting alert in Checkmarx scan saying Unsafe object binding in the saveAll() call. The exact words in checkmarx are
The orderReqDto at src/main/java/com/coppel/omnicanal/coppelpay/controller/ValidarClienteController.java in line 69
may unintentionally allow setting the value of saveAll in validarPlazosCliente, in the object
src/main/java/com/coppel/omnicanal/coppelpay/bussines/CustomerValidationBussines.java at line 392.
Any idea how to rewrite the code , so that the checkmarx stops complaining.
My code:
@PostMapping("/pos/num-cliente")
public BaseResponseDTO<CustomerValidationRespDto<PlazoDto>> validateCustomerPosNumCliente(@Valid @RequestBody NumClienteReqDto orderReqDto, HttpServletRequest req) throws Exception {
// * Obtiene data de JWT de interceptor
JwtDto data = (JwtDto) req.getAttribute(DATA_DTO);
return compraBussines.validarCliente(orderReqDto.getNumCliente(), null, data, null);
}
412. clientePlazosDao.saveAll(plazosValidos);
Need fix this vulnerability.