I am creating response as below:
@Override
public Response post(String html,String headers) {
HttpEntity<String> requestPayload = new HttpEntity<String>(html,headers);
ResponseEntity<String> responseEntity = null;
responseEntity = restTemplate.postForEntity(uri, requestPayload,String.class);
String responseString = responseEntity.getBody().toString();
return Response.ok().entity(responseString).build();
}
Fortify is complaining
The method sends unvalidated data to a web browser on line xx, which can result in the browser executing malicious code.
Any idea how can I fix this?
You need to tell the spring controller that what format of data you would need to send a response from the back end.
For GET Request this needs to be added in controller. i.e.,
For POST request produces & consumes needs to be added