Caner Patır de57355d06 Initial commit
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00
2018-04-27 16:08:40 +03:00
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00
2018-05-04 15:39:39 +03:00

AntiSamy .NET

A .net standard library for performing configurable cleansing of HTML coming from untrusted sources.

Another way of saying that could be: It's an API that helps you make sure that clients don't supply malicious cargo code in the HTML they supply for their profile, comments, etc., that get persisted on the server. The term "malicious code" in regards to web applications usually mean "JavaScript." Mostly, Cascading Stylesheets are only considered malicious when they invoke the JavaScript. However, there are many situations where "normal" HTML and CSS can be used in a malicious manner.

How to Use

First, add the dependency from Nuget

install-package AntiSamy
Policy antiSamyPolicy = Policy.FromFile("<your_antisamy_xml_file_path>")
AntiSamy antiSamy = new AntiSamy(); 
string yourDirtyInput = "<DIV><INPUT TYPE=\"IMAGE\" SRC=\"javascript:alert('XSS');\"></DIV>";
AntiSamyResult result = antiSamy.Scan(yourDirtyInput, antiSamyPolicy);

string cleanHtml = result.CleanHtml; 
IEnumerable<string> errorMessages = result.ErrorMessages;

Referances

Description
No description provided
Readme 153 KiB
Languages
C# 95.2%
PowerShell 4.8%