Skip to content

Commit

Permalink
Cosmetic changes.
Browse files Browse the repository at this point in the history
Bumped version to 1.1.4.
  • Loading branch information
cakkermans committed May 13, 2016
1 parent 557376f commit 1556d57
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
6 changes: 4 additions & 2 deletions Web.HtmlSanitizer.Tests/AttributeCheckTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public void AHrefUrlCheckRelativeTest()
}



/// <summary>
/// Verifies the functioning of the URL check on src attributes.
/// </summary>
[Fact]
public void ImgSrcUrlCheckTest()
{
Expand All @@ -67,7 +69,7 @@ public void ImgSrcUrlCheckTest()
Assert.Equal(expectedIllegal, result);

// Test a legal well formed url
var inputLegal = @"<img src=""http://www.google.com/a.png"">>";
var inputLegal = @"<img src=""http://www.google.com/a.png"">";
result = sanitizer.Sanitize(inputLegal);
Assert.Equal(inputLegal, result);
}
Expand Down
9 changes: 5 additions & 4 deletions Web.HtmlSanitizer/HtmlSanitizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public HtmlSanitizer()
private void RegisterChecks()
{

AttributeCheckRegistry.Add(HtmlSanitizerCheckType.Url, new HtmlSanitizerAttributeCheckHandler(LinkHrefCheck));
AttributeCheckRegistry.Add(HtmlSanitizerCheckType.Url, new HtmlSanitizerAttributeCheckHandler(UrlCheckHandler));
AttributeCheckRegistry.Add(HtmlSanitizerCheckType.AllowAttribute, new HtmlSanitizerAttributeCheckHandler(x => SanitizerOperation.DoNothing));
}

Expand Down Expand Up @@ -100,13 +100,14 @@ public static bool AttributeUrlCheck(HtmlAttribute attribute)
}

/// <summary>
/// Checks if the href attribute contains a valid link.
/// Checks if the attribute contains a valid link.
/// </summary>
/// <param name="attribute"></param>
/// <returns></returns>
public static SanitizerOperation LinkHrefCheck(HtmlAttribute attribute)
public static SanitizerOperation UrlCheckHandler(HtmlAttribute attribute)
{
// Check the url. There's no use in keeping link tags without a link, so flatten the tag on failure.

// Check the url. We assume that there's no use in keeping for example a link tag without a href, so flatten the tag on failure.
if (!AttributeUrlCheck(attribute))
return SanitizerOperation.FlattenTag;

Expand Down
4 changes: 2 additions & 2 deletions Web.HtmlSanitizer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.3.0")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyVersion("1.1.4.0")]
[assembly: AssemblyFileVersion("1.1.4.0")]
4 changes: 2 additions & 2 deletions Web.HtmlSanitizer/Web.HtmlSanitizer.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package >
<metadata>
<id>Vereyon.Web.HtmlSanitizer</id>
<version>1.1.3.0</version>
<version>1.1.4.0</version>
<title>HtmlRuleSanitizer</title>
<authors>Vereyon</authors>
<owners>Vereyon</owners>
<licenseUrl>https://github.com/Vereyon/HtmlRuleSanitizer/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/Vereyon/HtmlRuleSanitizer</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Rule based HTML sanitizer using a white list. Documentation at: https://github.com/Vereyon/HtmlRuleSanitizer</description>
<releaseNotes>Fixed relative urls not passing check.</releaseNotes>
<releaseNotes>Fixed unclosed tags not being handled correctly. Added url checks for src attributes.</releaseNotes>
<copyright>Copyright 2016</copyright>
<tags>ASP.NET MVC HTML sanitizer XSS antixss anti security</tags>
</metadata>
Expand Down

0 comments on commit 1556d57

Please sign in to comment.