commit
8a7d450fb5
2 changed files with 3 additions and 2 deletions
|
@ -153,7 +153,7 @@ class SecurityMiddleware extends Middleware {
|
|||
*/
|
||||
if(!$this->request->passesCSRFCheck() && !(
|
||||
$controller instanceof OCSController &&
|
||||
$this->request->getHeader('OCS_APIREQUEST') === true)) {
|
||||
$this->request->getHeader('OCS-APIREQUEST') === 'true')) {
|
||||
throw new CrossSiteRequestForgeryException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
|
|||
[$controller, true, true],
|
||||
|
||||
[$ocsController, false, true],
|
||||
[$ocsController, true, true],
|
||||
[$ocsController, true, false],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -396,6 +396,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
|
|||
public function testCsrfOcsController(Controller $controller, $hasOcsApiHeader, $exception) {
|
||||
$this->request
|
||||
->method('getHeader')
|
||||
->with('OCS-APIREQUEST')
|
||||
->willReturn($hasOcsApiHeader ? 'true' : null);
|
||||
$this->request->expects($this->once())
|
||||
->method('passesStrictCookieCheck')
|
||||
|
|
Loading…
Reference in a new issue