MKim147913 (Community Member) asked a question.

How to fix CWE 601 URL Redirection to Untrusted Site('Open Redirect') for Android?

The app uses the loadUrl function to transfer information from the app to the web. A defect was found in the veracode result report, so I added logic to check its validity, but it still came out as a defect. How do I fix this?

It was discovered in two places.

1. Information delivery via web URL - webView.loadUrl(it ?: webUrl, mapOf("User-Agent" to Constant.USER_AGENT))

- Modified to check web url(it)

2. Passing string value for callback - it.post { it.loadUrl(callbackStr)

- Passed only if it starts with javascript

if(callbackStr.matches(Regex("^javascript:.*$", RegexOption.DOT_MATCHES_ALL)))

 

Please provide guidance on how to fix it.


Topics (4)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.