using Ganss.XSS;

namespace CollAction.Helpers
{
    public static class InputSanitizer
    {
        public static string Sanitize(string input)
        {
            var saniziter = new HtmlSanitizer(
                allowedTags: new[] { "p", "br", "strong", "em", "i", "u", "a", "ol", "ul", "li" },
                allowedAttributes: new[] { "href", "target" },
                allowedCssClasses: new string[] {},
                allowedCssProperties: new string[] {}                    
            );

            return saniziter.Sanitize(input);

        }
    }
}
using Ganss.XSS;

namespace CollAction.Helpers
{
    public static class InputSanitizer
    {
        public static string Sanitize(string input)
        {
            var saniziter = new HtmlSanitizer(
                allowedTags: new[] { "p", "br", "strong", "em", "i", "u", "a", "ol", "ul", "li" },
                allowedSchemes: new string[] { "http", "https"},
                allowedAttributes: new[] { "target" },
                uriAttributes: new[] { "href" },
                allowedCssProperties: new string[] {},
                allowedCssClasses: new string[] {}
            );

            return saniziter.Sanitize(input);
        }
    }
}
Allow only http/https schemes, and href attribute to contain an uri.
Allow only http/https schemes, and href attribute to contain an uri.
