Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove HtmlSanitizer #9803

Merged
merged 2 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build/NuSpecs/UmbracoCms.Web.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<dependency id="Microsoft.Owin.Security.Cookies" version="[4.0.1,4.999999)" />
<dependency id="Microsoft.Owin.Security.OAuth" version="[4.0.1,4.999999)" />
<dependency id="System.Threading.Tasks.Dataflow" version="[4.9.0,4.999999)" />
<dependency id="HtmlSanitizer" version="[4.0.217,4.999999)" />

</group>

Expand Down
23 changes: 0 additions & 23 deletions src/Umbraco.Core/Constants-SvgSanitizer.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/Umbraco.Core/Umbraco.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@
<Compile Include="CompositionExtensions_Essentials.cs" />
<Compile Include="CompositionExtensions_FileSystems.cs" />
<Compile Include="CompositionExtensions_Uniques.cs" />
<Compile Include="Constants-SvgSanitizer.cs" />
<Compile Include="Exceptions\PanicException.cs" />
<Compile Include="FactoryExtensions.cs" />
<Compile Include="Composing\RegisterFactory.cs" />
Expand Down
10 changes: 1 addition & 9 deletions src/Umbraco.Web/Services/IconService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Ganss.XSS;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
Expand Down Expand Up @@ -68,20 +67,13 @@ private IconModel GetIcon(FileInfo fileInfo)
/// <returns></returns>
private IconModel CreateIconModel(string iconName, string iconPath)
{
var sanitizer = new HtmlSanitizer();
sanitizer.AllowedAttributes.UnionWith(Constants.SvgSanitizer.Attributes);
sanitizer.AllowedCssProperties.UnionWith(Constants.SvgSanitizer.Attributes);
sanitizer.AllowedTags.UnionWith(Constants.SvgSanitizer.Tags);

try
{
var svgContent = System.IO.File.ReadAllText(iconPath);
var sanitizedString = sanitizer.Sanitize(svgContent);

var svg = new IconModel
{
Name = iconName,
SvgString = sanitizedString
SvgString = svgContent
};

return svg;
Expand Down
3 changes: 0 additions & 3 deletions src/Umbraco.Web/Umbraco.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@
<PackageReference Include="CSharpTest.Net.Collections" Version="14.906.1403.1082" />
<PackageReference Include="Examine" Version="1.0.2" />
<PackageReference Include="HtmlAgilityPack" Version="1.8.14" />
<PackageReference Include="HtmlSanitizer">
<Version>4.0.217</Version>
</PackageReference>
<PackageReference Include="ImageProcessor">
<Version>2.7.0.100</Version>
</PackageReference>
Expand Down