diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-08-24 09:14:27 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-08-24 09:14:27 +0200 |
commit | 40b1054530229139a5cacf28ed4b883d52835ad6 (patch) | |
tree | ae6693babddc83bf4c77ef7890726a6b517ed392 /tests | |
parent | 510010e774c4019b7fc616c90085649abb7afac3 (diff) | |
parent | df2ce8a075d70a2180f2b1c7685b19db6d3ce91b (diff) | |
download | nextcloud-server-40b1054530229139a5cacf28ed4b883d52835ad6.tar.gz nextcloud-server-40b1054530229139a5cacf28ed4b883d52835ad6.zip |
Merge pull request #18254 from owncloud/mitigate-breach
Add mitigation against BREACH
Diffstat (limited to 'tests')
12 files changed, 130 insertions, 16 deletions
diff --git a/tests/lib/appframework/controller/ApiControllerTest.php b/tests/lib/appframework/controller/ApiControllerTest.php index 137e5950f67..573fe7f3bad 100644 --- a/tests/lib/appframework/controller/ApiControllerTest.php +++ b/tests/lib/appframework/controller/ApiControllerTest.php @@ -38,6 +38,7 @@ class ApiControllerTest extends \Test\TestCase { $request = new Request( ['server' => ['HTTP_ORIGIN' => 'test']], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->controller = new ChildApiController('app', $request, 'verbs', diff --git a/tests/lib/appframework/controller/ControllerTest.php b/tests/lib/appframework/controller/ControllerTest.php index 0d7716da411..243014a91a7 100644 --- a/tests/lib/appframework/controller/ControllerTest.php +++ b/tests/lib/appframework/controller/ControllerTest.php @@ -76,6 +76,7 @@ class ControllerTest extends \Test\TestCase { 'method' => 'hi', ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); diff --git a/tests/lib/appframework/controller/OCSControllerTest.php b/tests/lib/appframework/controller/OCSControllerTest.php index 92b092cf0e9..292a56e3caa 100644 --- a/tests/lib/appframework/controller/OCSControllerTest.php +++ b/tests/lib/appframework/controller/OCSControllerTest.php @@ -43,6 +43,7 @@ class OCSControllerTest extends \Test\TestCase { ], ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $controller = new ChildOCSController('app', $request, 'verbs', @@ -64,6 +65,7 @@ class OCSControllerTest extends \Test\TestCase { $controller = new ChildOCSController('app', new Request( [], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') )); $expected = "<?xml version=\"1.0\"?>\n" . @@ -96,6 +98,7 @@ class OCSControllerTest extends \Test\TestCase { $controller = new ChildOCSController('app', new Request( [], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') )); $expected = "<?xml version=\"1.0\"?>\n" . @@ -128,6 +131,7 @@ class OCSControllerTest extends \Test\TestCase { $controller = new ChildOCSController('app', new Request( [], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') )); $expected = '{"ocs":{"meta":{"status":"failure","statuscode":400,"message":"OK",' . diff --git a/tests/lib/appframework/dependencyinjection/DIContainerTest.php b/tests/lib/appframework/dependencyinjection/DIContainerTest.php index 0cbdddbb205..598e70beffc 100644 --- a/tests/lib/appframework/dependencyinjection/DIContainerTest.php +++ b/tests/lib/appframework/dependencyinjection/DIContainerTest.php @@ -74,6 +74,7 @@ class DIContainerTest extends \Test\TestCase { $this->container['Request'] = new Request( ['method' => 'GET'], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $security = $this->container['SecurityMiddleware']; diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php index 02c86df8e72..c25fd7b6f85 100644 --- a/tests/lib/appframework/http/DispatcherTest.php +++ b/tests/lib/appframework/http/DispatcherTest.php @@ -295,6 +295,7 @@ class DispatcherTest extends \Test\TestCase { 'method' => 'POST' ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->dispatcher = new Dispatcher( @@ -322,6 +323,7 @@ class DispatcherTest extends \Test\TestCase { 'method' => 'POST', ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->dispatcher = new Dispatcher( @@ -352,6 +354,7 @@ class DispatcherTest extends \Test\TestCase { 'method' => 'GET' ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->dispatcher = new Dispatcher( @@ -381,6 +384,7 @@ class DispatcherTest extends \Test\TestCase { 'method' => 'GET' ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->dispatcher = new Dispatcher( @@ -411,6 +415,7 @@ class DispatcherTest extends \Test\TestCase { 'method' => 'PUT' ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->dispatcher = new Dispatcher( @@ -443,6 +448,7 @@ class DispatcherTest extends \Test\TestCase { 'method' => 'POST' ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->dispatcher = new Dispatcher( diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php index 10a9e486c97..deb28909869 100644 --- a/tests/lib/appframework/http/RequestTest.php +++ b/tests/lib/appframework/http/RequestTest.php @@ -10,6 +10,7 @@ namespace OC\AppFramework\Http; +use OC\Security\Crypto; use OCP\Security\ISecureRandom; use OCP\IConfig; @@ -53,6 +54,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -85,6 +87,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -96,8 +99,8 @@ class RequestTest extends \Test\TestCase { /** - * @expectedException \RuntimeException - */ + * @expectedException \RuntimeException + */ public function testImmutableArrayAccess() { $vars = array( 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), @@ -107,6 +110,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -115,8 +119,8 @@ class RequestTest extends \Test\TestCase { } /** - * @expectedException \RuntimeException - */ + * @expectedException \RuntimeException + */ public function testImmutableMagicAccess() { $vars = array( 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), @@ -126,6 +130,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -134,8 +139,8 @@ class RequestTest extends \Test\TestCase { } /** - * @expectedException \LogicException - */ + * @expectedException \LogicException + */ public function testGetTheMethodRight() { $vars = array( 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), @@ -145,6 +150,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -161,6 +167,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -182,6 +189,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -206,6 +214,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -230,6 +239,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -250,6 +260,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -274,6 +285,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -303,6 +315,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -324,6 +337,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( $vars, $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -347,6 +361,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( [], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -358,6 +373,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( [], \OC::$server->getSecureRandom(), + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -382,6 +398,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -410,6 +427,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -438,6 +456,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -470,6 +489,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -497,6 +517,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( [], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -506,10 +527,10 @@ class RequestTest extends \Test\TestCase { public function testGetServerProtocolWithProtoValid() { $this->config - ->expects($this->exactly(2)) - ->method('getSystemValue') - ->with('overwriteprotocol') - ->will($this->returnValue('')); + ->expects($this->exactly(2)) + ->method('getSystemValue') + ->with('overwriteprotocol') + ->will($this->returnValue('')); $requestHttps = new Request( [ @@ -518,6 +539,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -528,6 +550,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -551,6 +574,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -571,6 +595,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -587,6 +612,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( [], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -607,6 +633,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -628,6 +655,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -716,6 +744,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -732,6 +761,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -749,6 +779,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -766,6 +797,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -793,6 +825,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( [], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -814,6 +847,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -840,6 +874,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -866,6 +901,7 @@ class RequestTest extends \Test\TestCase { ], ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -882,6 +918,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( [], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -909,6 +946,7 @@ class RequestTest extends \Test\TestCase { $request = new Request( [], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -924,6 +962,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -944,6 +983,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -964,6 +1004,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -986,6 +1027,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -1008,6 +1050,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -1030,6 +1073,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -1052,6 +1096,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -1105,6 +1150,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ); @@ -1144,6 +1190,7 @@ class RequestTest extends \Test\TestCase { ] ], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ]) @@ -1157,17 +1204,25 @@ class RequestTest extends \Test\TestCase { } public function testPassesCSRFCheckWithGet() { + $crypto = $this->getMock('\OCP\Security\ICrypto'); + $crypto + ->expects($this->once()) + ->method('decrypt') + ->with('1c637c4147e40a8a8f09428ec2059cebea3480c27b402b4e793c69710a731513|wlXxNUaFqHuQnZr5|e6ab49c9e0e20c8d3607e02f1d8e6ec17ad6020ae10b7d64ab4b0a6318c0875940943a6aa303dc090fea0b4cd5b9fb8bcbecac4308a2bd15d9f369cdc22121a4', 'secret') + ->will($this->returnValue('MyStoredRequestToken')); + /** @var Request $request */ $request = $this->getMockBuilder('\OC\AppFramework\Http\Request') ->setMethods(['getScriptName']) ->setConstructorArgs([ [ 'get' => [ - 'requesttoken' => 'MyStoredRequestToken', + 'requesttoken' => '1c637c4147e40a8a8f09428ec2059cebea3480c27b402b4e793c69710a731513|wlXxNUaFqHuQnZr5|e6ab49c9e0e20c8d3607e02f1d8e6ec17ad6020ae10b7d64ab4b0a6318c0875940943a6aa303dc090fea0b4cd5b9fb8bcbecac4308a2bd15d9f369cdc22121a4:secret', ], 'requesttoken' => 'MyStoredRequestToken', ], $this->secureRandom, + $crypto, $this->config, $this->stream ]) @@ -1177,17 +1232,25 @@ class RequestTest extends \Test\TestCase { } public function testPassesCSRFCheckWithPost() { + $crypto = $this->getMock('\OCP\Security\ICrypto'); + $crypto + ->expects($this->once()) + ->method('decrypt') + ->with('1c637c4147e40a8a8f09428ec2059cebea3480c27b402b4e793c69710a731513|wlXxNUaFqHuQnZr5|e6ab49c9e0e20c8d3607e02f1d8e6ec17ad6020ae10b7d64ab4b0a6318c0875940943a6aa303dc090fea0b4cd5b9fb8bcbecac4308a2bd15d9f369cdc22121a4', 'secret') + ->will($this->returnValue('MyStoredRequestToken')); + /** @var Request $request */ $request = $this->getMockBuilder('\OC\AppFramework\Http\Request') ->setMethods(['getScriptName']) ->setConstructorArgs([ [ 'post' => [ - 'requesttoken' => 'MyStoredRequestToken', + 'requesttoken' => '1c637c4147e40a8a8f09428ec2059cebea3480c27b402b4e793c69710a731513|wlXxNUaFqHuQnZr5|e6ab49c9e0e20c8d3607e02f1d8e6ec17ad6020ae10b7d64ab4b0a6318c0875940943a6aa303dc090fea0b4cd5b9fb8bcbecac4308a2bd15d9f369cdc22121a4:secret', ], 'requesttoken' => 'MyStoredRequestToken', ], $this->secureRandom, + $crypto, $this->config, $this->stream ]) @@ -1197,17 +1260,24 @@ class RequestTest extends \Test\TestCase { } public function testPassesCSRFCheckWithHeader() { + $crypto = $this->getMock('\OCP\Security\ICrypto'); + $crypto + ->expects($this->once()) + ->method('decrypt') + ->with('1c637c4147e40a8a8f09428ec2059cebea3480c27b402b4e793c69710a731513|wlXxNUaFqHuQnZr5|e6ab49c9e0e20c8d3607e02f1d8e6ec17ad6020ae10b7d64ab4b0a6318c0875940943a6aa303dc090fea0b4cd5b9fb8bcbecac4308a2bd15d9f369cdc22121a4', 'secret') + ->will($this->returnValue('MyStoredRequestToken')); /** @var Request $request */ $request = $this->getMockBuilder('\OC\AppFramework\Http\Request') ->setMethods(['getScriptName']) ->setConstructorArgs([ [ 'server' => [ - 'HTTP_REQUESTTOKEN' => 'MyStoredRequestToken', + 'HTTP_REQUESTTOKEN' => '1c637c4147e40a8a8f09428ec2059cebea3480c27b402b4e793c69710a731513|wlXxNUaFqHuQnZr5|e6ab49c9e0e20c8d3607e02f1d8e6ec17ad6020ae10b7d64ab4b0a6318c0875940943a6aa303dc090fea0b4cd5b9fb8bcbecac4308a2bd15d9f369cdc22121a4:secret', ], 'requesttoken' => 'MyStoredRequestToken', ], $this->secureRandom, + $crypto, $this->config, $this->stream ]) @@ -1216,18 +1286,34 @@ class RequestTest extends \Test\TestCase { $this->assertTrue($request->passesCSRFCheck()); } - public function testPassesCSRFCheckWithInvalidToken() { + public function invalidTokenDataProvider() { + return [ + ['InvalidSentToken'], + ['InvalidSentToken:InvalidSecret'], + [null], + [''], + ]; + } + + /** + * @dataProvider invalidTokenDataProvider + * @param string $invalidToken + */ + public function testPassesCSRFCheckWithInvalidToken($invalidToken) { + $crypto = new Crypto($this->config, $this->secureRandom); + /** @var Request $request */ $request = $this->getMockBuilder('\OC\AppFramework\Http\Request') ->setMethods(['getScriptName']) ->setConstructorArgs([ [ 'server' => [ - 'HTTP_REQUESTTOKEN' => 'MyInvalidSentToken', + 'HTTP_REQUESTTOKEN' => $invalidToken, ], 'requesttoken' => 'MyStoredRequestToken', ], $this->secureRandom, + $crypto, $this->config, $this->stream ]) @@ -1243,6 +1329,7 @@ class RequestTest extends \Test\TestCase { ->setConstructorArgs([ [], $this->secureRandom, + $this->getMock('\OCP\Security\ICrypto'), $this->config, $this->stream ]) diff --git a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php index a8731525798..eab45b03c98 100644 --- a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php @@ -133,6 +133,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase { new Request( ['method' => 'GET'], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ) ] diff --git a/tests/lib/appframework/middleware/MiddlewareTest.php b/tests/lib/appframework/middleware/MiddlewareTest.php index 33f04e1383d..8e077b37e2f 100644 --- a/tests/lib/appframework/middleware/MiddlewareTest.php +++ b/tests/lib/appframework/middleware/MiddlewareTest.php @@ -61,6 +61,7 @@ class MiddlewareTest extends \Test\TestCase { new Request( [], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ) ] diff --git a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php index ca526fb859c..f5e6106dc3a 100644 --- a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php +++ b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php @@ -42,6 +42,7 @@ class CORSMiddlewareTest extends \Test\TestCase { ] ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->reflector->reflect($this, __FUNCTION__); @@ -61,6 +62,7 @@ class CORSMiddlewareTest extends \Test\TestCase { ] ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $middleware = new CORSMiddleware($request, $this->reflector, $this->session); @@ -78,6 +80,7 @@ class CORSMiddlewareTest extends \Test\TestCase { $request = new Request( [], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->reflector->reflect($this, __FUNCTION__); @@ -101,6 +104,7 @@ class CORSMiddlewareTest extends \Test\TestCase { ] ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->reflector->reflect($this, __FUNCTION__); @@ -119,6 +123,7 @@ class CORSMiddlewareTest extends \Test\TestCase { $request = new Request( [], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->reflector->reflect($this, __FUNCTION__); @@ -144,6 +149,7 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_PW' => 'pass' ]], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->session->expects($this->once()) @@ -169,6 +175,7 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_PW' => 'pass' ]], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->session->expects($this->once()) @@ -190,6 +197,7 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_PW' => 'pass' ]], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $middleware = new CORSMiddleware($request, $this->reflector, $this->session); @@ -206,6 +214,7 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_PW' => 'pass' ]], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $middleware = new CORSMiddleware($request, $this->reflector, $this->session); @@ -226,6 +235,7 @@ class CORSMiddlewareTest extends \Test\TestCase { 'PHP_AUTH_PW' => 'pass' ]], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $middleware = new CORSMiddleware($request, $this->reflector, $this->session); diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php index 347a0423ea6..3b4d7987e94 100644 --- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php +++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php @@ -322,6 +322,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ] ], $this->getMock('\OCP\Security\ISecureRandom'), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->middleware = $this->getMiddleware(true, true); diff --git a/tests/lib/appframework/middleware/sessionmiddlewaretest.php b/tests/lib/appframework/middleware/sessionmiddlewaretest.php index 11c1600f515..06390e96d4c 100644 --- a/tests/lib/appframework/middleware/sessionmiddlewaretest.php +++ b/tests/lib/appframework/middleware/sessionmiddlewaretest.php @@ -36,6 +36,7 @@ class SessionMiddlewareTest extends \Test\TestCase { $this->request = new Request( [], $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(), + $this->getMock('\OCP\Security\ICrypto'), $this->getMock('\OCP\IConfig') ); $this->reflector = new ControllerMethodReflector(); diff --git a/tests/lib/util.php b/tests/lib/util.php index e52a9fcc618..b9b8062653e 100644 --- a/tests/lib/util.php +++ b/tests/lib/util.php @@ -91,7 +91,7 @@ class Test_Util extends \Test\TestCase { function testCallRegister() { $result = strlen(OC_Util::callRegister()); - $this->assertEquals(30, $result); + $this->assertEquals(221, $result); } function testSanitizeHTML() { |