route : ratelimit the errors to not allow the hackers to brute force the backend
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2543 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -320,4 +320,22 @@ class test_route extends PHPUnit_Framework_TestCase
|
||||
echo $route->requestURL ();
|
||||
$this->expectOutputString("var=1");
|
||||
}
|
||||
|
||||
/** Ratelimiting in errors */
|
||||
public function test_errorRateLimit1 ()
|
||||
{
|
||||
$route = new route ();
|
||||
$route->error (new \Exception ("test1", 500));
|
||||
$route->error (new \Exception ("test2", 500));
|
||||
$route->error (new \Exception ("test3", 500));
|
||||
$route->error (new \Exception ("test4", 500));
|
||||
$route->error (new \Exception ("test5", 500));
|
||||
$route->error (new \Exception ("test6", 500));
|
||||
$route->error (new \Exception ("test7", 500));
|
||||
$route->error (new \Exception ("test8", 500));
|
||||
$route->error (new \Exception ("test9", 500));
|
||||
$route->error (new \Exception ("test0", 500));
|
||||
$route->error (new \Exception ("test11", 500));
|
||||
$this->expectOutputRegex("#Too much error requests#");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user