We are using a third party company to scan our salesforce code for SOQL Injection and Vulnerability issues with open page redirects. The below code is flagged as a vulnerability.
public Pagereference customCancel() {
Pagereference objPageref = new Pagereference('/apex/FulcrumInlineEdit?id='+OptyId);
objPageref.setRedirect(true);
return objPageref;
}
The page is not using any URL hacking mechanisms like saveUrl, retUrl or cancelUrl. Based on the information given in the trailhead Prevent Open Redirects in your code, I am not sure how to modify the above code to make it secure. Can someone help?