コード例 #1
0
ファイル: RequestSanitizer.cs プロジェクト: ziyasal/ProceXSS
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: ModuleWorker.cs プロジェクト: ziyasal/ProceXSS
 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;
 }
コード例 #4
0
ファイル: ModuleWorker.cs プロジェクト: ziyasal/ProceXSS
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
ファイル: XssGuard.cs プロジェクト: ziyasal/ProceXSS
 public XssGuard(IXssConfigurationHandler configuration, IRegexHelper regexHelper, ILogger logger)
 {
     _configuration = configuration;
     _regexHelper = regexHelper;
     _logger = logger;
 }
コード例 #7
0
ファイル: UrlChecker.cs プロジェクト: ziyasal/ProceXSS
 public UrlChecker(IXssConfigurationHandler moduleConfigurationHandler)
 {
     _moduleConfigurationHandler = moduleConfigurationHandler;
 }
コード例 #8
0
ファイル: XssGuard.cs プロジェクト: ziyasal/ProceXSS
 public XssGuard(IXssConfigurationHandler configuration, IRegexHelper regexHelper, ILogger logger)
 {
     _configuration = configuration;
     _regexHelper   = regexHelper;
     _logger        = logger;
 }
コード例 #9
0
ファイル: XssDetector.cs プロジェクト: mustafagenc/ProceXSS
 public XssDetector(IXssConfigurationHandler configuration, IRegexProcessor regexProcessor,ILogger logger)
 {
     _configuration = configuration;
     _regexProcessor = regexProcessor;
     _logger = logger;
 }
コード例 #10
0
 public UrlChecker(IXssConfigurationHandler moduleConfigurationHandler)
 {
     _moduleConfigurationHandler = moduleConfigurationHandler;
 }