Removing malicious code from the name of a Stylesheet.

This commit is contained in:
elitsa
2018-12-03 08:45:11 +01:00
parent 5f165d23db
commit 3a26fe8fe2
3 changed files with 4 additions and 4 deletions

View File

@@ -190,7 +190,7 @@ namespace Umbraco.Core
return new string(outputArray);
}
private static readonly char[] CleanForXssChars = "*?(){}[];:%<>/\\|&'\"".ToCharArray();
private static readonly char[] CleanForXssChars = "*?(){}[];:%<>/\\|&'+\"".ToCharArray();
/// <summary>
/// Cleans string to aid in preventing xss attacks.
@@ -541,7 +541,7 @@ namespace Umbraco.Core
/// <returns>Returns the string without any html tags.</returns>
public static string StripHtml(this string text)
{
const string pattern = @"<(.|\n)*?>";
string pattern = "[*{}\\/:<>?|\"-+()\\n]";
return Regex.Replace(text, pattern, String.Empty);
}

View File

@@ -207,7 +207,7 @@ namespace Umbraco.Web.UI
typeInstance.TypeID = typeId;
typeInstance.ParentID = nodeId;
typeInstance.Alias = text;
typeInstance.Alias = text.CleanForXss();
// check for returning url
ITaskReturnUrl returnUrlTask = typeInstance as LegacyDialogTask;

View File

@@ -243,7 +243,7 @@ namespace Umbraco.Web.WebServices
// sanitize input - stylesheet names have no extension
var svce = (FileService)Services.FileService;
filename = CleanFilename(filename);
filename = CleanFilename(filename.CleanForXss());
oldName = CleanFilename(oldName);
if (filename != oldName)