I am currently facing Checkmarx scan issue for the below snippet:
The application's
getResponse
embeds untrusted data in the generated output withsetCatList
, atline 10
ofMyClass.java
. This untrusted data is embedded straight into the output without proper sanitization or encoding, enabling an attacker to inject malicious code into the output. This can enable a Reflected Cross-Site Scripting (XSS) attack.
GetCatSP sp = getCatSP(); // GetCatSP extends StoredProcedure
Map<String, Object> output = sp.getMyData(inParams); // This executes super.execute(inParams) and returns it
List<Cat> catList = (List<Cat>) output.get("cat_info");
response.setCatList(catList);
How do I handle this?