diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-08-09 19:09:53 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-08-09 19:23:08 +0200 |
commit | b53ea18ea59c76368b28198968c59b783f17122f (patch) | |
tree | 3290bc5095daa72bee9fc301f3ab8bdd4220dcc2 /lib | |
parent | f3777f8271944103f780bd9869dbcc2f807ae901 (diff) | |
download | nextcloud-server-b53ea18ea59c76368b28198968c59b783f17122f.tar.gz nextcloud-server-b53ea18ea59c76368b28198968c59b783f17122f.zip |
Match only for actual session cookie
OVH has implemented load balancing in a very questionable way where the reverse proxy actually internally adds some cookies which would trigger a security exception. To work around this, this change only checks for the session cookie.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 8fb19f2d9b2..679ee5bc27c 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -486,6 +486,19 @@ class Request implements \ArrayAccess, \Countable, IRequest { } /** + * Whether the cookie checks are required + * + * @return bool + */ + private function cookieCheckRequired() { + if($this->getCookie(session_name()) === null && $this->getCookie('oc_token') === null) { + return false; + } + + return true; + } + + /** * Checks if the strict cookie has been sent with the request if the request * is including any cookies. * @@ -493,7 +506,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @since 9.1.0 */ public function passesStrictCookieCheck() { - if(count($this->cookies) === 0) { + if(!$this->cookieCheckRequired()) { return true; } if($this->getCookie('nc_sameSiteCookiestrict') === 'true' @@ -511,7 +524,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @since 9.1.0 */ public function passesLaxCookieCheck() { - if(count($this->cookies) === 0) { + if(!$this->cookieCheckRequired()) { return true; } if($this->getCookie('nc_sameSiteCookielax') === 'true') { |