Merge branch 'master' of https://github.com/umbraco/Umbraco-CMS into 7.0.0

Conflicts:
	.gitignore
This commit is contained in:
Sebastiaan Janssen
2013-11-20 14:50:57 +01:00
3 changed files with 26 additions and 8 deletions

View File

@@ -101,7 +101,7 @@ namespace Umbraco.Web.UI.Install.Steps {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox DatabaseName;
/// <summary>
/// DatabaseIntegratedSecurity control.
/// </summary>

View File

@@ -114,11 +114,18 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views
NameTxt.Text = OriginalFileName;
var file = IOHelper.MapPath(SystemDirectories.MvcViews.EnsureEndsWith('/') + OriginalFileName);
// validate file path
if (file.StartsWith(IOHelper.MapPath(SystemDirectories.MvcViews.EnsureEndsWith('/')))) {
using (var sr = File.OpenText(file))
{
var s = sr.ReadToEnd();
editorSource.Text = s;
}
}
} else
{
throw new ArgumentException("Couldn't open file - illegal path");
}
}
}

View File

@@ -89,13 +89,24 @@ namespace umbraco.webservices
{
//NOTE: The legacy code threw an exception so will continue to do that.
AuthorizeRequest(DefaultApps.settings.ToString(), true);
var templateFile =
System.IO.File.OpenText(IOHelper.MapPath(SystemDirectories.Umbraco + "/scripting/templates/cshtml/" + templateId));
var content = templateFile.ReadToEnd();
templateFile.Close();
return content;
var snippetPath = SystemDirectories.Umbraco + "/scripting/templates/cshtml/";
var filePath = IOHelper.MapPath(snippetPath + templateId);
//Directory check.. only allow files in script dir and below to be edited
if (filePath.StartsWith(IOHelper.MapPath(snippetPath)))
{
var templateFile =
System.IO.File.OpenText(filePath);
var content = templateFile.ReadToEnd();
templateFile.Close();
return content;
}
else
{
throw new ArgumentException("Couldn't open snippet - Illegal path");
}
}
}