function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pratik Raut 14Pratik Raut 14 

Potential URL Redirection Attack

Hi All,
In the code scanning, I am facing the Potential URL Redirection Attack issue.
Scan Result:
User-added image
Can anyone please provide me any solution on this?

Thanks,
Pratik
Khan AnasKhan Anas (Salesforce Developers) 
Hi Pratik,

Greetings to you!

According to Salesforce doc:

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).

Please refer to below links which might help you further.

https://trailhead.salesforce.com/en/content/learn/modules/secdev_application_logic_vulnerabilities

https://developer.salesforce.com/forums/?id=906F000000092MSIAY

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas