Skip to content

Commit

Permalink
Merge pull request #1486 from dnnsoftware/bug/DNN-5873
Browse files Browse the repository at this point in the history
DNN-5873: check the http protocol without query string.
  • Loading branch information
Kan Ma committed Jun 17, 2016
2 parents a33a716 + 9b331ee commit 7266610
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion DNN Platform/Library/Common/Utilities/UrlUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,12 @@ public static string ValidReturnUrl(string url)
}

//redirect url should never contain a protocol ( if it does, it is likely a cross-site request forgery attempt )
if (url.Contains("://"))
var urlWithNoQuery = url;
if (urlWithNoQuery.Contains("?"))
{
urlWithNoQuery = urlWithNoQuery.Substring(0, urlWithNoQuery.IndexOf("?", StringComparison.InvariantCultureIgnoreCase));
}
if (urlWithNoQuery.Contains("://"))
{
var portalSettings = PortalSettings.Current;
if (portalSettings == null ||
Expand Down

0 comments on commit 7266610

Please sign in to comment.