diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-09-22 12:21:44 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-09-24 21:07:16 +0200 |
commit | c257cd57d46143b6007f3c2cb80576c7320dc19e (patch) | |
tree | 524f24b43f5dd8edd12942a99bd8ec9e74f4ef00 /lib/base.php | |
parent | 4ee731c1ab20b3fb62c9e46abcc3ed717b891e59 (diff) | |
download | nextcloud-server-c257cd57d46143b6007f3c2cb80576c7320dc19e.tar.gz nextcloud-server-c257cd57d46143b6007f3c2cb80576c7320dc19e.zip |
Handle SameSiteCookie check for index.php in AppFramework Middleware
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/base.php b/lib/base.php index 29778f02a45..76069303a52 100644 --- a/lib/base.php +++ b/lib/base.php @@ -559,24 +559,20 @@ class OC { if($currentUrl === '/index.php/apps/user_saml/saml/acs' || $currentUrl === '/apps/user_saml/saml/acs') { return; } - // For the "index.php" endpoint only a lax cookie is required. + // index.php routes are handled in the middleware if($processingScript === 'index.php') { - if(!$request->passesLaxCookieCheck()) { - self::sendSameSiteCookies(); - header('Location: '.$_SERVER['REQUEST_URI']); + return; + } + + // All other endpoints require the lax and the strict cookie + if(!$request->passesStrictCookieCheck()) { + self::sendSameSiteCookies(); + // Debug mode gets access to the resources without strict cookie + // due to the fact that the SabreDAV browser also lives there. + if(!\OC::$server->getConfig()->getSystemValue('debug', false)) { + http_response_code(\OCP\AppFramework\Http::STATUS_SERVICE_UNAVAILABLE); exit(); } - } else { - // All other endpoints require the lax and the strict cookie - if(!$request->passesStrictCookieCheck()) { - self::sendSameSiteCookies(); - // Debug mode gets access to the resources without strict cookie - // due to the fact that the SabreDAV browser also lives there. - if(!\OC::$server->getConfig()->getSystemValue('debug', false)) { - http_response_code(\OCP\AppFramework\Http::STATUS_SERVICE_UNAVAILABLE); - exit(); - } - } } } elseif(!isset($_COOKIE['nc_sameSiteCookielax']) || !isset($_COOKIE['nc_sameSiteCookiestrict'])) { self::sendSameSiteCookies(); |