I am facing some issue of "Open Redirect", is there any direct solution or document which may help me.

pagereference p = new pagereference(returnUrl);
return p;

here Security issue is

Open Redirect Vulnerability

An open redirect is an application that takes a parameter and redirects a user to the parameter value without any validation. This vulnerability is used in phishing attacks to get users to visit malicious sites without realizing it.

I have redirect urls in alomost each class of mine.

  • Can you add a bit more detail about your problem, what is it that you are trying to do and what is the error or the result you can't achieve? Otherwise this question is likely to be closed. – Doug B Jul 1 '14 at 10:40
  • 1
    Add whats returnURL variable in your case? – Mohith Shrivastava Jul 1 '14 at 12:04

The information you are looking for can be found here: https://developer.salesforce.com/page/Secure_Coding_Arbitrary_Redirect

The general solution to the problem is to constrain the range of URLs to which your redirector will redirect. Constraining URLs by hostname is easy; the best way to do it is by keeping a list of known-good hostnames and checking that a URL’s hostname matches one in the list. You can also limit by known-good schemes and by known-good paths (perhaps using a regular expression).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.