Skip to content

Commit f9b76f6

Browse files
committed
fix: use empty() to check if header exists (port #40856)
1 parent 2d6c6bf commit f9b76f6

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

apps/files_sharing/lib/Controller/Share20OcsController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ protected function formatShare(IShare $share, $received = false) {
281281
* Get a specific share by id
282282
*
283283
* @NoAdminRequired
284+
* @NoCSRFRequired
284285
*
285286
* @param string $id
286287
* @return Result
@@ -664,6 +665,7 @@ private function getSharedWithMe($node = null, $includeTags, $requestedShareType
664665
* the function will return an empty list.
665666
*
666667
* @NoAdminRequired
668+
* @NoCSRFRequired
667669
*
668670
* - Get shares by the current user
669671
* - Get shares by the current user and reshares (?reshares=true)

core/Controller/OcsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public function checkPerson($login, $password) {
110110
* test: curl http://login:passwd@oc/core/ocs/v1.php/privatedata/getattribute
111111
*
112112
* @NoAdminRequired
113+
* @NoCSRFRequired
113114
*
114115
* @return Result
115116
*/

lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ public function beforeController($controller, $methodName) {
143143
// CSRF check - also registers the CSRF token since the session may be closed later
144144
Util::callRegister();
145145
if (!$this->reflector->hasAnnotation('NoCSRFRequired')) {
146-
if (!$this->request->passesCSRFCheck() && $this->request->getHeader("Authorization") === null) {
146+
$hasNoAuthHeader = ($this->request->getHeader("Authorization") === null || trim($this->request->getHeader("Authorization")) === '');
147+
if (!$this->request->passesCSRFCheck() && $hasNoAuthHeader) {
147148
throw new CrossSiteRequestForgeryException();
148149
}
149150
}

0 commit comments

Comments
 (0)