Getting the following Fortify error:
The Fortify description is: The method xxx() in xxx.java sends unvalidated data to a web browser on line 168, which can result in the browser executing malicious code.
This is our code in Java that sends an Ajax response.
@ResponseBody
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@POST
@RequestMapping(value = "/onConfirmSubmit")
public ResponseEntity<String> onConfirmSubmit(@RequestBody @Valid final Form form,
final HttpServletRequest request, final HttpServletResponse response)
throws Exception, ServiceException {
final HttpHeaders headers = new HttpHeaders();
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON);
HttpStatus responseStatus = HttpStatus.OK;
handler.populateData(form);
String body = handler.processRequest(form, request);
return ResponseEntity.status(responseStatus).body(body);
}