Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-09-22 13:21:44 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2017-09-24 22:07:16 +0300
commitc257cd57d46143b6007f3c2cb80576c7320dc19e (patch)
tree524f24b43f5dd8edd12942a99bd8ec9e74f4ef00 /lib/base.php
parent4ee731c1ab20b3fb62c9e46abcc3ed717b891e59 (diff)
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.php26
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();