public void Clean(NameValueCollection collection, IXssConfigurationHandler configuration, EncoderType encoderType = EncoderType.AutoDetect) { if (string.IsNullOrWhiteSpace(configuration.ControlRegex)) { _xssDetectRegex = new Regex(_regexHelper.XssPattern, RegexOptions.IgnoreCase); } else { try { _xssDetectRegex = new Regex(HttpUtility.HtmlDecode(configuration.ControlRegex), RegexOptions.IgnoreCase); } catch { _xssDetectRegex = new Regex(_regexHelper.XssPattern, RegexOptions.IgnoreCase); } } PropertyInfo readonlyProperty = _reflectionHelper.MakeWritable(collection); for (int i = 0; i < collection.Count; i++) { if (string.IsNullOrWhiteSpace(collection[i])) { continue; } IterateCleanUp(encoderType, collection, i); } readonlyProperty.SetValue(collection, true, null); }
public void Clean(NameValueCollection collection, IXssConfigurationHandler configuration, EncoderType encoderType = EncoderType.AutoDetect) { if (string.IsNullOrWhiteSpace(configuration.ControlRegex)) { _xssDetectRegex = new Regex(_regexProcessor.XssPattern, RegexOptions.IgnoreCase); } else { try { _xssDetectRegex = new Regex(HttpUtility.HtmlDecode(configuration.ControlRegex),RegexOptions.IgnoreCase); } catch { _xssDetectRegex = new Regex(_regexProcessor.XssPattern,RegexOptions.IgnoreCase); } } PropertyInfo readonlyProperty = _reflector.MakeWritable(collection); for (int i = 0; i < collection.Count; i++) { if (string.IsNullOrWhiteSpace(collection[i])) { continue; } IterateCleanUp(encoderType, collection, i); } readonlyProperty.SetValue(collection, true, null); }
public ModuleWorker(IXssConfigurationHandler configuration, IUrlChecker urlChecker, IRequestSanitizer requestSanitizer, IXssGuard xssGuard, IIpAdressHelper ipAdressHelper, ILogger logger) { _configuration = configuration; _urlChecker = urlChecker; _requestSanitizer = requestSanitizer; _xssGuard = xssGuard; _ipAdressHelper = ipAdressHelper; _logger = logger; }
public RequestProcessor(HttpApplication httpApplication, IXssConfigurationHandler configuration, IUrlChecker urlChecker, IRequestCleaner requestCleaner, IXssDetector xssDetector, IIpAdressHelper ipAdressHelper, ILogger logger) { _httpApplication = httpApplication; _configuration = configuration; _urlChecker = urlChecker; _requestCleaner = requestCleaner; _xssDetector = xssDetector; _ipAdressHelper = ipAdressHelper; _logger = logger; }
public XssGuard(IXssConfigurationHandler configuration, IRegexHelper regexHelper, ILogger logger) { _configuration = configuration; _regexHelper = regexHelper; _logger = logger; }
public UrlChecker(IXssConfigurationHandler moduleConfigurationHandler) { _moduleConfigurationHandler = moduleConfigurationHandler; }
public XssDetector(IXssConfigurationHandler configuration, IRegexProcessor regexProcessor,ILogger logger) { _configuration = configuration; _regexProcessor = regexProcessor; _logger = logger; }