Exemplo n.º 1
0
        public void Test_AddDuplicateThreshold()
        {
            string evtName = Guid.NewGuid().ToString();

            IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector;

            Assert.IsNotNull(detector);

            Threshold threshold = new Threshold(evtName, 1, 1, new[] { BuiltinActions.FormsAuthenticationLogout });

            detector.AddThreshold(threshold);

            Threshold dup = new Threshold(evtName, 2, 2, null);

            detector.AddThreshold(dup);
        }
Exemplo n.º 2
0
        public void Test_AddNullThreshold()
        {
            IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector;

            Assert.IsNotNull(detector);

            detector.AddThreshold(null);
        }
Exemplo n.º 3
0
        public void Test_AddThresholdMissingAction()
        {
            string evtName = Guid.NewGuid().ToString();

            IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector;

            Assert.IsNotNull(detector);

            Threshold threshold = new Threshold(evtName, 1, 1, new[] { Guid.NewGuid().ToString() });

            detector.AddThreshold(threshold);
        }
Exemplo n.º 4
0
        public void Test_IntrusionDetected()
        {
            string evtName = Guid.NewGuid().ToString();

            IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector;

            Assert.IsNotNull(detector);

            Threshold threshold = new Threshold(evtName, 1, 1, new[] { "log" });

            detector.AddThreshold(threshold);

            Esapi.IntrusionDetector.AddEvent(evtName);
        }
Exemplo n.º 5
0
        public void Test_RemoveThreshold()
        {
            string evtName = Guid.NewGuid().ToString();

            IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector;

            Assert.IsNotNull(detector);

            Threshold threshold = new Threshold(evtName, 1, 1, new[] { "logout" });

            detector.AddThreshold(threshold);

            Assert.IsTrue(detector.RemoveThreshold(evtName));
        }
Exemplo n.º 6
0
        public void Test_AddExceptionSecurityEvent()
        {
            string evtName = typeof(ArgumentException).FullName;

            IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector;

            Assert.IsNotNull(detector);

            Threshold threshold = new Threshold(evtName, 1, 1, new[] { "log" });

            detector.AddThreshold(threshold);

            ArgumentException arg = new ArgumentException();

            detector.AddException(arg);
        }