diff --git a/src/Umbraco.Web.UI/config/splashes/booting.aspx b/src/Umbraco.Web.UI/config/splashes/booting.aspx
index 1bea61f89d..8dcd15c9c8 100644
--- a/src/Umbraco.Web.UI/config/splashes/booting.aspx
+++ b/src/Umbraco.Web.UI/config/splashes/booting.aspx
@@ -1,11 +1,14 @@
<%@ Page Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.Page" %>
+<%@ Import Namespace="System.Web.Mvc" %>
+<%@ Import Namespace="Umbraco.Web.Mvc" %>
<%
+ var urlHelper = new UrlHelper(Request.RequestContext);
+
// NH: Adds this inline check to avoid a simple codebehind file in the legacy project!
- if (Request["url"].ToLower().Contains("booting.aspx") || !umbraco.cms.helpers.url.ValidateProxyUrl(Request["url"], Request.Url.AbsoluteUri))
+ if (Request["url"].ToLower().Contains("booting.aspx") || urlHelper.ValidateProxyUrl(Request["url"], Request.Url.AbsoluteUri) == false)
{
- throw new ArgumentException("Can't redirect to the requested url - it's not local or an approved proxy url",
- "url");
+ throw new ArgumentException("Can't redirect to the requested url - it's not local or an approved proxy url", "url");
}
%>
diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/publish.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/publish.aspx
index e86108616d..d903f2273b 100644
--- a/src/Umbraco.Web.UI/umbraco/dialogs/publish.aspx
+++ b/src/Umbraco.Web.UI/umbraco/dialogs/publish.aspx
@@ -2,6 +2,7 @@
<%@ Import Namespace="Umbraco.Core" %>
<%@ Import Namespace="Umbraco.Web" %>
+<%@ Import Namespace="Umbraco.Web.Mvc" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
diff --git a/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx b/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx
index 4f16123fba..9cd2379610 100644
--- a/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx
+++ b/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx
@@ -6,6 +6,7 @@
<%@ Import Namespace="Umbraco.Core" %>
<%@ Import Namespace="Umbraco.Core.Configuration" %>
<%@ Import Namespace="Umbraco.Core.IO" %>
+<%@ Import Namespace="Umbraco.Web.Mvc" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
diff --git a/src/Umbraco.Web.UI/umbraco/settings/scripts/editScript.aspx b/src/Umbraco.Web.UI/umbraco/settings/scripts/editScript.aspx
index be0d68d3ba..beef2a401f 100644
--- a/src/Umbraco.Web.UI/umbraco/settings/scripts/editScript.aspx
+++ b/src/Umbraco.Web.UI/umbraco/settings/scripts/editScript.aspx
@@ -2,6 +2,7 @@
CodeBehind="editScript.aspx.cs" Inherits="umbraco.cms.presentation.settings.scripts.editScript"
ValidateRequest="False" %>
<%@ Import Namespace="Umbraco.Core" %>
+<%@ Import Namespace="Umbraco.Web.Mvc" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
diff --git a/src/Umbraco.Web.UI/umbraco/settings/stylesheet/editstylesheet.aspx b/src/Umbraco.Web.UI/umbraco/settings/stylesheet/editstylesheet.aspx
index 2f40b04ae0..f31cc9c430 100644
--- a/src/Umbraco.Web.UI/umbraco/settings/stylesheet/editstylesheet.aspx
+++ b/src/Umbraco.Web.UI/umbraco/settings/stylesheet/editstylesheet.aspx
@@ -1,6 +1,7 @@
<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" CodeBehind="editstylesheet.aspx.cs" AutoEventWireup="True"
Inherits="Umbraco.Web.UI.Umbraco.Settings.Stylesheet.EditStyleSheet" ValidateRequest="False" %>
<%@ Import Namespace="Umbraco.Core" %>
+<%@ Import Namespace="Umbraco.Web.Mvc" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="cdf" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
diff --git a/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx b/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx
index 6f5518706c..1e38071822 100644
--- a/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx
+++ b/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx
@@ -7,6 +7,7 @@
<%@ Import Namespace="Umbraco.Core" %>
<%@ Import Namespace="Umbraco.Core.IO" %>
<%@ Import Namespace="Umbraco.Web" %>
+<%@ Import Namespace="Umbraco.Web.Mvc" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
diff --git a/src/Umbraco.Web/Mvc/UrlHelperExtensions.cs b/src/Umbraco.Web/Mvc/UrlHelperExtensions.cs
index 543844ee08..b1cf5be546 100644
--- a/src/Umbraco.Web/Mvc/UrlHelperExtensions.cs
+++ b/src/Umbraco.Web/Mvc/UrlHelperExtensions.cs
@@ -1,24 +1,86 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Web.Mvc;
+using Umbraco.Core;
using Umbraco.Core.Configuration;
+using Umbraco.Core.IO;
-namespace Umbraco.Core
+namespace Umbraco.Web.Mvc
{
///
/// Extension methods for UrlHelper
///
public static class UrlHelperExtensions
{
+ ///
+ /// Utility method for checking for valid proxy urls or redirect urls to prevent Open Redirect security issues
+ ///
+ ///
+ /// The url to validate
+ /// The url of the current local domain (to ensure we can validate if the requested url is local without dependency on the request)
+ /// True if it's an allowed url
+ public static bool ValidateProxyUrl(this UrlHelper urlHelper, string url, string callerUrl)
+ {
+ if (Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute) == false)
+ {
+ return false;
+ }
- ///
- /// Returns the base path (not including the 'action') of the MVC controller "SaveFileController"
- ///
- ///
- ///
- public static string GetSaveFileServicePath(this UrlHelper url)
+ if (url.StartsWith("//"))
+ return false;
+
+ Uri requestUri;
+ if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out requestUri))
+ {
+ if (string.IsNullOrEmpty(callerUrl) == false)
+ {
+ Uri localUri;
+ if (Uri.TryCreate(callerUrl, UriKind.RelativeOrAbsolute, out localUri))
+ {
+ // check for local urls
+
+ //Cannot start with // since that is not a local url
+ if (requestUri.OriginalString.StartsWith("//") == false
+ //cannot be non-absolute and also contain the char : since that will indicate a protocol
+ && (requestUri.IsAbsoluteUri == false && requestUri.OriginalString.Contains(":") == false)
+ //needs to be non-absolute or the hosts must match the current request
+ && (requestUri.IsAbsoluteUri == false || requestUri.Host == localUri.Host))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ //we cannot continue if the url is not absolute
+ if (requestUri.IsAbsoluteUri == false)
+ {
+ return false;
+ }
+
+ // check for valid proxy urls
+ var feedProxyXml = XmlHelper.OpenAsXmlDocument(IOHelper.MapPath(SystemFiles.FeedProxyConfig));
+ if (feedProxyXml != null &&
+ feedProxyXml.SelectSingleNode(string.Concat("//allow[@host = '", requestUri.Host, "']")) != null)
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ return false;
+ }
+
+ ///
+ /// Returns the base path (not including the 'action') of the MVC controller "SaveFileController"
+ ///
+ ///
+ ///
+ public static string GetSaveFileServicePath(this UrlHelper url)
{
var result = url.Action("SavePartialView", "SaveFile", new {area = GlobalSettings.UmbracoMvcArea});
return result.TrimEnd("SavePartialView").EnsureEndsWith('/');
diff --git a/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs b/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs
index e73dbaa73f..2536a0f894 100644
--- a/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs
+++ b/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs
@@ -43,39 +43,7 @@ namespace umbraco.cms.businesslogic.macro
_isInitialized = true;
}
- }
-
- [Obsolete("Use EnsureInitialize method instead")]
- protected static void Initialize()
- {
- EnsureInitialize();
- }
-
- ///
- /// Returns a collectino of MacroEngineLanguage objects, each of which describes a file extension and an associated macro engine
- ///
- ///
- ///
- /// Until the macro engines are rewritten, this method explicitly ignores the PartialViewMacroEngine because this method
- /// is essentially just used for any macro engine that stores it's files in the ~/macroScripts folder where file extensions
- /// cannot overlap.
- ///
- [Obsolete("This method is not used and will be removed from the codebase in the future")]
- public static IEnumerable GetSupportedLanguages()
- {
- var languages = new List();
- foreach(var engine in GetAll())
- {
- foreach (string lang in engine.SupportedExtensions)
- {
- if (languages.Find(t => t.Extension == lang) == null)
- {
- languages.Add(new MacroEngineLanguage(lang, engine.Name));
- }
- }
- }
- return languages;
- }
+ }
///
/// Returns a collectino of MacroEngineLanguage objects, each of which describes a file extension and an associated macro engine that
diff --git a/src/umbraco.cms/helpers/url.cs b/src/umbraco.cms/helpers/url.cs
deleted file mode 100644
index 6518715be3..0000000000
--- a/src/umbraco.cms/helpers/url.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-using System;
-using System.Xml;
-using System.Text.RegularExpressions;
-using Umbraco.Core;
-using Umbraco.Core.IO;
-using Umbraco.Core.CodeAnnotations;
-
-namespace umbraco.cms.helpers
-{
- ///
- /// Summary description for url.
- ///
- public class url
- {
- public url()
- {
- //
- // TODO: Add constructor logic here
- //
- }
-
- [UmbracoWillObsolete("Use Umbraco.Core.StringExtensions.ToUrlSegment() instead.")]
- public static string FormatUrl(string url)
- {
- return url.ToUrlSegment();
- }
-
- ///
- /// Utility method for checking for valid proxy urls or redirect urls to prevent Open Redirect security issues
- ///
- /// The url to validate
- /// The url of the current local domain (to ensure we can validate if the requested url is local without dependency on the request)
- /// True if it's an allowed url
- public static bool ValidateProxyUrl(string url, string callerUrl)
- {
- if (!Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute))
- {
- return false;
- }
-
- if (url.StartsWith("//"))
- return false;
-
- Uri requestUri;
- if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out requestUri))
- {
- if (!string.IsNullOrEmpty(callerUrl))
- {
- Uri localUri;
- if (Uri.TryCreate(callerUrl, UriKind.RelativeOrAbsolute, out localUri))
- {
- // check for local urls
-
- //Cannot start with // since that is not a local url
- if (!requestUri.OriginalString.StartsWith("//")
- //cannot be non-absolute and also contain the char : since that will indicate a protocol
- && (!requestUri.IsAbsoluteUri && !requestUri.OriginalString.Contains(":"))
- //needs to be non-absolute or the hosts must match the current request
- && (!requestUri.IsAbsoluteUri || requestUri.Host == localUri.Host))
- {
- return true;
- }
- }
- else
- {
- //TODO: SD: why throw an exception?? shouldn't we just return false ?
- throw new ArgumentException("CallerUrl is in a wrong format that couldn't be parsed as a valid URI. If you don't want to evaluate for local urls, but just proxy urls then leave callerUrl empty", "callerUrl");
- }
- }
-
- //we cannot continue if the url is not absolute
- if (!requestUri.IsAbsoluteUri)
- {
- return false;
- }
-
- // check for valid proxy urls
- var feedProxyXml = XmlHelper.OpenAsXmlDocument(IOHelper.MapPath(SystemFiles.FeedProxyConfig));
- if (feedProxyXml != null &&
- feedProxyXml.SelectSingleNode(string.Concat("//allow[@host = '", requestUri.Host, "']")) != null)
- {
- return true;
- }
- }
- else
- {
- //TODO: SD: why throw an exception?? shouldn't we just return false ?
- throw new ArgumentException("url is in a wrong format that couldn't be parsed as a valid URI", "url");
-
- }
- return false;
- }
- }
-}
diff --git a/src/umbraco.cms/umbraco.cms.csproj b/src/umbraco.cms/umbraco.cms.csproj
index 692d3e3d9b..460979c7c9 100644
--- a/src/umbraco.cms/umbraco.cms.csproj
+++ b/src/umbraco.cms/umbraco.cms.csproj
@@ -365,9 +365,6 @@
Code
-
- Code
-