mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
Merge pull request #3787 from nextcloud/ocs-cookie
dont require strict same site cookies for ocs requests
This commit is contained in:
commit
f74911b638
2 changed files with 28 additions and 0 deletions
|
|
@ -490,6 +490,9 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
* @return bool
|
||||
*/
|
||||
private function cookieCheckRequired() {
|
||||
if ($this->getHeader('OCS-APIREQUEST')) {
|
||||
return false;
|
||||
}
|
||||
if($this->getCookie(session_name()) === null && $this->getCookie('nc_token') === null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1787,6 +1787,31 @@ class RequestTest extends \Test\TestCase {
|
|||
$this->assertFalse($request->passesLaxCookieCheck());
|
||||
}
|
||||
|
||||
public function testSkipCookieCheckForOCSRequests() {
|
||||
/** @var Request $request */
|
||||
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
|
||||
->setMethods(['getScriptName'])
|
||||
->setConstructorArgs([
|
||||
[
|
||||
'server' => [
|
||||
'HTTP_REQUESTTOKEN' => 'AAAHGxsTCTc3BgMQESAcNR0OAR0=:MyTotalSecretShareds',
|
||||
'HTTP_OCS_APIREQUEST' => 'true',
|
||||
],
|
||||
'cookies' => [
|
||||
session_name() => 'asdf',
|
||||
'nc_sameSiteCookiestrict' => 'false',
|
||||
],
|
||||
],
|
||||
$this->secureRandom,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
])
|
||||
->getMock();
|
||||
|
||||
$this->assertTrue($request->passesStrictCookieCheck());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue