diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-12-23 13:08:10 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-02-04 15:35:23 +0100 |
commit | 8fba05db965f188ff49705af5b55eef87373dd8d (patch) | |
tree | 1dc7b31dd68c77e946d78085392e55dbdf844c09 /apps/dav/lib | |
parent | d63fc8eea498c2035c54e3081c4256f02193235d (diff) | |
download | nextcloud-server-8fba05db965f188ff49705af5b55eef87373dd8d.tar.gz nextcloud-server-8fba05db965f188ff49705af5b55eef87373dd8d.zip |
Check for empty authorization headers for office requests and allow anonymous option on the whole tree
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php index e222eb18857..e0aa19c50b3 100644 --- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php @@ -62,8 +62,11 @@ class AnonymousOptionsPlugin extends ServerPlugin { */ public function handleAnonymousOptions(RequestInterface $request, ResponseInterface $response) { $isOffice = preg_match('/Microsoft Office/i', $request->getHeader('User-Agent')); - $isAnonymousOption = ($request->getMethod() === 'OPTIONS' && ($request->getHeader('Authorization') === null || trim($request->getHeader('Authorization')) === 'Bearer') && $this->isRequestInRoot($request->getPath())); - $isOfficeHead = $request->getMethod() === 'HEAD' && $isOffice && $request->getHeader('Authorization') === 'Bearer'; + $emptyAuth = $request->getHeader('Authorization') === null + || $request->getHeader('Authorization') === '' + || trim($request->getHeader('Authorization')) === 'Bearer'; + $isAnonymousOption = $request->getMethod() === 'OPTIONS' && $emptyAuth; + $isOfficeHead = $request->getMethod() === 'HEAD' && $isOffice && $emptyAuth; if ($isAnonymousOption || $isOfficeHead) { /** @var CorePlugin $corePlugin */ $corePlugin = $this->server->getPlugin('core'); |